From 3fbea030264e3f780c26abfee553f53e6cd8434d Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 11 Aug 2019 07:23:08 +1000 Subject: [PATCH] Added fallback for finding ld on MinGW Cygwin --- setup.py | 12 ++++++++++++ winbuild/appveyor_install_msys2_deps.sh | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index c84b0fc8df3..a36e192ec86 100755 --- a/setup.py +++ b/setup.py @@ -118,6 +118,18 @@ class RequiredDependencyException(Exception): PLATFORM_MINGW = "mingw" in ccompiler.get_default_compiler() PLATFORM_PYPY = hasattr(sys, "pypy_version_info") +if sys.platform == "win32" and PLATFORM_MINGW: + from distutils import cygwinccompiler + + cygwin_versions = cygwinccompiler.get_versions() + if cygwin_versions[1] is None: + # ld version is None + # distutils cygwinccompiler might fetch the ld path from gcc + # Try the normal path instead + cygwin_versions = list(cygwin_versions) + cygwin_versions[1] = cygwinccompiler._find_exe_version("ld -v") + cygwinccompiler.get_versions = lambda: tuple(cygwin_versions) + def _dbg(s, tp=None): if DEBUG: diff --git a/winbuild/appveyor_install_msys2_deps.sh b/winbuild/appveyor_install_msys2_deps.sh index 7c1a2907de9..02b75e210e2 100644 --- a/winbuild/appveyor_install_msys2_deps.sh +++ b/winbuild/appveyor_install_msys2_deps.sh @@ -3,12 +3,16 @@ mkdir /var/cache/pacman/pkg pacman -S --noconfirm mingw32/mingw-w64-i686-python3-pip \ mingw32/mingw-w64-i686-python3-setuptools \ + mingw32/mingw-w64-i686-python3-pytest \ + mingw32/mingw-w64-i686-python3-pytest-cov \ mingw32/mingw-w64-i686-python2-pip \ mingw32/mingw-w64-i686-python2-setuptools \ + mingw32/mingw-w64-i686-python2-pytest \ + mingw32/mingw-w64-i686-python2-pytest-cov \ mingw-w64-i686-libjpeg-turbo \ mingw-w64-i686-libimagequant C:/msys64/mingw32/bin/python3 -m pip install --upgrade pip -/mingw32/bin/pip install pytest pytest-cov olefile -/mingw32/bin/pip3 install pytest pytest-cov olefile +/mingw32/bin/pip install olefile +/mingw32/bin/pip3 install olefile