diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-10-15 07:52:57 +0000 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-10-15 07:52:57 +0000 |
commit | 7f377f5755750fca165acb8660c5f1646359dabb (patch) | |
tree | 8ba2e2e50d8ce3536e4e6eaeb4d8d49641aacaa2 | |
parent | 5662209157d0ef10725c59570cb480022c6591dc (diff) | |
parent | 999e4cdc21392912b4b999a5fa1770e462008dc5 (diff) | |
download | gobject-introspection-7f377f5755750fca165acb8660c5f1646359dabb.tar.gz |
Merge branch 'monkey_patch_distutils_get_msvcr' into 'master'
monkey patch distutils.cygwinccompiler.get_msvcr
See merge request GNOME/gobject-introspection!246
-rw-r--r-- | giscanner/utils.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py index e3396c6e..d9938fc7 100644 --- a/giscanner/utils.py +++ b/giscanner/utils.py @@ -23,6 +23,7 @@ import os import subprocess import platform import shutil +import sys import time import giscanner.pkgconfig @@ -318,3 +319,32 @@ class dll_dirs(): added_dll_dir.close() if self._cached_dll_dirs is not None: self._cached_dll_dirs.clear() + + +# monkey patch distutils.cygwinccompiler +# somehow distutils returns runtime library only up to +# VS2010 / MSVC 10.0 (msc_ver 1600) +def get_msvcr_overwrite(): + try: + return orig_get_msvcr() + except ValueError: + pass + + msc_pos = sys.version.find('MSC v.') + if msc_pos != -1: + msc_ver = sys.version[msc_pos + 6:msc_pos + 10] + + if msc_ver == '1700': + # VS2012 + return ['msvcr110'] + elif msc_ver == '1800': + # VS2013 + return ['msvcr120'] + elif msc_ver >= '1900': + # VS2015 + return ['vcruntime140'] + + +import distutils.cygwinccompiler +orig_get_msvcr = distutils.cygwinccompiler.get_msvcr +distutils.cygwinccompiler.get_msvcr = get_msvcr_overwrite |