[vbox-dev] Conversion to Python 3

Larry Finger Larry.Finger at lwfinger.net
Wed May 30 16:45:53 UTC 2018

On 05/28/2018 06:55 AM, Klaus Espenlaub wrote:
> Hi Larry,
> On 27.05.2018 23:58, Larry Finger wrote:
>> Plans are to convert all openSUSE Factory packages to use Python 3.6
>> rather than 2.7. Accordingly, I have been making the appropriate
>> modifications for the VirtualBox package. I now have converted all of
>> the build part of the RPM setup, but I get the following failure in the
>> install part:
>> [ 1663s] + python -c 'import sys, os, compileall;
>> br='\''/home/abuild/rpmbuild/BUILDROOT/virtualbox-5.2.12-0.x86_64'\'';
>> compileall.compile_dir(sys.argv[1], ddir=br and
>> (sys.argv[1][len(os.path.abspath(br)):]+'\''/'\'') or None)'
>> /home/abuild/rpmbuild/BUILDROOT/virtualbox-5.2.12-0.x86_64/usr/lib/virtualbox/sdk/bindings/xpcom/python
>> [ 1663s] /var/tmp/rpm-tmp.ZpYSxC: line 199: python: command not found
>> [ 1663s] error: Bad exit status from /var/tmp/rpm-tmp.ZpYSxC (%install)
>> That command should be "python3", not "python". Unfortunately, grepping
>> for key parts of that command line fail. Can anyone point me to the
>> section of the source where this command is generated?
> That's in src/VBox/Installer/linux/rpm/VirtualBox.tmpl.spec if you
> didn't create your own. It's deliberately not hardwired to a specific
> Python version, it uses the one which the RPM build env specifies. I
> would expect in an OS which has flipped the big Python switch to 3.x,
> that __python points to python3.
> In other installers we use a more dynamic approach, but for deb/rpm it
> seems we never attempt to ship multiple vbox api bindings for different
> versions, everything is built purely for the "default".
> Hope this clarifies the situation,


Yes it does. Thank you.

We do roll our own spec file at openSUSE. I was finally able to isolate the 
problem to a py_compile macro that is hard-wired to use Python2. I have replaced 
it in the spec file and have gotten past that point. The build is now OK, only 
the packaging needs to be debugged. Of course, it is tough to find bugs when it 
takes about 30 minutes before it fails.

Thanks again,


More information about the vbox-dev mailing list