From: Steve Dower Date: Thu, 18 Jan 2018 22:09:49 +0000 (+1100) Subject: [3.6] bpo-32588 Move _distutils_findvs into its own module (GH-5227) (#5228) X-Git-Tag: v3.6.5rc1~149 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ccf7f05c5d3fdea89d857e775d2c6371f3e15b4a;p=python [3.6] bpo-32588 Move _distutils_findvs into its own module (GH-5227) (#5228) --- diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py index ef1356b97d..c9d3c6c671 100644 --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -56,7 +56,7 @@ def _find_vc2015(): return best_version, best_dir def _find_vc2017(): - import _findvs + import _distutils_findvs import threading best_version = 0, # tuple for full version comparisons @@ -66,7 +66,7 @@ def _find_vc2017(): # initialize COM. all_packages = [] def _getall(): - all_packages.extend(_findvs.findall()) + all_packages.extend(_distutils_findvs.findall()) t = threading.Thread(target=_getall) t.start() t.join() diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index 83f0073265..0871a4f7d6 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -337,11 +337,10 @@ class bdist_wininst(Command): # cross-building, so assume the latest version bv = '14.0' else: - bv = '.'.join(CRT_ASSEMBLY_VERSION.split('.', 2)[:2]) - if bv in ('14.11', '14.12'): - # v142, v141 and v140 are binary compatible, - # so keep using the 14.0 stub. - bv = '14.0' + # as far as we know, CRT is binary compatible based on + # the first field, so assume 'x.0' until proven otherwise + major = CRT_ASSEMBLY_VERSION.partition('.')[0] + bv = major + '.0' # wininst-x.y.exe is in the same directory as this file diff --git a/Misc/NEWS.d/next/Windows/2018-01-18-14-56-45.bpo-32588.vHww6F.rst b/Misc/NEWS.d/next/Windows/2018-01-18-14-56-45.bpo-32588.vHww6F.rst new file mode 100644 index 0000000000..18e717a425 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2018-01-18-14-56-45.bpo-32588.vHww6F.rst @@ -0,0 +1 @@ +Create standalone _distutils_findvs module. diff --git a/PC/_findvs.cpp b/PC/_findvs.cpp index dd7c1fcb72..ecc68e82e4 100644 --- a/PC/_findvs.cpp +++ b/PC/_findvs.cpp @@ -12,10 +12,6 @@ #include #include #include "external\include\Setup.Configuration.h" -#pragma comment(lib, "ole32.lib") -#pragma comment(lib, "oleaut32.lib") -#pragma comment(lib, "version.lib") -#pragma comment(lib, "Microsoft.VisualStudio.Setup.Configuration.Native.lib") #include @@ -236,7 +232,7 @@ static int exec_findvs(PyObject *module) return 0; // success } -PyDoc_STRVAR(findvs_doc, "The _findvs helper module"); +PyDoc_STRVAR(findvs_doc, "The _distutils_findvs helper module"); static PyModuleDef_Slot findvs_slots[] = { { Py_mod_exec, exec_findvs }, @@ -245,7 +241,7 @@ static PyModuleDef_Slot findvs_slots[] = { static PyModuleDef findvs_def = { PyModuleDef_HEAD_INIT, - "_findvs", + "_distutils_findvs", findvs_doc, 0, // m_size NULL, // m_methods @@ -256,8 +252,8 @@ static PyModuleDef findvs_def = { }; extern "C" { - PyMODINIT_FUNC PyInit__findvs(void) + PyMODINIT_FUNC PyInit__distutils_findvs(void) { return PyModuleDef_Init(&findvs_def); } -} \ No newline at end of file +} diff --git a/PC/config.c b/PC/config.c index f631d73268..bab9100413 100644 --- a/PC/config.c +++ b/PC/config.c @@ -69,7 +69,6 @@ extern PyObject* _PyWarnings_Init(void); extern PyObject* PyInit__string(void); extern PyObject* PyInit__stat(void); extern PyObject* PyInit__opcode(void); -extern PyObject* PyInit__findvs(void); /* tools/freeze/makeconfig.py marker for additional "extern" */ /* -- ADDMODULE MARKER 1 -- */ @@ -166,8 +165,6 @@ struct _inittab _PyImport_Inittab[] = { {"_stat", PyInit__stat}, {"_opcode", PyInit__opcode}, - {"_findvs", PyInit__findvs}, - /* Sentinel */ {0, 0} }; diff --git a/PCbuild/_distutils_findvs.vcxproj b/PCbuild/_distutils_findvs.vcxproj new file mode 100644 index 0000000000..3db1280ac8 --- /dev/null +++ b/PCbuild/_distutils_findvs.vcxproj @@ -0,0 +1,83 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + PGInstrument + Win32 + + + PGInstrument + x64 + + + PGUpdate + Win32 + + + PGUpdate + x64 + + + Release + Win32 + + + Release + x64 + + + + {41ADEDF9-11D8-474E-B4D7-BB82332C878E} + _distutils_findvs + Win32Proj + + + + + DynamicLibrary + NotSet + + + + .pyd + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + version.lib;ole32.lib;oleaut32.lib;Microsoft.VisualStudio.Setup.Configuration.Native.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName) + + + + + + + + + + + {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} + false + + + + + + diff --git a/PCbuild/_distutils_findvs.vcxproj.filters b/PCbuild/_distutils_findvs.vcxproj.filters new file mode 100644 index 0000000000..f48d74fd69 --- /dev/null +++ b/PCbuild/_distutils_findvs.vcxproj.filters @@ -0,0 +1,16 @@ + + + + + + + + {c56a5dd3-7838-48e9-a781-855d8be7370f} + + + + + Source Files + + + \ No newline at end of file diff --git a/PCbuild/pcbuild.proj b/PCbuild/pcbuild.proj index c6b8487c0a..f7890969c8 100644 --- a/PCbuild/pcbuild.proj +++ b/PCbuild/pcbuild.proj @@ -49,7 +49,7 @@ - + diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln index 736a599703..94a0089f46 100644 --- a/PCbuild/pcbuild.sln +++ b/PCbuild/pcbuild.sln @@ -98,6 +98,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_asyncio", "_asyncio.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblzma", "liblzma.vcxproj", "{12728250-16EC-4DC6-94D7-E21DD88947F8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_distutils_findvs", "_distutils_findvs.vcxproj", "{41ADEDF9-11D8-474E-B4D7-BB82332C878E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -762,8 +764,27 @@ Global {12728250-16EC-4DC6-94D7-E21DD88947F8}.Release|Win32.Build.0 = Release|Win32 {12728250-16EC-4DC6-94D7-E21DD88947F8}.Release|x64.ActiveCfg = Release|x64 {12728250-16EC-4DC6-94D7-E21DD88947F8}.Release|x64.Build.0 = Release|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Debug|Win32.ActiveCfg = Debug|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Debug|Win32.Build.0 = Debug|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Debug|x64.ActiveCfg = Debug|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Debug|x64.Build.0 = Debug|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGInstrument|Win32.Build.0 = PGInstrument|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGInstrument|x64.ActiveCfg = PGInstrument|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGInstrument|x64.Build.0 = PGInstrument|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGUpdate|Win32.Build.0 = PGUpdate|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGUpdate|x64.ActiveCfg = PGUpdate|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.PGUpdate|x64.Build.0 = PGUpdate|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Release|Win32.ActiveCfg = Release|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Release|Win32.Build.0 = Release|Win32 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Release|x64.ActiveCfg = Release|x64 + {41ADEDF9-11D8-474E-B4D7-BB82332C878E}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E8690CFE-326A-430E-82D4-B4CE667CC1BA} + EndGlobalSection EndGlobal diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 0f01852587..cdba3cc0d3 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -71,7 +71,6 @@ version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies) - %(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName) 0x1e000000 @@ -350,7 +349,6 @@ - diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs index a83f544db6..6f19006df7 100644 --- a/Tools/msi/lib/lib_files.wxs +++ b/Tools/msi/lib/lib_files.wxs @@ -1,6 +1,6 @@  - +