From bb6d557cdae8f18f57738033112bc302ebc1bd7c Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 25 Feb 2020 16:51:56 +0100 Subject: [PATCH 1/2] Add _dbg support for Windows, add more in-build testing (needs a new conda I fear due to using conda run there) --- recipe/bld.bat | 86 +- recipe/build.sh | 8 +- recipe/meta.yaml | 44 +- ...dd-CondaEcosystemModifyDllSearchPath.patch | 37 +- ...RC_DIR-to-make-pdbs-more-relocatable.patch | 39 + recipe/patches/0024-Doing-d1trimfile.patch | 877 ++++++++++++++++++ ...-debugging-with-Windows-debug-builds.patch | 24 + ...ttps-bugs.python.org-issue33895-http.patch | 68 ++ 8 files changed, 1132 insertions(+), 51 deletions(-) create mode 100644 recipe/patches/0023-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch create mode 100644 recipe/patches/0024-Doing-d1trimfile.patch create mode 100644 recipe/patches/0025-egg-debugging-with-Windows-debug-builds.patch create mode 100644 recipe/patches/0026-Revert-part-of-https-bugs.python.org-issue33895-http.patch diff --git a/recipe/bld.bat b/recipe/bld.bat index 5688a7f60..207de93e5 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -30,32 +30,66 @@ if "%PY_INTERP_DEBUG%" neq "" ( ) -if "%DEBUG_C%"=="yes" ( +if "%PY_INTERP_DEBUG%"=="yes" ( set PGO= ) else ( - set PGO=--pgo + if "%DEBUG_C%"=="yes" ( + set PGO= + ) else ( + set PGO=--pgo + ) ) -:: AP doesn't support PGO atm? -set PGO= - cd PCbuild +:: Doesn't avoid the SDK problem. +:: devenv /upgrade pcbuild.sln +:: set __VCVARS_VERSION=%WindowsSDKVer% +:: 14.16.27023 +:: echo ^ > my_props.props +:: echo ^ >> my_props.props +:: echo ^ >> my_props.props +:: echo ^v141^ >> my_props.props +:: echo ^ >> my_props.props +:: type my_props.props +:: call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% "/p:ForceImportBeforeCppTargets=%CD%\my_props.props" "/p:ForceImportAfterCppTargets=%CD%\my_props.props" + +:: Twice because I am changing zipimport ATM. +call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% call build.bat %PGO% %CONFIG% -m -e -v -p %PLATFORM% if errorlevel 1 exit 1 cd .. :: Populate the root package directory for %%x in (python38%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.exe venvlauncher%_D%.exe venvwlauncher%_D%.exe) do ( + echo Copying: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x to %PREFIX% copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% if errorlevel 1 exit 1 ) +:: If _d appears anywhere other than at the end of the filename then this will break. +if "%_D%"=="_d" ( + for %%x in (python38%_D%.dll python3%_D%.dll python%_D%.exe pythonw%_D%.exe venvlauncher%_D%.exe venvwlauncher%_D%.exe) do ( + set _TMP=%%x + call set _DST=%%_TMP:_D=%% + echo Copying: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x to !_DST! + copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%\!_DST! + if errorlevel 1 exit 1 + ) +) + for %%x in (python%_D%.pdb python38%_D%.pdb pythonw%_D%.pdb) do ( + echo Copying: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX% if errorlevel 1 exit 1 ) +for %%x in (*.pdb) do ( + echo Copying PDB: %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x to %PREFIX%\DLLs + copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\%%x %PREFIX%\DLLs + if errorlevel 1 exit 1 +) + copy %SRC_DIR%\LICENSE %PREFIX%\LICENSE_PYTHON.txt if errorlevel 1 exit 1 @@ -139,7 +173,14 @@ copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\libs\ if errorlevel 1 exit 1 - +if "%_D%"=="_d" ( + copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python38%_D%.lib %PREFIX%\libs\python38.lib + if errorlevel 1 exit 1 + copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%_D%.lib %PREFIX%\libs\python3.lib + if errorlevel 1 exit 1 + copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\libs\_tkinter.lib + if errorlevel 1 exit 1 +) :: Populate the Lib directory del %PREFIX%\libs\libpython*.a @@ -166,8 +207,9 @@ if errorlevel 1 exit 1 rd /s /q %PREFIX%\Lib\lib2to3\tests\ if errorlevel 1 exit 1 -:: We need our Python to be found! +:: We need our Python to be found if "%_D%" neq "" copy %PREFIX%\python%_D%.exe %PREFIX%\python.exe +if "%_D%" neq "" copy %PREFIX%\python%_D%.pdb %PREFIX%\python.pdb %PREFIX%\python.exe -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib if errorlevel 1 exit 1 @@ -175,21 +217,29 @@ if errorlevel 1 exit 1 :: Pickle lib2to3 Grammar %PREFIX%\python.exe -m lib2to3 --help -:: Some quick tests for common failures -echo "Testing print() does not print: Hello" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -c "print()" 2>&1 | findstr /r /c:"Hello" +echo CONDA_EXE is %CONDA_EXE% +echo where conda is +where conda +echo where python is +where python + +echo "Testing print() does not print Hello" +conda run -p %PREFIX% python -c "print()" 2>&1 | findstr /r /c:"Hello" if %errorlevel% neq 1 exit /b 1 -echo "Testing print('Hello') prints: Hello" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe "print('Hello')" 2>&1 | findstr /r /c:"Hello" +echo "Testing print('Hello') prints Hello" +conda run -p %PREFIX% python -c "print('Hello')" 2>&1 | findstr /r /c:"Hello" if %errorlevel% neq 0 exit /b 1 -echo "Testing import of os (no DLL needed) does not print: The specified module could not be found" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import os" 2>&1 -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found" +echo "Testing import of os does not print The specified module could not be found" +conda run -p %PREFIX% python -v -c "import os" 2>&1 +conda run -p %PREFIX% python -v -c "import os" 2>&1 | findstr /r /c:"The specified module could not be found" if %errorlevel% neq 1 exit /b 1 -echo "Testing import of _sqlite3 (DLL located via PATH needed) does not print: The specified module could not be found" -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 -%CONDA_EXE% run -p %PREFIX% cd %PREFIX% & %PREFIX%\python.exe -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found" +:: echo "Waiting for 60 seconds. Recommend you run procmon to figure out why the impeding import of _sqlite3 fails (on Win 32, python 3.7 building 3.8)" +:: waitfor SomethingThatIsNeverHappening /t 60 2>NUL + +echo "Testing import of _sqlite3 prints The specified module could not be found" +conda run -p %PREFIX% python -v -c "import _sqlite3" 2>&1 +conda run -p %PREFIX% python -v -c "import _sqlite3" 2>&1 | findstr /r /c:"The specified module could not be found" if %errorlevel% neq 1 exit /b 1 diff --git a/recipe/build.sh b/recipe/build.sh index 94de7c805..8a9cba79b 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -224,11 +224,13 @@ if [[ ${_OPTIMIZED} == yes ]]; then _MAKE_TARGET=profile-opt # To speed up build times during testing (1): if [[ ${QUICK_BUILD} == yes ]]; then - # TODO :: It seems this is just profiling everything, on Windows, only 40 odd tests are - # run while on Unix, all 400+ are run, making this slower and less well curated _PROFILE_TASK+=(PROFILE_TASK="-m test --pgo") else - _PROFILE_TASK+=(PROFILE_TASK="-m test --pgo-extended") + # TODO :: Run some benchmarks on these to see which is better. + # :: We decided to go with the faster-to-build option for now + # :: --pgo-extended runs 10 times as many tests as --pgo does. + # _PROFILE_TASK+=(PROFILE_TASK="-m test --pgo-extended") + _PROFILE_TASK+=(PROFILE_TASK="-m test --pgo") fi if [[ ${CC} =~ .*gcc.* ]]; then LTO_CFLAGS+=(-fuse-linker-plugin) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index c8aeea716..c0b65c96d 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,12 +1,12 @@ {% set base_version = "3.8.1" %} {% set version = base_version %} {% set linkage_nature = os.environ.get('PY_INTERP_LINKAGE_NATURE', '') %} -{% set debug = os.environ.get('PY_INTERP_DEBUG', '') %} {% if linkage_nature != '' %} {% set linkage_nature = "_" ~ linkage_nature %} {% endif %} +{% set debug = os.environ.get('PY_INTERP_DEBUG', '') %} {% if debug != '' %} - {% set debug = "_d" ~ debug %} + {% set debug = "_dbg" %} {% endif %} package: @@ -44,6 +44,8 @@ source: - patches/0021-roll-back-2e33ecd-for-py_compile.main.patch # Python 3.8 is pretty broken without this. - patches/0022-Add-CondaEcosystemModifyDllSearchPath.patch + - patches/0025-egg-debugging-with-Windows-debug-builds.patch + - patches/0026-Revert-part-of-https-bugs.python.org-issue33895-http.patch # TODO :: Depend on our own packages for these: - url: https://github.com/python/cpython-source-deps/archive/xz-5.2.2.zip # [win] @@ -78,7 +80,7 @@ source: build: - number: 3 + number: 8 # Windows has issues updating python if conda is using files itself. # Copy rather than link. no_link: @@ -99,10 +101,9 @@ build: # - lib/libpython3.dylib # [osx] # match python.org compiler standard skip: True # [win and int(float(vc)) < 14] -# Would like to be able to append to the calculated build string here, ping @msarahan, is this possible? - string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython + string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}_cpython{{ debug }} run_exports: - - python_abi 3.8.* cp38 + - python_abi 3.8.* cp38{{ debug }} script_env: - PY_INTERP_LINKAGE_NATURE - PY_INTERP_DEBUG @@ -123,12 +124,12 @@ requirements: - make # [not win] - pkg-config # [not win] # configure script looks for llvm-ar for lto +{% if 'conda-forge' in channel_targets %} - llvm-tools # [osx] +{% endif %} - patch # [not win] - m2-patch # [win] - - posix # [win] - - ld_impl_{{target_platform}} # [linux] - - binutils_impl_{{target_platform}} >=2.33.1 # [linux] + - m2-gcc-libs # [win] host: - bzip2 # [not win] - sqlite @@ -137,13 +138,21 @@ requirements: - openssl - readline # [not win] - tk # [not win] - - ncurses # [linux] + - ncurses # [not win] - libffi # [not win] +{% if 'conda-forge' not in channel_targets %} + - binutils_impl_{{target_platform}} # [linux and aarch64] + - ld_impl_{{target_platform}} # [linux and not aarch64] +{% else %} - ld_impl_{{target_platform}} # [linux] +{% endif %} run: +{% if 'conda-forge' not in channel_targets %} + - binutils_impl_{{target_platform}} # [linux and aarch64] + - ld_impl_{{target_platform}} # [linux and not aarch64] +{% else %} - ld_impl_{{target_platform}} # [linux] - run_constrained: - - python_abi 3.8.* cp38 +{% endif %} test: requires: @@ -178,15 +187,18 @@ test: - python -c "import foobar" - popd - pushd distutils.cext - - python setup.py install -v -v - - python -c "import greet; greet.greet('Python user')" | rg "Hello Python" + # --single-version-externally-managed because .egg files with compiled code do not work on Windows (Python 3.8) when Py_DEBUG (this should be investigated) + - python setup.py install -v -v # [(not win) or environ.get('PY_INTERP_DEBUG') == ''] + - python setup.py install --single-version-externally-managed --record=record.txt -v -v # [win and environ.get('PY_INTERP_DEBUG') != ''] + - python -v -v -v -c "import greet" + - python -v -v -v -c "import greet; greet.greet('Python user')" | rg "Hello Python" - popd - pushd prefix-replacement # [unix] - bash build-and-test.sh # [unix] - popd # [unix] - pushd cmake - - cmake -GNinja -DPY_VER={{ version }} - # --trace --debug-output --debug-trycompile . + - cmake -GNinja -DPY_VER={{ version }} . + # --trace --debug-output --debug-trycompile - popd - popd diff --git a/recipe/patches/0022-Add-CondaEcosystemModifyDllSearchPath.patch b/recipe/patches/0022-Add-CondaEcosystemModifyDllSearchPath.patch index 9eb73129c..65bd66ae4 100644 --- a/recipe/patches/0022-Add-CondaEcosystemModifyDllSearchPath.patch +++ b/recipe/patches/0022-Add-CondaEcosystemModifyDllSearchPath.patch @@ -1,7 +1,7 @@ -From 6c67f1126dc91ad94f735b20e2dda4bb7c54f472 Mon Sep 17 00:00:00 2001 +From bd510e850256e4711b3e7d9a2ba089f32d3a0eea Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 24 Dec 2019 18:37:17 +0100 -Subject: [PATCH 22/22] Add CondaEcosystemModifyDllSearchPath() +Subject: [PATCH 22/24] Add CondaEcosystemModifyDllSearchPath() This changes the DLL search order so that C:\Windows\System32 does not get searched in before entries in PATH. @@ -9,13 +9,15 @@ get searched in before entries in PATH. Reviewed by Kai Tietz 7.2.2019 Updated a bit to include other directories. + +Made fwprintfs breakpointable --- - Modules/main.c | 384 +++++++++++++++++++++++++++++++++++++++++++ + Modules/main.c | 391 +++++++++++++++++++++++++++++++++++++++++++ Python/dynload_win.c | 7 +- - 2 files changed, 389 insertions(+), 2 deletions(-) + 2 files changed, 396 insertions(+), 2 deletions(-) diff --git a/Modules/main.c b/Modules/main.c -index 0d2cf3ab82..a8cd6dd89a 100644 +index 0d2cf3ab82..fcf9811aaf 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -20,6 +20,10 @@ @@ -38,7 +40,7 @@ index 0d2cf3ab82..a8cd6dd89a 100644 /* --- pymain_init() ---------------------------------------------- */ static PyStatus -@@ -658,10 +664,388 @@ Py_RunMain(void) +@@ -658,10 +664,395 @@ Py_RunMain(void) return exitcode; } @@ -275,7 +277,8 @@ index 0d2cf3ab82..a8cd6dd89a 100644 + { + if (_wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_NEVER_CACHE") == NULL) + { -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: INFO :: Values unchanged\n"); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: INFO :: Values unchanged\n"); + return 0; + } + } @@ -295,7 +298,8 @@ index 0d2cf3ab82..a8cd6dd89a 100644 + { + size_t len = wcslen(path_env); + wchar_t *path = (wchar_t *)alloca((len + 1) * sizeof(wchar_t)); -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: PATH=%ls\n\b", path_env); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: PATH=%ls\n\b", path_env); + memcpy(path, path_env, (len + 1) * sizeof(wchar_t)); + /* Convert any / to \ */ + /* Replace slash with backslash */ @@ -364,7 +368,8 @@ index 0d2cf3ab82..a8cd6dd89a 100644 + } + } +#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls)\n", path_entries[i]); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls)\n", path_entries[i]); + pAddDllDirectory(path_entries[i]); + } + } @@ -374,10 +379,12 @@ index 0d2cf3ab82..a8cd6dd89a 100644 + { + for (j = NUM_CONDA_PATHS-1, p_conda_path = &condaPaths[NUM_CONDA_PATHS-1]; j > -1; --j, --p_conda_path) + { -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: p_conda_path->p_name = %ls, foundCondaPath[%zd] = %d\n", p_conda_path->p_name, j, foundCondaPath[j]); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: p_conda_path->p_name = %ls, foundCondaPath[%zd] = %d\n", p_conda_path->p_name, j, foundCondaPath[j]); + if (!foundCondaPath[j]) + { -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - ExePrefix)\n", p_conda_path->p_name); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - ExePrefix)\n", p_conda_path->p_name); + pAddDllDirectory(p_conda_path->p_name); + } + } @@ -391,14 +398,16 @@ index 0d2cf3ab82..a8cd6dd89a 100644 + free(sv_added_cwd); + } + sv_added_cwd = _wcsdup(p_cwd); -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - CWD)\n", sv_added_cwd); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - CWD)\n", sv_added_cwd); + pAddDllDirectory(sv_added_cwd); + } + + if (add_windows_directory) + { + sv_added_windows_directory = &sv_windows_directory[0]; -+ if (debug_it) fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - WinDir)\n", sv_windows_directory); ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - WinDir)\n", sv_windows_directory); + pAddDllDirectory(sv_windows_directory); + } + else @@ -448,5 +457,5 @@ index 6deba1134e..56d8913455 100644 #if HAVE_SXS _Py_DeactivateActCtx(cookie); -- -2.24.0 +2.25.0 diff --git a/recipe/patches/0023-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch b/recipe/patches/0023-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch new file mode 100644 index 000000000..ae96d924f --- /dev/null +++ b/recipe/patches/0023-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch @@ -0,0 +1,39 @@ +From 0e6bc62a07c22101e3a8e298c37e457fd339f111 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Tue, 31 Dec 2019 20:46:36 +0100 +Subject: [PATCH 23/25] Add /d1trimfile:%SRC_DIR% to make pdbs more relocatable + +--- + Lib/distutils/_msvccompiler.py | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py +index e8e4b717b9..d8ff37d8bd 100644 +--- a/Lib/distutils/_msvccompiler.py ++++ b/Lib/distutils/_msvccompiler.py +@@ -383,6 +383,13 @@ class MSVCCompiler(CCompiler) : + # without asking the user to browse for it + src = os.path.abspath(src) + ++ # Anaconda/conda-forge customisation, we want our pdbs to be ++ # relocatable: ++ # https://developercommunity.visualstudio.com/comments/623156/view.html ++ d1trimfile_opts = [] ++ if 'SRC_DIR' in os.environ: ++ d1trimfile_opts.append("/d1trimfile:" + os.environ['SRC_DIR']) ++ + if ext in self._c_extensions: + input_opt = "/Tc" + src + elif ext in self._cpp_extensions: +@@ -427,7 +434,7 @@ class MSVCCompiler(CCompiler) : + raise CompileError("Don't know how to compile {} to {}" + .format(src, obj)) + +- args = [self.cc] + compile_opts + pp_opts ++ args = [self.cc] + compile_opts + pp_opts + d1trimfile_opts + if add_cpp_opts: + args.append('/EHsc') + args.append(input_opt) +-- +2.25.0 + diff --git a/recipe/patches/0024-Doing-d1trimfile.patch b/recipe/patches/0024-Doing-d1trimfile.patch new file mode 100644 index 000000000..49cee4254 --- /dev/null +++ b/recipe/patches/0024-Doing-d1trimfile.patch @@ -0,0 +1,877 @@ +From 5066a5d5184cf92d66f9183996e5775fc40f7ac7 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Tue, 31 Dec 2019 21:47:47 +0100 +Subject: [PATCH 24/25] Doing d1trimfile + +--- + PC/bdist_wininst/bdist_wininst.vcxproj | 4 ++++ + PCbuild/_asyncio.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_bz2.vcxproj | 4 ++++ + PCbuild/_ctypes.vcxproj | 4 ++++ + PCbuild/_ctypes_test.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_decimal.vcxproj | 4 ++++ + PCbuild/_elementtree.vcxproj | 4 ++++ + PCbuild/_freeze_importlib.vcxproj | 4 ++++ + PCbuild/_hashlib.vcxproj | 12 ++++++++++++ + PCbuild/_lzma.vcxproj | 4 ++++ + PCbuild/_msi.vcxproj | 12 ++++++++++++ + PCbuild/_multiprocessing.vcxproj | 12 ++++++++++++ + PCbuild/_overlapped.vcxproj | 12 ++++++++++++ + PCbuild/_queue.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_socket.vcxproj | 12 ++++++++++++ + PCbuild/_sqlite3.vcxproj | 4 ++++ + PCbuild/_ssl.vcxproj | 12 ++++++++++++ + PCbuild/_testbuffer.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_testcapi.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_testconsole.vcxproj | 4 ++++ + PCbuild/_testembed.vcxproj | 4 ++++ + PCbuild/_testimportmultiple.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_testinternalcapi.vcxproj | 20 ++++++++++++++++++++ + PCbuild/_testmultiphase.vcxproj | 4 ++++ + PCbuild/_tkinter.vcxproj | 4 ++++ + PCbuild/liblzma.vcxproj | 4 ++++ + PCbuild/pyexpat.vcxproj | 4 ++++ + PCbuild/pylauncher.vcxproj | 4 ++++ + PCbuild/pyshellext.vcxproj | 4 ++++ + PCbuild/python.vcxproj | 4 ++++ + PCbuild/python3dll.vcxproj | 4 ++++ + PCbuild/python_uwp.vcxproj | 2 +- + PCbuild/pythoncore.vcxproj | 2 +- + PCbuild/pythonw.vcxproj | 12 ++++++++++++ + PCbuild/pythonw_uwp.vcxproj | 2 +- + PCbuild/pywlauncher.vcxproj | 4 ++++ + PCbuild/select.vcxproj | 12 ++++++++++++ + PCbuild/unicodedata.vcxproj | 20 ++++++++++++++++++++ + PCbuild/venvlauncher.vcxproj | 4 ++++ + PCbuild/venvwlauncher.vcxproj | 4 ++++ + PCbuild/winsound.vcxproj | 12 ++++++++++++ + PCbuild/xxlimited.vcxproj | 4 ++++ + 42 files changed, 359 insertions(+), 3 deletions(-) + +diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj b/PC/bdist_wininst/bdist_wininst.vcxproj +index d2f1bb75e3..d3f996cbbb 100644 +--- a/PC/bdist_wininst/bdist_wininst.vcxproj ++++ b/PC/bdist_wininst/bdist_wininst.vcxproj +@@ -91,6 +91,10 @@ + _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreadedDebug + MultiThreaded ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + $(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories) +diff --git a/PCbuild/_asyncio.vcxproj b/PCbuild/_asyncio.vcxproj +index ed1e1bc0a4..47d322be5f 100644 +--- a/PCbuild/_asyncio.vcxproj ++++ b/PCbuild/_asyncio.vcxproj +@@ -91,6 +91,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_bz2.vcxproj b/PCbuild/_bz2.vcxproj +index 3fe95fbf83..0402f7a9aa 100644 +--- a/PCbuild/_bz2.vcxproj ++++ b/PCbuild/_bz2.vcxproj +@@ -97,6 +97,10 @@ + $(bz2Dir);%(AdditionalIncludeDirectories) + WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + 4244;4267;%(DisableSpecificWarnings) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + +diff --git a/PCbuild/_ctypes.vcxproj b/PCbuild/_ctypes.vcxproj +index 69e4271a9b..f28002d190 100644 +--- a/PCbuild/_ctypes.vcxproj ++++ b/PCbuild/_ctypes.vcxproj +@@ -95,6 +95,10 @@ + + + FFI_BUILDING;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions) +diff --git a/PCbuild/_ctypes_test.vcxproj b/PCbuild/_ctypes_test.vcxproj +index 8a01e743a4..1ad658d5f9 100644 +--- a/PCbuild/_ctypes_test.vcxproj ++++ b/PCbuild/_ctypes_test.vcxproj +@@ -92,6 +92,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_decimal.vcxproj b/PCbuild/_decimal.vcxproj +index 465a7ade9a..356f4b30c1 100644 +--- a/PCbuild/_decimal.vcxproj ++++ b/PCbuild/_decimal.vcxproj +@@ -99,6 +99,10 @@ + CONFIG_64;ANSI;%(PreprocessorDefinitions) + CONFIG_64;%(PreprocessorDefinitions) + ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + +diff --git a/PCbuild/_elementtree.vcxproj b/PCbuild/_elementtree.vcxproj +index 4a125b243b..20cc09d63f 100644 +--- a/PCbuild/_elementtree.vcxproj ++++ b/PCbuild/_elementtree.vcxproj +@@ -95,6 +95,10 @@ + + ..\Modules\expat;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + +diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj +index a0fe49c464..50d634de77 100644 +--- a/PCbuild/_freeze_importlib.vcxproj ++++ b/PCbuild/_freeze_importlib.vcxproj +@@ -89,6 +89,10 @@ + + + _CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + Console +diff --git a/PCbuild/_hashlib.vcxproj b/PCbuild/_hashlib.vcxproj +index 6dad8183c5..6d3d37fdf9 100644 +--- a/PCbuild/_hashlib.vcxproj ++++ b/PCbuild/_hashlib.vcxproj +@@ -96,6 +96,18 @@ + + ws2_32.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj +index fe076a6fc5..0565132363 100644 +--- a/PCbuild/_lzma.vcxproj ++++ b/PCbuild/_lzma.vcxproj +@@ -95,6 +95,10 @@ + + $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories) + WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies) +diff --git a/PCbuild/_msi.vcxproj b/PCbuild/_msi.vcxproj +index 720eb2931b..247ab0e915 100644 +--- a/PCbuild/_msi.vcxproj ++++ b/PCbuild/_msi.vcxproj +@@ -96,6 +96,18 @@ + + cabinet.lib;msi.lib;rpcrt4.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_multiprocessing.vcxproj b/PCbuild/_multiprocessing.vcxproj +index 77b6bfc8e1..3c2b651549 100644 +--- a/PCbuild/_multiprocessing.vcxproj ++++ b/PCbuild/_multiprocessing.vcxproj +@@ -95,6 +95,18 @@ + + ws2_32.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_overlapped.vcxproj b/PCbuild/_overlapped.vcxproj +index 9e60d3b5db..95b57290f8 100644 +--- a/PCbuild/_overlapped.vcxproj ++++ b/PCbuild/_overlapped.vcxproj +@@ -95,6 +95,18 @@ + + ws2_32.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_queue.vcxproj b/PCbuild/_queue.vcxproj +index 8065b23585..e46ab5a83b 100644 +--- a/PCbuild/_queue.vcxproj ++++ b/PCbuild/_queue.vcxproj +@@ -91,6 +91,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_socket.vcxproj b/PCbuild/_socket.vcxproj +index 8fd75f90e7..b403828291 100644 +--- a/PCbuild/_socket.vcxproj ++++ b/PCbuild/_socket.vcxproj +@@ -95,6 +95,18 @@ + + ws2_32.lib;iphlpapi.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj +index 3e7b2262e8..fe5f680e5b 100644 +--- a/PCbuild/_sqlite3.vcxproj ++++ b/PCbuild/_sqlite3.vcxproj +@@ -95,6 +95,10 @@ + + $(sqlite3Dir)\include;%(AdditionalIncludeDirectories) + MODULE_NAME="sqlite3";%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + $(sqlite3Dir)\lib\sqlite3.lib;%(AdditionalDependencies) +diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj +index b2c23d5e8c..ebe4e88848 100644 +--- a/PCbuild/_ssl.vcxproj ++++ b/PCbuild/_ssl.vcxproj +@@ -96,6 +96,18 @@ + + ws2_32.lib;crypt32.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/_testbuffer.vcxproj b/PCbuild/_testbuffer.vcxproj +index 917d7ae50f..8c7e141eea 100644 +--- a/PCbuild/_testbuffer.vcxproj ++++ b/PCbuild/_testbuffer.vcxproj +@@ -92,6 +92,26 @@ + + <_ProjectFileVersion>10.0.40219.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_testcapi.vcxproj b/PCbuild/_testcapi.vcxproj +index c1a1943725..99ee2f4a41 100644 +--- a/PCbuild/_testcapi.vcxproj ++++ b/PCbuild/_testcapi.vcxproj +@@ -92,6 +92,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_testconsole.vcxproj b/PCbuild/_testconsole.vcxproj +index 5d7e14eff1..695dcb3b91 100644 +--- a/PCbuild/_testconsole.vcxproj ++++ b/PCbuild/_testconsole.vcxproj +@@ -92,6 +92,10 @@ + + + _CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + Console +diff --git a/PCbuild/_testembed.vcxproj b/PCbuild/_testembed.vcxproj +index a7ea8787e0..eab72171e3 100644 +--- a/PCbuild/_testembed.vcxproj ++++ b/PCbuild/_testembed.vcxproj +@@ -89,6 +89,10 @@ + + + _CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + Console +diff --git a/PCbuild/_testimportmultiple.vcxproj b/PCbuild/_testimportmultiple.vcxproj +index 6d80d5779f..951bf40e7c 100644 +--- a/PCbuild/_testimportmultiple.vcxproj ++++ b/PCbuild/_testimportmultiple.vcxproj +@@ -92,6 +92,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_testinternalcapi.vcxproj b/PCbuild/_testinternalcapi.vcxproj +index 6c5b12cd40..d25c774913 100644 +--- a/PCbuild/_testinternalcapi.vcxproj ++++ b/PCbuild/_testinternalcapi.vcxproj +@@ -92,6 +92,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/_testmultiphase.vcxproj b/PCbuild/_testmultiphase.vcxproj +index 430eb528cc..7a268d227b 100644 +--- a/PCbuild/_testmultiphase.vcxproj ++++ b/PCbuild/_testmultiphase.vcxproj +@@ -92,6 +92,10 @@ + + + _CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + Console +diff --git a/PCbuild/_tkinter.vcxproj b/PCbuild/_tkinter.vcxproj +index af813b77c1..9ff2acde0a 100644 +--- a/PCbuild/_tkinter.vcxproj ++++ b/PCbuild/_tkinter.vcxproj +@@ -96,6 +96,10 @@ + $(tcltkDir)include;%(AdditionalIncludeDirectories) + WITH_APPINIT;%(PreprocessorDefinitions) + Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + $(tcltkLib);%(AdditionalDependencies) +diff --git a/PCbuild/liblzma.vcxproj b/PCbuild/liblzma.vcxproj +index 9ec062e525..50f11a1b15 100644 +--- a/PCbuild/liblzma.vcxproj ++++ b/PCbuild/liblzma.vcxproj +@@ -97,6 +97,10 @@ + Disabled + $(lzmaDir)windows;$(lzmaDir)src/liblzma/common;$(lzmaDir)src/common;$(lzmaDir)src/liblzma/api;$(lzmaDir)src/liblzma/check;$(lzmaDir)src/liblzma/delta;$(lzmaDir)src/liblzma/lz;$(lzmaDir)src/liblzma/lzma;$(lzmaDir)src/liblzma/rangecoder;$(lzmaDir)src/liblzma/simple + 4028;4113;4133;4244;4267;4996;%(DisableSpecificWarnings) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + +diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj +index b2d9f5d57d..26ac82980c 100644 +--- a/PCbuild/pyexpat.vcxproj ++++ b/PCbuild/pyexpat.vcxproj +@@ -92,6 +92,10 @@ + + $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + +diff --git a/PCbuild/pylauncher.vcxproj b/PCbuild/pylauncher.vcxproj +index 550e084230..0ea871bddb 100644 +--- a/PCbuild/pylauncher.vcxproj ++++ b/PCbuild/pylauncher.vcxproj +@@ -93,6 +93,10 @@ + + _CONSOLE;%(PreprocessorDefinitions) + MultiThreaded ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + version.lib;%(AdditionalDependencies) +diff --git a/PCbuild/pyshellext.vcxproj b/PCbuild/pyshellext.vcxproj +index 655054e372..53820b57ad 100644 +--- a/PCbuild/pyshellext.vcxproj ++++ b/PCbuild/pyshellext.vcxproj +@@ -92,6 +92,10 @@ + + + _CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + version.lib;shlwapi.lib;%(AdditionalDependencies) +diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj +index ffb2673018..617b52f568 100644 +--- a/PCbuild/python.vcxproj ++++ b/PCbuild/python.vcxproj +@@ -91,6 +91,10 @@ + + + Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions) ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + Console +diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj +index ef344bed49..cf9b5380fd 100644 +--- a/PCbuild/python3dll.vcxproj ++++ b/PCbuild/python3dll.vcxproj +@@ -97,6 +97,10 @@ + + + false ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + $(OutDir)$(TargetName)stub.lib +diff --git a/PCbuild/python_uwp.vcxproj b/PCbuild/python_uwp.vcxproj +index 5ff120a0da..78168a99fc 100644 +--- a/PCbuild/python_uwp.vcxproj ++++ b/PCbuild/python_uwp.vcxproj +@@ -90,7 +90,7 @@ + + + %(PreprocessorDefinitions) +- /EHsc /std:c++17 %(AdditionalOptions) ++ /d1trimfile:%SRC_DIR% + + + windowsapp.lib;%(AdditionalDependencies) +diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj +index 13c3b594e4..ae9f60775d 100644 +--- a/PCbuild/pythoncore.vcxproj ++++ b/PCbuild/pythoncore.vcxproj +@@ -99,7 +99,7 @@ + + + +- /Zm200 %(AdditionalOptions) ++ /d1trimfile:%SRC_DIR% + $(PySourcePath)Python;%(AdditionalIncludeDirectories) + $(zlibDir);%(AdditionalIncludeDirectories) + _USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions) +diff --git a/PCbuild/pythonw.vcxproj b/PCbuild/pythonw.vcxproj +index ab572d2020..1115e75445 100644 +--- a/PCbuild/pythonw.vcxproj ++++ b/PCbuild/pythonw.vcxproj +@@ -91,6 +91,18 @@ + + 2000000 + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/pythonw_uwp.vcxproj b/PCbuild/pythonw_uwp.vcxproj +index 828d0d1cca..9c3a121407 100644 +--- a/PCbuild/pythonw_uwp.vcxproj ++++ b/PCbuild/pythonw_uwp.vcxproj +@@ -90,7 +90,7 @@ + + + PYTHONW;%(PreprocessorDefinitions) +- /EHsc /std:c++17 %(AdditionalOptions) ++ /d1trimfile:%SRC_DIR% + + + windowsapp.lib;%(AdditionalDependencies) +diff --git a/PCbuild/pywlauncher.vcxproj b/PCbuild/pywlauncher.vcxproj +index 44e3fc2927..1105c99807 100644 +--- a/PCbuild/pywlauncher.vcxproj ++++ b/PCbuild/pywlauncher.vcxproj +@@ -93,6 +93,10 @@ + + _WINDOWS;%(PreprocessorDefinitions) + MultiThreaded ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + version.lib;%(AdditionalDependencies) +diff --git a/PCbuild/select.vcxproj b/PCbuild/select.vcxproj +index 750a713949..1da66eaddc 100644 +--- a/PCbuild/select.vcxproj ++++ b/PCbuild/select.vcxproj +@@ -94,6 +94,18 @@ + + ws2_32.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/unicodedata.vcxproj b/PCbuild/unicodedata.vcxproj +index addef75335..1a13f363e2 100644 +--- a/PCbuild/unicodedata.vcxproj ++++ b/PCbuild/unicodedata.vcxproj +@@ -91,6 +91,26 @@ + + <_ProjectFileVersion>10.0.30319.1 + ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ + + + +diff --git a/PCbuild/venvlauncher.vcxproj b/PCbuild/venvlauncher.vcxproj +index 123e84ec4e..6272f9f69d 100644 +--- a/PCbuild/venvlauncher.vcxproj ++++ b/PCbuild/venvlauncher.vcxproj +@@ -93,6 +93,10 @@ + + _CONSOLE;VENV_REDIRECT;%(PreprocessorDefinitions) + MultiThreaded ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + PY_ICON;%(PreprocessorDefinitions) +diff --git a/PCbuild/venvwlauncher.vcxproj b/PCbuild/venvwlauncher.vcxproj +index b8504d5d08..60d6308713 100644 +--- a/PCbuild/venvwlauncher.vcxproj ++++ b/PCbuild/venvwlauncher.vcxproj +@@ -93,6 +93,10 @@ + + _WINDOWS;VENV_REDIRECT;%(PreprocessorDefinitions) + MultiThreaded ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + PYW_ICON;%(PreprocessorDefinitions) +diff --git a/PCbuild/winsound.vcxproj b/PCbuild/winsound.vcxproj +index 32cedc9b44..c9abee1d69 100644 +--- a/PCbuild/winsound.vcxproj ++++ b/PCbuild/winsound.vcxproj +@@ -96,6 +96,18 @@ + + winmm.lib;%(AdditionalDependencies) + ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ ++ ++ /d1trimfile:%SRC_DIR% ++ + + + +diff --git a/PCbuild/xxlimited.vcxproj b/PCbuild/xxlimited.vcxproj +index 776335a15c..6e9e556e81 100644 +--- a/PCbuild/xxlimited.vcxproj ++++ b/PCbuild/xxlimited.vcxproj +@@ -95,6 +95,10 @@ + + + %(PreprocessorDefinitions);Py_LIMITED_API=0x03060000 ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% ++ /d1trimfile:%SRC_DIR% + + + wsock32.lib;%(AdditionalDependencies) +-- +2.25.0 + diff --git a/recipe/patches/0025-egg-debugging-with-Windows-debug-builds.patch b/recipe/patches/0025-egg-debugging-with-Windows-debug-builds.patch new file mode 100644 index 000000000..facab0e2a --- /dev/null +++ b/recipe/patches/0025-egg-debugging-with-Windows-debug-builds.patch @@ -0,0 +1,24 @@ +From 3e17a8cc711e6733431c611f37975271ed1e4b36 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Wed, 12 Feb 2020 21:35:50 +0100 +Subject: [PATCH 25/25] egg debugging with Windows debug builds + +--- + Lib/zipimport.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Lib/zipimport.py b/Lib/zipimport.py +index fd917c16b0..89e7aed241 100644 +--- a/Lib/zipimport.py ++++ b/Lib/zipimport.py +@@ -463,6 +463,7 @@ def _read_directory(archive): + path = _bootstrap_external._path_join(archive, name) + t = (path, compress, data_size, file_size, file_offset, time, date, crc) + files[name] = t ++ _bootstrap._verbose_message('zipimport: name : {}', name) + count += 1 + _bootstrap._verbose_message('zipimport: found {} names in {!r}', count, archive) + return files +-- +2.25.0 + diff --git a/recipe/patches/0026-Revert-part-of-https-bugs.python.org-issue33895-http.patch b/recipe/patches/0026-Revert-part-of-https-bugs.python.org-issue33895-http.patch new file mode 100644 index 000000000..b6cab970d --- /dev/null +++ b/recipe/patches/0026-Revert-part-of-https-bugs.python.org-issue33895-http.patch @@ -0,0 +1,68 @@ +From 958ffa4d80d0f8bf0444f028e82bf842e87123c0 Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Tue, 18 Feb 2020 17:38:32 +0100 +Subject: [PATCH 26/26] Revert part of https://bugs.python.org/issue33895 + https://github.com/python/cpython/commit/4860f01ac0f07cdc8fc0cc27c33f5a64e5cfec9f + +LIEF crashes because Python code gets called from its static initialization code (CreateModule2 gets called, more?) + +So we disable some of this commit and add a new env. var CONDA_DLL_SEARCH_MODIFICATION_DROP_GIL_AS_PER_UPSTREAM +to revert to upstream's decision here. + +There really isn't any way to get the ProcAddress without allowing static initialization to happen and +for LIEF, that calls back into Python. It is unclear why this isn't a problem for other extension modules. +This could be an issue with LIEF too, of course. + +Pinging @tonyroberts, @romainthomas and @zooba for your thoughts. + +This issue has been a bit of a nightmare for me. In the process I did make great strides making our CPython +more debuggable which should pay off in future. +--- + Python/dynload_win.c | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/Python/dynload_win.c b/Python/dynload_win.c +index 56d8913455..dd5b200861 100644 +--- a/Python/dynload_win.c ++++ b/Python/dynload_win.c +@@ -190,6 +190,11 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, + #if HAVE_SXS + ULONG_PTR cookie = 0; + #endif ++ /* The fix in https://bugs.python.org/issue33895 breaks 'import lief'. The fix means that any static initialization ++ cannot call into Python (or if it does it needs to aquire the GIL itself. ++ Other worse ideas: ++ DONT_RESOLVE_DLL_REFERENCES :: https://devblogs.microsoft.com/oldnewthing/20050214-00/?p=36463 */ ++ int drop_gil = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_DROP_GIL_AS_PER_UPSTREAM") ? 1 : 0; + + /* Don't display a message box when Python can't load a DLL */ + old_mode = SetErrorMode(SEM_FAILCRITICALERRORS); +@@ -202,13 +207,21 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, + AddDllDirectory function. We add SEARCH_DLL_LOAD_DIR to + ensure DLLs adjacent to the PYD are preferred. */ + /* This resyncs values in PATH to AddDllDirectory() */ ++ ++ + extern int CondaEcosystemModifyDllSearchPath(int, int); + CondaEcosystemModifyDllSearchPath(1, 1); + +- Py_BEGIN_ALLOW_THREADS +- hDLL = LoadLibraryExW(wpathname, NULL, +- LOAD_WITH_ALTERED_SEARCH_PATH); +- Py_END_ALLOW_THREADS ++ if (drop_gil) { ++ Py_BEGIN_ALLOW_THREADS ++ hDLL = LoadLibraryExW(wpathname, NULL, ++ LOAD_WITH_ALTERED_SEARCH_PATH); ++ Py_END_ALLOW_THREADS ++ } else { ++ hDLL = LoadLibraryExW(wpathname, NULL, ++ LOAD_WITH_ALTERED_SEARCH_PATH); ++ } ++ + #if HAVE_SXS + _Py_DeactivateActCtx(cookie); + #endif +-- +2.25.0 + From c5f8aca512297d4460767bfa2dfa30aea79bb858 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 25 Feb 2020 20:12:11 +0100 Subject: [PATCH 2/2] Fix python_abi for _dbg package, skip PGO once again .. since AP does not support it for some reason (I had hoped it would work by magic by now, oh well) --- recipe/bld.bat | 3 +++ recipe/meta.yaml | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/recipe/bld.bat b/recipe/bld.bat index 207de93e5..a73530260 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -37,6 +37,9 @@ if "%PY_INTERP_DEBUG%"=="yes" ( set PGO= ) else ( set PGO=--pgo + :: On AzurePipelines, PGO fails with: + :: LINK : fatal error LNK1104: cannot open file 'pgort.lib' [%SRC_DIR%\PCbuild\pythoncore.vcxproj] + set PGO= ) ) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index c0b65c96d..4f070709c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -7,6 +7,9 @@ {% set debug = os.environ.get('PY_INTERP_DEBUG', '') %} {% if debug != '' %} {% set debug = "_dbg" %} + {% set debugabi = "d" %} +{% else %} + {% set debugabi = "" %} {% endif %} package: @@ -103,7 +106,11 @@ build: skip: True # [win and int(float(vc)) < 14] string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}_cpython{{ debug }} run_exports: - - python_abi 3.8.* cp38{{ debug }} + # debugabi is only used on Windows because the ABI is the same now on Unix. On Windows this is still not + # the case yet unfortunately (when _DEBUG is defined, CreateModule2 is redefined to have another name to + # indicate it also does ref counting). + - python_abi 3.8.* cp38{{ debugabi }} # [win] + - python_abi 3.8.* cp38 # [noy win] script_env: - PY_INTERP_LINKAGE_NATURE - PY_INTERP_DEBUG