Author: Matti Picus <[email protected]>
Branch: py3.5
Changeset: r93698:b4efaafea1bd
Date: 2018-01-22 20:52 +0200
http://bitbucket.org/pypy/pypy/changeset/b4efaafea1bd/
Log: hack venv to work even if os.readlink is missing
diff --git a/lib-python/3/test/test_venv.py b/lib-python/3/test/test_venv.py
--- a/lib-python/3/test/test_venv.py
+++ b/lib-python/3/test/test_venv.py
@@ -59,6 +59,8 @@
os.readlink(executable))
except OSError:
pass
+ except AttributeError:
+ pass
return executable
diff --git a/lib-python/3/venv/__init__.py b/lib-python/3/venv/__init__.py
--- a/lib-python/3/venv/__init__.py
+++ b/lib-python/3/venv/__init__.py
@@ -121,13 +121,17 @@
executable = sys.executable
#
# PyPy extension: resolve 'executable' if it is a symlink
- try:
- for i in range(10):
- executable = os.path.abspath(executable)
- executable = os.path.join(os.path.dirname(executable),
- os.readlink(executable))
- except OSError:
- pass
+ # XXX as of PyPy 5.10, win32 does not have readlink
+ # note it is highly unlikely that symlinks were used on win32
+ # since it requires admin priveleges
+ if hasattr(os, 'readlink'):
+ try:
+ for i in range(10):
+ executable = os.path.abspath(executable)
+ executable = os.path.join(os.path.dirname(executable),
+ os.readlink(executable))
+ except OSError:
+ pass
#
dirname, exename = os.path.split(os.path.abspath(executable))
context.executable = executable
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit