mozbuild.configure.options.InvalidOptionError: Unknown option: PYTHON



Firefox Build System
2 years ago
4 months ago


(Reporter: Jan Beich, Unassigned)



Firefox Tracking Flags

(firefox50 affected)



(1 attachment)



2 years ago
After bug 1264527 changing python interpreter seems to be impossible to do via .mozconfig.

$ echo 'export PYTHON="/usr/local/bin/python2.7"' >>.mozconfig
$ gmake -f configure
mkdir -p '/objdir/'
python2.7 /mozilla-central/config/ -I /mozilla-central/testing/mozbase/mozfile \
    /mozilla-central/python/mozbuild/mozbuild/controller/ /tmp/mozilla-central /objdir
Clobber not needed.
> /objdir/
Generating /mozilla-central/configure
sed '1,/^divert/d' /mozilla-central/ > /mozilla-central/configure
chmod +x /mozilla-central/configure
Generating /mozilla-central/js/src/configure
sed '1,/^divert/d' /mozilla-central/js/src/ > /mozilla-central/js/src/configure
chmod +x /mozilla-central/js/src/configure
cp /mozilla-central/.mozconfig /objdir/.mozconfig
cd /objdir
Creating Python environment
New python executable in /objdir/_virtualenv/bin/python2.7
Also creating executable in /objdir/_virtualenv/bin/python
Installing setuptools, pip, wheel...done.
running build_ext
building 'psutil._psutil_bsd' extension
creating build
creating build/temp.freebsd-12.0-CURRENT-amd64-2.7
creating build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil
creating build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/arch
creating build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/arch/bsd
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -DNDEBUG -fPIC -DPSUTIL_VERSION=311 -I/usr/local/include/python2.7 -c psutil/_psutil_bsd.c -o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_bsd.o
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -DNDEBUG -fPIC -DPSUTIL_VERSION=311 -I/usr/local/include/python2.7 -c psutil/_psutil_common.c -o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_common.o
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -DNDEBUG -fPIC -DPSUTIL_VERSION=311 -I/usr/local/include/python2.7 -c psutil/arch/bsd/process_info.c -o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/arch/bsd/process_info.o
creating build/lib.freebsd-12.0-CURRENT-amd64-2.7
creating build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil
cc -shared -lpthread -L/usr/local/lib -fstack-protector build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_bsd.o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_common.o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/arch/bsd/process_info.o -L/usr/local/lib -ldevstat -lpython2.7 -o build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/
building 'psutil._psutil_posix' extension
cc -fno-strict-aliasing -O2 -pipe -fstack-protector -DNDEBUG -fPIC -I/usr/local/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_posix.o
cc -shared -lpthread -L/usr/local/lib -fstack-protector build/temp.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_posix.o -L/usr/local/lib -lpython2.7 -o build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/
copying build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/ -> psutil
copying build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/ -> psutil

Reexecuting in the virtualenv
Adding configure options from /mozilla-central/.mozconfig
checking for a shell... /bin/sh
checking for host system type... x86_64-unknown-freebsd12.0
checking for target system type... x86_64-unknown-freebsd12.0
Traceback (most recent call last):
  File "/mozilla-central/", line 94, in <module>
  File "/mozilla-central/", line 22, in main, 'moz.configure'))
  File "/mozilla-central/python/mozbuild/mozbuild/configure/", line 256, in run
    raise InvalidOptionError('Unknown option: %s' % without_value)
mozbuild.configure.options.InvalidOptionError: Unknown option: PYTHON
*** Fix above errors and then restart with\
               "gmake -f build"
gmake: *** [ configure] Error 1
I'm actually glad this fails, because it's a corner case that is not taken into account by the code. Please set PYTHON as an environment variable until this maybe gets fixed.
(In reply to Mike Hommey [:glandium] from comment #1)
> I'm actually glad this fails, because it's a corner case that is not taken
> into account by the code.

That is, if it worked before bug 1264527, it was an accident, and may have been subtly broken.
Mmmmm actually, it was not an accident that it worked... What doesn't work properly, however, is to set PYTHON like `mach configure PYTHON=...`
Created attachment 8773600 [details] [diff] [review]
Possible patch

This fixes it, but has the caveat that PYTHON=.... doesn't show up anymore in the list of things taken from mozconfig. OTOH, since that was already printed out *after* python was being handled...

I guess the virtualenv_python function should print out the python it's re-executing with.


4 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.