Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Jul 21, 2024
1 parent bb6e243 commit a124a81
Showing 1 changed file with 1 addition and 37 deletions.
38 changes: 1 addition & 37 deletions distutils/cygwinccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import warnings
from subprocess import check_output

from ._collections import RangeMap
from .errors import (
CCompilerError,
CompileError,
Expand All @@ -26,42 +25,9 @@
from .unixccompiler import UnixCCompiler
from .version import LooseVersion, suppress_known_deprecation

_msvcr_lookup = RangeMap.left(
{
# MSVC 7.0
1300: ['msvcr70'],
# MSVC 7.1
1310: ['msvcr71'],
# VS2005 / MSVC 8.0
1400: ['msvcr80'],
# VS2008 / MSVC 9.0
1500: ['msvcr90'],
# VS2010 / MSVC 10.0
1600: ['msvcr100'],
# VS2012 / MSVC 11.0
1700: ['msvcr110'],
# VS2013 / MSVC 12.0
1800: ['msvcr120'],
# VS2015 / MSVC 14.0
1900: ['vcruntime140'],
2000: RangeMap.undefined_value,
},
)


def get_msvcr():
"""Include the appropriate MSVC runtime library if Python was built
with MSVC 7.0 or later.
"""
match = re.search(r'MSC v\.(\d{4})', sys.version)
try:
msc_ver = int(match.group(1))
except AttributeError:
return []
try:
return _msvcr_lookup[msc_ver]
except KeyError:
raise ValueError(f"Unknown MS Compiler version {msc_ver} ")
return []


_runtime_library_dirs_msg = (
Expand Down Expand Up @@ -109,8 +75,6 @@ def __init__(self, verbose=False, dry_run=False, force=False):
linker_so=(f'{self.linker_dll} -mcygwin {shared_option}'),
)

# Include the appropriate MSVC runtime library if Python was built
# with MSVC 7.0 or later.
self.dll_libraries = get_msvcr()

@property
Expand Down

0 comments on commit a124a81

Please sign in to comment.