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
--- a/python/virtualenv/virtualenv.py
+++ b/python/virtualenv/virtualenv.py
@@ -1125,17 +1125,23 @@ def install_python(home_dir, lib_dir, in
import site
site_filename = site.__file__
if site_filename.endswith('.pyc') or site_filename.endswith('.pyo'):
site_filename = site_filename[:-1]
elif site_filename.endswith('$py.class'):
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:
writefile(site_packages_filename, '')
if is_pypy or is_win:
stdinc_dir = join(prefix, 'include')
else: