Merge pull request #2675 from echoix/remove-attrdict3

Remove attrdict3 build dependency and use plain dict
This commit is contained in:
Scott Talbert
2025-01-21 21:25:47 -05:00
committed by GitHub
3 changed files with 8 additions and 11 deletions

View File

@@ -977,7 +977,7 @@ def getVisCVersion():
raise RuntimeError('getMSVCInfo has not been called yet.') raise RuntimeError('getMSVCInfo has not been called yet.')
# Convert a float like 14.28 to 140, for historical reasons # Convert a float like 14.28 to 140, for historical reasons
# TODO: decide on switching to 142, 143, etc.?? # TODO: decide on switching to 142, 143, etc.??
ver = str(int(MSVCinfo.vc_ver)) + '0' ver = str(int(MSVCinfo["vc_ver"])) + '0'
return ver return ver
@@ -990,7 +990,7 @@ def getExpectedVisCVersion():
""" """
if MSVCinfo is None: if MSVCinfo is None:
raise RuntimeError('getMSVCInfo has not been called yet.') raise RuntimeError('getMSVCInfo has not been called yet.')
py_ver = MSVCinfo.py_ver py_ver = MSVCinfo["py_ver"]
if py_ver in ((3, 5), (3, 6), (3, 7), (3, 8)): if py_ver in ((3, 5), (3, 6), (3, 7), (3, 8)):
min_ver = 14.0 min_ver = 14.0
elif py_ver in ((3, 9), (3, 10)): elif py_ver in ((3, 9), (3, 10)):
@@ -1009,8 +1009,6 @@ def getMSVCInfo(PYTHON, arch, set_env=False):
if MSVCinfo is not None: if MSVCinfo is not None:
return MSVCinfo return MSVCinfo
from attrdict import AttrDict
# Note that it starts with a monkey-patch in setuptools.msvc to # Note that it starts with a monkey-patch in setuptools.msvc to
# workaround this issue: pypa/setuptools#1902 # workaround this issue: pypa/setuptools#1902
cmd = \ cmd = \
@@ -1025,13 +1023,13 @@ def getMSVCInfo(PYTHON, arch, set_env=False):
"print(env)" "print(env)"
cmd = cmd.format(arch) cmd = cmd.format(arch)
env = eval(runcmd('"%s" -c "%s"' % (PYTHON, cmd), getOutput=True, echoCmd=False)) env = eval(runcmd('"%s" -c "%s"' % (PYTHON, cmd), getOutput=True, echoCmd=False))
info = AttrDict(env) info = dict(env)
if set_env: if set_env:
os.environ['PATH'] = info.path os.environ['PATH'] = info["path"]
os.environ['INCLUDE'] = info.include os.environ['INCLUDE'] = info["include"]
os.environ['LIB'] = info.lib os.environ['LIB'] = info["lib"]
os.environ['LIBPATH'] = info.libpath os.environ['LIBPATH'] = info["libpath"]
# We already have everything we need, tell distutils to not go hunting # We already have everything we need, tell distutils to not go hunting
# for it all again if it happens to be called. # for it all again if it happens to be called.

View File

@@ -27,5 +27,4 @@ Jinja2==2.10
markupsafe==1.1.1 markupsafe==1.1.1
doc2dash==2.3.0 doc2dash==2.3.0
beautifulsoup4 beautifulsoup4
attrdict3 ; sys_platform == 'win32'
typing-extensions; python_version < '3.10' typing-extensions; python_version < '3.10'

View File

@@ -75,7 +75,7 @@ def configure(conf):
# WAF uses the VisualStudio version to select the compiler, rather than # WAF uses the VisualStudio version to select the compiler, rather than
# the compiler version like we see elsewhere. Luckily we've got that # the compiler version like we see elsewhere. Luckily we've got that
# value in the MSVC info. # value in the MSVC info.
msvc_version = f"msvc {info.vs_ver}" msvc_version = f'msvc {info["vs_ver"]}'
conf.env['MSVC_VERSIONS'] = [msvc_version] conf.env['MSVC_VERSIONS'] = [msvc_version]
conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch] conf.env['MSVC_TARGETS'] = [conf.options.msvc_arch]