Files
MINGW-packages/mingw-w64-python2-virtualenv/001-mingw-python-support.patch
2019-07-22 21:38:33 -04:00

116 lines
5.0 KiB
Diff

diff -Naur virtualenv-16.1.0-orig/src/virtualenv.py virtualenv-16.1.0/src/virtualenv.py
--- virtualenv-16.1.0-orig/src/virtualenv.py 2018-10-31 18:06:44.000000000 +0300
+++ virtualenv-16.1.0/src/virtualenv.py 2019-06-20 10:53:09.878842500 +0300
@@ -57,6 +57,7 @@
is_jython = sys.platform.startswith("java")
is_pypy = hasattr(sys, "pypy_version_info")
is_win = sys.platform == "win32"
+is_mingw = is_win and ('GCC' in sys.version)
is_cygwin = sys.platform == "cygwin"
is_darwin = sys.platform == "darwin"
abiflags = getattr(sys, "abiflags", "")
@@ -77,7 +78,7 @@
# Return a mapping of version -> Python executable
# Only provided for Windows, where the information in the registry is used
-if not is_win:
+if not is_win or is_mingw:
def get_installed_pythons():
return {}
@@ -1052,9 +1053,14 @@
print("Exiting.")
sys.exit(3)
home_dir = str(buf.value)
- lib_dir = join(home_dir, "Lib")
- inc_dir = join(home_dir, "Include")
- bin_dir = join(home_dir, "Scripts")
+ if is_mingw:
+ lib_dir = join(home_dir, "lib", py_version)
+ inc_dir = join(home_dir, "include", py_version + abiflags)
+ bin_dir = join(home_dir, "bin")
+ else:
+ lib_dir = join(home_dir, "Lib")
+ inc_dir = join(home_dir, "Include")
+ bin_dir = join(home_dir, "Scripts")
if is_jython:
lib_dir = join(home_dir, "Lib")
inc_dir = join(home_dir, "Include")
@@ -1156,8 +1162,12 @@
""" copy tcl/tk libraries on Windows (issue #93) """
for libversion in "8.5", "8.6":
for libname in "tcl", "tk":
- srcdir = join(src, "tcl", libname + libversion)
- destdir = join(dest, "tcl", libname + libversion)
+ if is_mingw:
+ srcdir = join(src, "lib", libname + libversion)
+ destdir = join(dest, "lib", libname + libversion)
+ else:
+ srcdir = join(src, "tcl", libname + libversion)
+ destdir = join(dest, "tcl", libname + libversion)
# Only copy the dirs from the above combinations that exist
if os.path.exists(srcdir) and not os.path.exists(destdir):
copyfileordir(srcdir, destdir, symlink)
@@ -1197,7 +1207,7 @@
mkdir(lib_dir)
fix_lib64(lib_dir, symlink)
stdlib_dirs = [os.path.dirname(os.__file__)]
- if is_win:
+ if is_win and not is_mingw:
stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
elif is_darwin:
stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
@@ -1238,7 +1248,7 @@
if not site_packages:
writefile(site_packages_filename, "")
- if is_pypy or is_win:
+ if (is_pypy or is_win) and not is_mingw:
stdinc_dir = join(prefix, "include")
else:
stdinc_dir = join(prefix, "include", py_version + abiflags)
@@ -1263,7 +1273,7 @@
# pypy never uses exec_prefix, just ignore it
if sys.exec_prefix != prefix and not is_pypy:
- if is_win:
+ if is_win and not is_mingw:
exec_dir = join(sys.exec_prefix, "lib")
elif is_jython:
exec_dir = join(sys.exec_prefix, "Lib")
@@ -1338,10 +1348,16 @@
py_executable_dlls = [
("python%s.dll" % (sys.version_info[0]), "python%s_d.dll" % (sys.version_info[0])),
(
+ "libpython{}.{}{}.dll".format(sys.version_info[0], sys.version_info[1], sys.abiflags),
+ "libpython{}.{}{}_d.dll".format(sys.version_info[0], sys.version_info[1], sys.abiflags),
+ ),
+ (
"python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
"python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
),
]
+ if is_mingw:
+ py_executable_dlls += [ ("libwinpthread-1.dll", "libwinpthread-1d.dll"), ]
for py_executable_dll, py_executable_dll_d in py_executable_dlls:
pythondll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
@@ -1365,8 +1381,15 @@
copyfile(py_executable, python_executable, symlink)
if is_win:
- for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
- src = join(prefix, name)
+ if is_mingw:
+ dllstocopy = ["libexpat-1.dll", "libcrypto-1_1.dll", "libssl-1_1.dll", "libsqlite3-0.dll", "tcl86.dll", "tk86.dll"]
+ else:
+ dllstocopy = ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]
+ for name in dllstocopy:
+ if is_mingw:
+ src = join(prefix + "\\bin", name)
+ else:
+ src = join(prefix, name)
if os.path.exists(src):
copyfile(src, join(bin_dir, name), symlink)