From 8aaa5f2d46444e8685f76c3d56b6800ae3c842a2 Mon Sep 17 00:00:00 2001 From: Alexey Pavlov Date: Wed, 19 Jun 2019 12:05:19 +0300 Subject: [PATCH] python-virtualenv: Try add support for our own python for mingw --- .../001-mingw-python-support.patch | 69 +++++++++++++++++++ mingw-w64-python-virtualenv/PKGBUILD | 12 +++- 2 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 mingw-w64-python-virtualenv/001-mingw-python-support.patch diff --git a/mingw-w64-python-virtualenv/001-mingw-python-support.patch b/mingw-w64-python-virtualenv/001-mingw-python-support.patch new file mode 100644 index 0000000000..6329200f9a --- /dev/null +++ b/mingw-w64-python-virtualenv/001-mingw-python-support.patch @@ -0,0 +1,69 @@ +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) diff --git a/mingw-w64-python-virtualenv/PKGBUILD b/mingw-w64-python-virtualenv/PKGBUILD index 2a536ae6d8..0019729248 100644 --- a/mingw-w64-python-virtualenv/PKGBUILD +++ b/mingw-w64-python-virtualenv/PKGBUILD @@ -8,7 +8,7 @@ _realname=${_pyname} #This should be lowercase pkgbase=mingw-w64-python-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}") pkgver=16.1.0 -pkgrel=1 +pkgrel=2 pkgdesc="Virtual Python Environment builder (mingw-w64)" arch=('any') url='https://virtualenv.pypa.io/' @@ -20,10 +20,16 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-python2" checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest" "${MINGW_PACKAGE_PREFIX}-python3-mock" "${MINGW_PACKAGE_PREFIX}-python2-pytest" "${MINGW_PACKAGE_PREFIX}-python2-mock") options=('staticlibs' 'strip' '!debug') -source=(${_realname}-${pkgver}.tar.gz::https://github.com/pypa/virtualenv/archive/${pkgver}.tar.gz) -sha256sums=('b906ef15b98227bfdacb73179932ee9640902f4721b53503e8e4cb1cf054cf4c') +source=(${_realname}-${pkgver}.tar.gz::https://github.com/pypa/virtualenv/archive/${pkgver}.tar.gz + 001-mingw-python-support.patch) +sha256sums=('b906ef15b98227bfdacb73179932ee9640902f4721b53503e8e4cb1cf054cf4c' + '4748c82d5b71ef1622bbc2eb5fa424da3a739a4364f45f4ab6e5897e2b090b80') prepare() { + cd ${_pyname}-${pkgver} + patch -p1 -i ${srcdir}/001-mingw-python-support.patch + + cd ${srcdir} for builddir in python{2,3}-build-${CARCH}; do rm -rf $builddir | true cp -r "${_pyname}-${pkgver}" "${builddir}"