setup: Propagate only setuptools, not whole sys.path
This updates and fixes 487e5226 (setup: specify setuptools location explicitly when calling make.) to use @kazuhiko original idea to propagate only setuptools location. The reason is - when propagating whole sys.path things break under tox tests: ---- 8< ---- ========================================================================== test session starts =========================================================================== platform linux2 -- Python 2.7.12, pytest-2.9.2, py-1.4.31, pluggy-0.3.1 rootdir: /home/kirr/src/wendelin/release/wendelin.core, inifile: collected 33 items bigarray/tests/test_arrayzodb.py ....... bigarray/tests/test_basic.py ........ bigfile/tests/test_basic.py .... bigfile/tests/test_filefile.py . bigfile/tests/test_filezodb.py ........ bigfile/tests/test_thread.py .... lib/tests/test_calc.py . ======================================================================= 33 passed in 14.14 seconds ======================================================================= x86_64-linux-gnu-gcc -pthread -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions -Wno-declaration-after-statement -Wno-error=declaration-after-statement -Iinclude -I3rdparty/ccan -I3rdparty/include bigfile/tests/tfault.c lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c -o bigfile/tests/tfault.t t/tfault-run bigfile/tests/tfault.t faultr on_pagefault ok 1 - !pagefault_init() Fatal Python error: Py_Initialize: Unable to get the locale encoding File ".../wendelin.core/.tox/py27-ZODB3-zblk0-fs-numpy110/lib/python2.7/encodings/__init__.py", line 123 raise CodecRegistryError,\ ^ SyntaxError: invalid syntax Current thread 0x00007f9b80024780 (most recent call first): t/tfault-run: line 28: 21521 Аварийный останов (core dumped) gdb -q -batch $tfault core > core.info E: can't gdb(core) Makefile:189: ошибка выполнения рецепта для цели «faultr.tfault» make: *** [faultr.tfault] Ошибка 1 rm bigfile/tests/test_virtmem.t bigfile/tests/test_ram.t bigfile/tests/tfault.t bigfile/tests/test_pagemap.t error: Failed to execute `make test` ERROR: InvocationError: '.../wendelin.core/.tox/py27-ZODB3-zblk0-fs-numpy110/bin/python setup.py test' ________________________________________________________________________________ summary _________________________________________________________________________________ ERROR: py27-ZODB3-zblk0-fs-numpy110: commands failed ---- 8< ---- What happens here is: - gdb is used in automated tests - gdb is linked with libpython3.5 - tox is currently running tests with python27 - setup.py sets PYTHONPATH to whole path from python27 - gdb, upon starting, initializes python runtime, which tries to load py27 modules under py35 -> oops. So propagating only setuptools location practically solves the issue for now, but still there is potential risk that in future, there will be other modules put in the same location as setuptools (location is parent dir of a module/package) which python tries to load on startup and which might be incompatible between 2 & 3. Thus not setting PYTHONPATH at all - e.g. creating environments virtualenv way - would be better, but buildout fundamentally works the other way. We can not also use -c 'buildout sys.path hack' in $PYTHON itself, as $PYTHON is used in general way inside Makefile. So let the hack with setuptools location in PYTHONPATH stay there until it practically works.
Showing
Please register or sign in to comment