Bug 837631 - Part 2: Unbust virtualenv on Debians; r=glandium

This is a cherry-pick of Git commit 813fc02af8723421eeeadcb13eb361e2e44416ca
from the Virtualenv repo. It fixes https://github.com/pypa/virtualenv/issues/378.
This commit is contained in:
Gregory Szorc 2013-02-04 09:34:03 -08:00
parent abe0bea34f
commit dd1d41aa45

View File

@ -584,9 +584,19 @@ def virtual_install_main_packages():
paths.insert(0, lib64_path)
else:
paths.append(lib64_path)
# This is hardcoded in the Python executable, but relative to sys.prefix:
plat_path = os.path.join(sys.real_prefix, 'lib', 'python'+sys.version[:3],
'plat-%s' % sys.platform)
# This is hardcoded in the Python executable, but relative to
# sys.prefix. Debian change: we need to add the multiarch triplet
# here, which is where the real stuff lives. As per PEP 421, in
# Python 3.3+, this lives in sys.implementation, while in Python 2.7
# it lives in sys.
try:
arch = getattr(sys, 'implementation', sys)._multiarch
except AttributeError:
# This is a non-multiarch aware Python. Fallback to the old way.
arch = sys.platform
plat_path = os.path.join(sys.real_prefix, 'lib',
'python'+sys.version[:3],
'plat-%s' % arch)
if os.path.exists(plat_path):
paths.append(plat_path)
# This is hardcoded in the Python executable, but