]> git.pld-linux.org Git - packages/python-virtualenv.git/blob - multilib.patch
- more x32 fixes, should work now on all archs
[packages/python-virtualenv.git] / multilib.patch
1 --- virtualenv-15.0.1/virtualenv.py~    2016-03-17 16:16:07.000000000 +0100
2 +++ virtualenv-15.0.1/virtualenv.py     2016-10-18 22:48:47.174956732 +0200
3 @@ -1094,7 +1094,7 @@
4      else:
5          prefix = sys.prefix
6      mkdir(lib_dir)
7 -    fix_lib64(lib_dir, symlink)
8 +    fix_libarch(lib_dir, symlink)
9      stdlib_dirs = [os.path.dirname(os.__file__)]
10      if is_win:
11          stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
12 @@ -1498,7 +1498,7 @@
13                      copyfile(os.path.abspath(os.path.join(home_dir, subdir_name)), \
14                                                              os.path.join(local_path, subdir_name), symlink)
15  
16 -def fix_lib64(lib_dir, symlink=True):
17 +def fix_libarch(lib_dir, symlink=True):
18      """
19      Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
20      instead of lib/pythonX.Y.  If this is such a platform we'll just create a
21 @@ -1507,29 +1507,37 @@
22      # PyPy's library path scheme is not affected by this.
23      # Return early or we will die on the following assert.
24      if is_pypy:
25 -        logger.debug('PyPy detected, skipping lib64 symlinking')
26 +        logger.debug('PyPy detected, skipping lib64/libx32 symlinking')
27          return
28 -    # Check we have a lib64 library path
29 -    if not [p for p in distutils.sysconfig.get_config_vars().values()
30 +    lib_arch = None
31 +    # Check we have a lib64 or libx32 library path
32 +    if [p for p in distutils.sysconfig.get_config_vars().values()
33 +            if isinstance(p, basestring) and 'libx32' in p]:
34 +        lib_arch = 'libx32'
35 +
36 +    if [p for p in distutils.sysconfig.get_config_vars().values()
37              if isinstance(p, basestring) and 'lib64' in p]:
38 +        lib_arch = 'lib64'
39 +
40 +    if not lib_arch:
41          return
42  
43 -    logger.debug('This system uses lib64; symlinking lib64 to lib')
44 +    logger.debug('This system uses %s; symlinking %s to lib', lib_arch, lib_arch)
45  
46      assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
47          "Unexpected python lib dir: %r" % lib_dir)
48      lib_parent = os.path.dirname(lib_dir)
49      top_level = os.path.dirname(lib_parent)
50      lib_dir = os.path.join(top_level, 'lib')
51 -    lib64_link = os.path.join(top_level, 'lib64')
52 +    libarch_link = os.path.join(top_level, lib_arch)
53      assert os.path.basename(lib_parent) == 'lib', (
54          "Unexpected parent dir: %r" % lib_parent)
55 -    if os.path.lexists(lib64_link):
56 +    if os.path.lexists(libarch_link):
57          return
58      if symlink:
59 -        os.symlink('lib', lib64_link)
60 +        os.symlink('lib', libarch_link)
61      else:
62 -        copyfile('lib', lib64_link)
63 +        copyfile('lib', libarch_link)
64  
65  def resolve_interpreter(exe):
66      """
67 --- virtualenv-15.0.1/virtualenv_support/site.py~       2016-10-19 09:09:07.000000000 +0200
68 +++ virtualenv-15.0.1/virtualenv_support/site.py        2016-10-19 09:11:26.681732254 +0200
69 @@ -243,6 +243,13 @@
70                          sitedirs.insert(0, lib64_dir)
71                      else:
72                          sitedirs.append(lib64_dir)
73 +                libx32_dir = os.path.join(prefix, "libx32", "python" + sys.version[:3], "site-packages")
74 +                if (os.path.exists(libx32_dir) and
75 +                    os.path.realpath(libx32_dir) not in [os.path.realpath(p) for p in sitedirs]):
76 +                    if _is_64bit:
77 +                        sitedirs.append(libx32_dir)
78 +                    else:
79 +                        sitedirs.insert(0, libx32_dir)
80                  try:
81                      # sys.getobjects only available in --with-pydebug build
82                      sys.getobjects
83 @@ -589,6 +596,12 @@
84                  paths.insert(0, lib64_path)
85              else:
86                  paths.append(lib64_path)
87 +        libx32_path = os.path.join(sys.real_prefix, 'libx32', 'python'+sys.version[:3])
88 +        if os.path.exists(libx32_path):
89 +            if _is_64bit:
90 +                paths.append(libx32_path)
91 +            else:
92 +                paths.insert(0, libx32_path)
93          # This is hardcoded in the Python executable, but relative to
94          # sys.prefix.  Debian change: we need to add the multiarch triplet
95          # here, which is where the real stuff lives.  As per PEP 421, in
This page took 0.056706 seconds and 3 git commands to generate.