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

NEW
Unassigned

Status

Firefox Build System
General
2 years ago
4 months ago

People

(Reporter: Jan Beich, Unassigned)

Tracking

Trunk

Firefox Tracking Flags

(firefox50 affected)

Details

Attachments

(1 attachment)

(Reporter)

Description

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 client.mk configure
mkdir -p '/objdir/'
python2.7 /mozilla-central/config/pythonpath.py -I /mozilla-central/testing/mozbase/mozfile \
    /mozilla-central/python/mozbuild/mozbuild/controller/clobber.py /tmp/mozilla-central /objdir
Clobber not needed.
> /objdir/.mozconfig.mk
Generating /mozilla-central/configure
sed '1,/^divert/d' /mozilla-central/configure.in > /mozilla-central/configure
chmod +x /mozilla-central/configure
Generating /mozilla-central/js/src/configure
sed '1,/^divert/d' /mozilla-central/js/src/configure.in > /mozilla-central/js/src/configure
chmod +x /mozilla-central/js/src/configure
cp /mozilla-central/.mozconfig /objdir/.mozconfig
cd /objdir
/mozilla-central/configure
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/_psutil_bsd.so
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/_psutil_posix.so
copying build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_bsd.so -> psutil
copying build/lib.freebsd-12.0-CURRENT-amd64-2.7/psutil/_psutil_posix.so -> psutil

Reexecuting in the virtualenv
Adding configure options from /mozilla-central/.mozconfig
  --enable-alsa
  --disable-pulseaudio
  --disable-gconf
  --disable-dbus
  PYTHON=/usr/local/bin/python2.7
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/configure.py", line 94, in <module>
    sys.exit(main(sys.argv))
  File "/mozilla-central/configure.py", line 22, in main
    sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
  File "/mozilla-central/python/mozbuild/mozbuild/configure/__init__.py", 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 client.mk build"
gmake: *** [client.mk:377: 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.

Updated

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