Author: David Schneider <[email protected]>
Branch:
Changeset: r64226:0275e2265a21
Date: 2013-05-16 14:07 +0200
http://bitbucket.org/pypy/pypy/changeset/0275e2265a21/
Log: (arigo, bivab) if executable is not set, look for sdlib based on the
current directory
diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -68,7 +68,7 @@
If it cannot be found, return (None, None).
"""
if executable == '':
- return None, None
+ executable = 'pypy-c'
search = executable
while True:
dirname = resolvedirof(search)
diff --git a/pypy/module/sys/test/test_initpath.py
b/pypy/module/sys/test/test_initpath.py
--- a/pypy/module/sys/test/test_initpath.py
+++ b/pypy/module/sys/test/test_initpath.py
@@ -16,9 +16,12 @@
build_hierarchy(tmpdir)
path, prefix = find_stdlib(None, str(pypy))
assert prefix == tmpdir
- # shouldn't find stdlib if executable == '' even if parent dir has a stdlib
- monkeypatch.chdir(tmpdir.join('bin'))
- assert find_stdlib(None, '') == (None, None)
+ # in executable is None look for stdlib based on the working directory
+ # see lib-python/2.7/test/test_sys.py:test_executable
+ _, prefix = find_stdlib(None, '')
+ cwd = os.path.dirname(os.path.realpath(__file__))
+ assert prefix is not None
+ assert cwd.startswith(str(prefix))
@py.test.mark.skipif('not hasattr(os, "symlink")')
def test_find_stdlib_follow_symlink(tmpdir):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit