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-19 11:57:28.507377600 +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") @@ -1197,7 +1203,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")) @@ -1263,7 +1269,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") @@ -1365,7 +1371,11 @@ copyfile(py_executable, python_executable, symlink) if is_win: - for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]: + 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: src = join(prefix, name) if os.path.exists(src): copyfile(src, join(bin_dir, name), symlink)