[pypy-commit] pypy default: sys.path issues (thanks matti)
arigo
pypy.commits at gmail.com
Sat Oct 1 04:16:38 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r87482:6642fe40f5f4
Date: 2016-10-01 10:16 +0200
http://bitbucket.org/pypy/pypy/changeset/6642fe40f5f4/
Log: sys.path issues (thanks matti)
diff --git a/pypy/tool/build_cffi_imports.py b/pypy/tool/build_cffi_imports.py
--- a/pypy/tool/build_cffi_imports.py
+++ b/pypy/tool/build_cffi_imports.py
@@ -1,5 +1,4 @@
-import sys, shutil
-from rpython.tool.runsubprocess import run_subprocess
+import sys, shutil, os
class MissingDependenciesError(Exception):
pass
@@ -18,6 +17,8 @@
}
def create_cffi_import_libraries(pypy_c, options, basedir):
+ from rpython.tool.runsubprocess import run_subprocess
+
shutil.rmtree(str(basedir.join('lib_pypy', '__pycache__')),
ignore_errors=True)
failures = []
@@ -42,11 +43,16 @@
return failures
if __name__ == '__main__':
- import py, os
if '__pypy__' not in sys.builtin_module_names:
print >> sys.stderr, 'Call with a pypy interpreter'
sys.exit(1)
+ tool_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
+ base_dir = os.path.dirname(os.path.dirname(tool_dir))
+ sys.path.insert(0, base_dir)
+
+ import py
+
class Options(object):
pass
More information about the pypy-commit
mailing list