Commit 8b9a8081 authored by Kazuhiko's avatar Kazuhiko

setup: specify setuptools location explicitly when calling make.

If wendline.core is built under buildout and setuptools exists only in
buildout environment, 'python setup.py' called inside make will fail
without this change.

Building 'wendelin.core'
Running easy_install:
"/path/to/python2.7" "-c" "import sys; sys.path[0:0] = ['/path/to/setuptools-19.6.2-py2.7.egg']; from setuptools.command.easy_install import main; main()"...
path_list=['/path/to/setuptools-19.6.2-py2.7.egg']
...
<<< setup.py: os.system('make %s PYTHON="%s"' % (target, sys.executable))
...
make[1]: Leaving directory '/tmp/xxx/wendelin.core-0.6/3rdparty/ccan'
/path/to/python2.7 setup.py ll_build_ext --inplace
Traceback (most recent call last):
  File "setup.py", line 18, in <module>
    from setuptools import setup, Extension, Command, find_packages
ImportError: No module named setuptools
Makefile:40: recipe for target 'bigfile/_bigfile.so' failed
make: *** [bigfile/_bigfile.so] Error 1
error: Setup script exited with error: Failed to execute `make all`
parent e6beab19
......@@ -112,7 +112,14 @@ class build_py(_build_py):
# run `make <target>`
def runmake(target):
err = os.system('make %s PYTHON="%s"' % (target, sys.executable))
setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
original_python_path = os.environ.get('PYTHONPATH')
os.environ['PYTHONPATH'] = setuptools_location
try:
err = os.system('make %s PYTHON="%s"' % (target, sys.executable))
finally:
os.environ['PYTHONPATH'] = original_python_path
if err:
raise DistutilsExecError('Failed to execute `make %s`' % target)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment