Create an additional symlink to the 'local' dir in case the posix_loc… · pypa/virtualenv@285679c (original) (raw)
`@@ -13,6 +13,7 @@
`
13
13
`import re
`
14
14
`import shutil
`
15
15
`import logging
`
``
16
`+
import sysconfig
`
16
17
`import tempfile
`
17
18
`import zlib
`
18
19
`import errno
`
`@@ -1011,6 +1012,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
`
1011
1012
`prefix = sys.prefix
`
1012
1013
`mkdir(lib_dir)
`
1013
1014
`fix_lib64(lib_dir)
`
``
1015
`+
fix_local_scheme(home_dir)
`
1014
1016
`stdlib_dirs = [os.path.dirname(os.file)]
`
1015
1017
`if sys.platform == 'win32':
`
1016
1018
`stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
`
`@@ -1266,6 +1268,17 @@ def install_distutils(home_dir):
`
1266
1268
`writefile(os.path.join(distutils_path, 'init.py'), DISTUTILS_INIT)
`
1267
1269
`writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
`
1268
1270
``
``
1271
`+
def fix_local_scheme(home_dir):
`
``
1272
`+
"""
`
``
1273
`+
Platforms that use the "posix_local" install scheme (like Ubuntu with
`
``
1274
`+
Python 2.7) need to be given an additional "local" location, sigh.
`
``
1275
`+
"""
`
``
1276
`+
if sysconfig._get_default_scheme() == 'posix_local':
`
``
1277
`+
local_path = os.path.join(home_dir, 'local')
`
``
1278
`+
if not os.path.exists(local_path):
`
``
1279
`+
os.symlink(os.path.abspath(home_dir), local_path)
`
``
1280
+
``
1281
+
1269
1282
`def fix_lib64(lib_dir):
`
1270
1283
`"""
`
1271
1284
` Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
`