Bug 1100925 - Virtualenv now copies a site.py file in its folder (if it exists) instead of using the hex string for site.py that is in its source code. r=gps

We need this to avoid weird site.py hacks to get msys2 to play nicely with virtualenv.

MozReview-Commit-ID: 9lJSo6MistO
This commit is contained in:
Nathan Hakkakzadeh
2016-06-06 10:27:05 -07:00
parent 8382a205c0
commit aefdadc841

View File

@@ -1130,7 +1130,13 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
site_filename = site_filename.replace('$py.class', '.py')
site_filename_dst = change_prefix(site_filename, home_dir)
site_dir = os.path.dirname(site_filename_dst)
writefile(site_filename_dst, SITE_PY)
# MOZ: Copies a site.py if it exists instead of using the one hex encoded in
# this file. Necessary for some site.py fixes for MinGW64 version of python
site_py_src_path = os.path.join(os.path.dirname(__file__), 'site.py')
if os.path.isfile(site_py_src_path):
shutil.copy(site_py_src_path, site_filename_dst)
else:
writefile(site_filename_dst, SITE_PY)
writefile(join(site_dir, 'orig-prefix.txt'), prefix)
site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
if not site_packages: