diff --git a/.ci_support/linux_64_openssl1.1.1.yaml b/.ci_support/linux_64_openssl1.1.1.yaml index b386615ac..0de656751 100644 --- a/.ci_support/linux_64_openssl1.1.1.yaml +++ b/.ci_support/linux_64_openssl1.1.1.yaml @@ -45,7 +45,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/linux_64_openssl3.yaml b/.ci_support/linux_64_openssl3.yaml index 7af84d3d0..181f33b81 100644 --- a/.ci_support/linux_64_openssl3.yaml +++ b/.ci_support/linux_64_openssl3.yaml @@ -45,7 +45,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/linux_aarch64_openssl1.1.1.yaml b/.ci_support/linux_aarch64_openssl1.1.1.yaml index 171b2ec77..51779afc5 100644 --- a/.ci_support/linux_aarch64_openssl1.1.1.yaml +++ b/.ci_support/linux_aarch64_openssl1.1.1.yaml @@ -49,7 +49,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/linux_aarch64_openssl3.yaml b/.ci_support/linux_aarch64_openssl3.yaml index 000143489..53e3b515c 100644 --- a/.ci_support/linux_aarch64_openssl3.yaml +++ b/.ci_support/linux_aarch64_openssl3.yaml @@ -49,7 +49,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/linux_ppc64le_openssl1.1.1.yaml b/.ci_support/linux_ppc64le_openssl1.1.1.yaml index eaa4c0348..c63c1ce62 100644 --- a/.ci_support/linux_ppc64le_openssl1.1.1.yaml +++ b/.ci_support/linux_ppc64le_openssl1.1.1.yaml @@ -43,7 +43,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/linux_ppc64le_openssl3.yaml b/.ci_support/linux_ppc64le_openssl3.yaml index e9b1c05ae..4650156c2 100644 --- a/.ci_support/linux_ppc64le_openssl3.yaml +++ b/.ci_support/linux_ppc64le_openssl3.yaml @@ -43,7 +43,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/osx_64_openssl1.1.1.yaml b/.ci_support/osx_64_openssl1.1.1.yaml index e6ed76863..bfb796d36 100644 --- a/.ci_support/osx_64_openssl1.1.1.yaml +++ b/.ci_support/osx_64_openssl1.1.1.yaml @@ -7,7 +7,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '13' +- '14' channel_sources: - conda-forge channel_targets: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '13' +- '14' libffi: - '3.4' macos_machine: @@ -43,7 +43,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/osx_64_openssl3.yaml b/.ci_support/osx_64_openssl3.yaml index bf42f05d1..cd767ce39 100644 --- a/.ci_support/osx_64_openssl3.yaml +++ b/.ci_support/osx_64_openssl3.yaml @@ -7,7 +7,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '13' +- '14' channel_sources: - conda-forge channel_targets: @@ -15,7 +15,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '13' +- '14' libffi: - '3.4' macos_machine: @@ -43,7 +43,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/osx_arm64_openssl1.1.1.yaml b/.ci_support/osx_arm64_openssl1.1.1.yaml index 858cef425..2f40f85eb 100644 --- a/.ci_support/osx_arm64_openssl1.1.1.yaml +++ b/.ci_support/osx_arm64_openssl1.1.1.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '13' +- '14' channel_sources: - conda-forge channel_targets: @@ -13,7 +13,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '13' +- '14' libffi: - '3.4' macos_machine: @@ -41,7 +41,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/osx_arm64_openssl3.yaml b/.ci_support/osx_arm64_openssl3.yaml index 849733501..7e6939bd0 100644 --- a/.ci_support/osx_arm64_openssl3.yaml +++ b/.ci_support/osx_arm64_openssl3.yaml @@ -5,7 +5,7 @@ bzip2: c_compiler: - clang c_compiler_version: -- '13' +- '14' channel_sources: - conda-forge channel_targets: @@ -13,7 +13,7 @@ channel_targets: cxx_compiler: - clangxx cxx_compiler_version: -- '13' +- '14' libffi: - '3.4' macos_machine: @@ -41,7 +41,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' readline: - '8' sqlite: diff --git a/.ci_support/win_64_openssl1.1.1.yaml b/.ci_support/win_64_openssl1.1.1.yaml index 36a83ca0f..bac103486 100644 --- a/.ci_support/win_64_openssl1.1.1.yaml +++ b/.ci_support/win_64_openssl1.1.1.yaml @@ -29,7 +29,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' sqlite: - '3' target_platform: diff --git a/.ci_support/win_64_openssl3.yaml b/.ci_support/win_64_openssl3.yaml index 14b82dcae..12fd79358 100644 --- a/.ci_support/win_64_openssl3.yaml +++ b/.ci_support/win_64_openssl3.yaml @@ -29,7 +29,7 @@ pin_run_as_build: zlib: max_pin: x.x python: -- '3.10' +- '3.11' sqlite: - '3' target_platform: diff --git a/recipe/build_base.bat b/recipe/build_base.bat index 12b0a08e1..59b894c27 100644 --- a/recipe/build_base.bat +++ b/recipe/build_base.bat @@ -25,8 +25,6 @@ for /F "tokens=1,2 delims=." %%i in ("%PKG_VERSION%") do ( if NOT "%PY_VER%"=="%%i.%%j" exit 1 ) -set "OPENSSL_DIR=%LIBRARY_PREFIX%" -set "SQLITE3_DIR=%LIBRARY_PREFIX%" for /f "usebackq delims=" %%i in (`conda list -p %PREFIX% sqlite --no-show-channel-urls --json ^| findstr "version"`) do set SQLITE3_VERSION_LINE=%%i for /f "tokens=2 delims==/ " %%i IN ('echo %SQLITE3_VERSION_LINE%') do (set SQLITE3_VERSION=%%~i) echo SQLITE3_VERSION detected as %SQLITE3_VERSION% @@ -95,17 +93,11 @@ xcopy /s /y /i %SRC_DIR%\Tools\demo %PREFIX%\Tools\demo if errorlevel 1 exit 1 xcopy /s /y /i %SRC_DIR%\Tools\i18n %PREFIX%\Tools\i18n if errorlevel 1 exit 1 -xcopy /s /y /i %SRC_DIR%\Tools\pynche %PREFIX%\Tools\pynche -if errorlevel 1 exit 1 xcopy /s /y /i %SRC_DIR%\Tools\scripts %PREFIX%\Tools\scripts if errorlevel 1 exit 1 del %PREFIX%\Tools\demo\README if errorlevel 1 exit 1 -del %PREFIX%\Tools\pynche\README -if errorlevel 1 exit 1 -del %PREFIX%\Tools\pynche\pynche -if errorlevel 1 exit 1 del %PREFIX%\Tools\scripts\README if errorlevel 1 exit 1 del %PREFIX%\Tools\scripts\dutree.doc diff --git a/recipe/build_base.sh b/recipe/build_base.sh index ed421bdba..7d53affa1 100644 --- a/recipe/build_base.sh +++ b/recipe/build_base.sh @@ -130,6 +130,8 @@ fi export CPPFLAGS CFLAGS CXXFLAGS LDFLAGS +declare -a _common_configure_args + if [[ ${target_platform} == osx-* ]]; then sed -i -e "s/@OSX_ARCH@/$ARCH/g" Lib/distutils/unixccompiler.py fi @@ -174,6 +176,7 @@ if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]]; then export CONFIG_SITE=${PWD}/config.site # This is needed for libffi: export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig + _common_configure_args+=(--with-build-python=${BUILD_PYTHON_PREFIX}/bin/python) fi # This causes setup.py to query the sysroot directories from the compiler, something which @@ -235,7 +238,6 @@ if [[ ${CC} =~ .*-arm.* ]]; then TEST_EXCLUDES+=(test_compiler) fi -declare -a _common_configure_args _common_configure_args+=(--prefix=${PREFIX}) _common_configure_args+=(--build=${BUILD}) _common_configure_args+=(--host=${HOST}) @@ -391,7 +393,7 @@ fi ln -s ${PREFIX}/bin/python${VER} ${PREFIX}/bin/python ln -s ${PREFIX}/bin/pydoc${VER} ${PREFIX}/bin/pydoc # Workaround for https://github.com/conda/conda/issues/10969 -ln -s ${PREFIX}/bin/python3.10 ${PREFIX}/bin/python3.1 +ln -s ${PREFIX}/bin/python3.11 ${PREFIX}/bin/python3.1 # Remove test data to save space # Though keep `support` as some things use that. @@ -513,4 +515,4 @@ fi # Workaround for old conda versions which fail to install noarch packages for Python 3.10+ # https://github.com/conda/conda/issues/10969 -ln -s "${PREFIX}/lib/python3.10" "${PREFIX}/lib/python3.1" +ln -s "${PREFIX}/lib/python3.11" "${PREFIX}/lib/python3.1" diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index d418477dd..9a00325a5 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,14 +1,8 @@ python: - - 3.10 + - 3.11 python_impl: - cpython numpy: - 1.16 -c_compiler: # [win] - - vs2017 # [win] -cxx_compiler: # [win] - - vs2017 # [win] -vc: # [win] - - 14.1 # [win] MACOSX_SDK_VERSION: # [osx and x86_64] - 11.0 # [osx and x86_64] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index aa9365803..e3e285f6a 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "3.10.6" %} +{% set version = "3.11.0" %} {% set dev = "" %} {% set dev_ = "" %} {% set ver2 = '.'.join(version.split('.')[0:2]) %} @@ -47,41 +47,40 @@ source: {% else %} - url: https://www.python.org/ftp/python/{{ version }}/Python-{{ version }}{{ dev }}.tar.xz # md5 from: https://www.python.org/downloads/release/python-{{ ver3nd }}/ - md5: afc7e14f7118d10d1ba95ae8e2134bf0 + md5: fe92acfa0db9b9f5044958edb451d463 {% endif %} patches: - patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch - patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch - - patches/0003-Support-cross-compiling-byte-code.patch # https://github.com/python/cpython/pull/28501 - - patches/0004-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch + - patches/0003-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch # https://github.com/pypa/distutils/pull/54 - - patches/0005-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch - - patches/0006-Win32-Do-not-download-externals.patch - - patches/0007-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch + - patches/0004-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch + - patches/0005-Win32-Do-not-download-externals.patch + - patches/0006-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch # https://github.com/python/cpython/pull/28397 - - patches/0008-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch - - patches/0009-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch - - patches/0010-Unvendor-openssl.patch - - patches/0011-Unvendor-sqlite3.patch + - patches/0007-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch + - patches/0008-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch + - patches/0009-Unvendor-openssl.patch + - patches/0010-Unvendor-sqlite3.patch # https://github.com/pypa/distutils/pull/53 - - patches/0012-Use-ranlib-from-env-if-env-variable-is-set.patch - - patches/0013-Add-CondaEcosystemModifyDllSearchPath.patch - - patches/0014-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch - - patches/0015-Doing-d1trimfile.patch + - patches/0011-Use-ranlib-from-env-if-env-variable-is-set.patch + - patches/0012-Add-CondaEcosystemModifyDllSearchPath.patch + - patches/0013-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch + - patches/0014-Doing-d1trimfile.patch # https://github.com/python/cpython/pull/23523 - - patches/0016-cross-compile-darwin.patch - - patches/0017-Fix-TZPATH-on-windows.patch + - patches/0015-cross-compile-darwin.patch + - patches/0016-Fix-TZPATH-on-windows.patch # https://github.com/python/cpython/pull/24324 - - patches/0018-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch + - patches/0017-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch # https://github.com/pypa/distutils/pull/53 - - patches/0019-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch - - patches/0020-Unvendor-bzip2.patch - - patches/0021-Unvendor-libffi.patch - - patches/0022-Unvendor-tcltk.patch - - patches/0023-unvendor-xz.patch - - patches/0024-unvendor-zlib.patch - - patches/0025-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch + - patches/0018-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch + - patches/0019-Unvendor-bzip2.patch + - patches/0020-Unvendor-libffi.patch + - patches/0021-Unvendor-tcltk.patch + - patches/0022-unvendor-xz.patch + - patches/0023-unvendor-zlib.patch + - patches/0024-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch build: number: {{ build_number }} @@ -140,8 +139,6 @@ outputs: # Putting these here means they get emitted to build_env_setup.{sh,bat} meaning we can launch IDEs # after sourcing or calling that script without examine the contents of conda_build.{sh,bat} for # important env. vars. - - OPENSSL_DIR=%PREFIX%\Library # [win] - - SQLITE3_DIR=%PREFIX%\Library # [win] {% if 'conda-forge' in channel_targets %} - CONDA_FORGE=yes {% else %} @@ -190,8 +187,9 @@ outputs: test: downstreams: # Temporarily disable dowmstream tests on aarch64 as the solver causes timeouts on drone - - cython # [not aarch64] - - setuptools # [not aarch64] + # Fully disable while migrating as the automatic skip doesn't work + # - cython # [not aarch64] + # - setuptools # [not aarch64] requires: - ripgrep - cmake diff --git a/recipe/patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch b/recipe/patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch index edf6c13b1..db6ccbd43 100644 --- a/recipe/patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch +++ b/recipe/patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch @@ -1,7 +1,7 @@ -From a9cd933d936a603aa2326fe57a73d086609603c3 Mon Sep 17 00:00:00 2001 +From 79ed4c580d008ac554648f570209972a73c157f2 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Wed, 16 Aug 2017 11:53:55 +0100 -Subject: [PATCH 01/25] Win32: Change FD_SETSIZE from 512 to 2048 +Subject: [PATCH 01/24] Win32: Change FD_SETSIZE from 512 to 2048 https://github.com/ContinuumIO/anaconda-issues/issues/1241 --- @@ -9,10 +9,10 @@ https://github.com/ContinuumIO/anaconda-issues/issues/1241 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c -index 3afcb0e2a0..1ee953a6ae 100644 +index 4eea928a26..e3c5d82722 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c -@@ -33,7 +33,7 @@ +@@ -38,7 +38,7 @@ FD_SETSIZE higher before this; e.g., via compiler /D switch. */ #if defined(MS_WINDOWS) && !defined(FD_SETSIZE) @@ -22,5 +22,5 @@ index 3afcb0e2a0..1ee953a6ae 100644 #if defined(HAVE_POLL_H) -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch b/recipe/patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch index 2774692ef..eaee3170c 100644 --- a/recipe/patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch +++ b/recipe/patches/0002-Win32-distutils-Add-support-to-cygwinccompiler-for-V.patch @@ -1,7 +1,7 @@ -From f1b33ab8c49a4c2ed8cb6a3f6fa82a5fec275678 Mon Sep 17 00:00:00 2001 +From f775aaa47859e4e8047dcb98a67ef41b765a076a Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Wed, 16 Aug 2017 11:59:00 +0100 -Subject: [PATCH 02/25] Win32: distutils: Add support to cygwinccompiler for +Subject: [PATCH 02/24] Win32: distutils: Add support to cygwinccompiler for VS>=2015 Really this is for mingw-w64 though @@ -24,5 +24,5 @@ index 66c12dd358..e6c790118b 100644 raise ValueError("Unknown MS Compiler version %s " % msc_ver) -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0003-Support-cross-compiling-byte-code.patch b/recipe/patches/0003-Support-cross-compiling-byte-code.patch deleted file mode 100644 index 93bfe0760..000000000 --- a/recipe/patches/0003-Support-cross-compiling-byte-code.patch +++ /dev/null @@ -1,124 +0,0 @@ -From a56ab41cf6e7a3185f80d32547bedad63810a97f Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Wed, 16 Aug 2017 12:17:33 +0100 -Subject: [PATCH 03/25] Support cross-compiling byte-code - -https://bugs.python.org/issue22724 ---- - Makefile.pre.in | 13 +++++++------ - configure | 4 +++- - configure.ac | 4 +++- - 3 files changed, 13 insertions(+), 8 deletions(-) - -diff --git a/Makefile.pre.in b/Makefile.pre.in -index ee85f35b10..3fb65371c9 100644 ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -261,6 +261,7 @@ BUILDPYTHON= python$(BUILDEXE) - - PYTHON_FOR_REGEN?=@PYTHON_FOR_REGEN@ - UPDATE_FILE=$(PYTHON_FOR_REGEN) $(srcdir)/Tools/scripts/update_file.py -+PY_BUILD_ENVIRON=@PY_BUILD_ENVIRON@ - PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ - _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ - BUILD_GNU_TYPE= @build@ -@@ -589,7 +590,7 @@ $(BUILDPYTHON): Programs/python.o $(LIBRARY_DEPS) - $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) - - platform: $(BUILDPYTHON) pybuilddir.txt -- $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform -+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform - - # Create build directory and generate the sysconfig build-time data there. - # pybuilddir.txt contains the name of the build dir and is used for -@@ -600,7 +601,7 @@ platform: $(BUILDPYTHON) pybuilddir.txt - # or removed in case of failure. - pybuilddir.txt: $(BUILDPYTHON) - @echo "none" > ./pybuilddir.txt -- $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ -+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\ - if test $$? -ne 0 ; then \ - echo "generate-posix-vars failed" ; \ - rm -f ./pybuilddir.txt ; \ -@@ -631,7 +632,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o - $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \ - $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ - _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \ -- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build -+ $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build - - - # Build static library -@@ -1270,7 +1271,7 @@ install: @FRAMEWORKINSTALLFIRST@ commoninstall bininstall maninstall @FRAMEWORKI - upgrade) ensurepip="--upgrade" ;; \ - install|*) ensurepip="" ;; \ - esac; \ -- $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ -+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \ - $$ensurepip --root=$(DESTDIR)/ ; \ - fi - -@@ -1280,7 +1281,7 @@ altinstall: commoninstall - upgrade) ensurepip="--altinstall --upgrade" ;; \ - install|*) ensurepip="--altinstall" ;; \ - esac; \ -- $(RUNSHARED) $(PYTHON_FOR_BUILD) -m ensurepip \ -+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) -m ensurepip \ - $$ensurepip --root=$(DESTDIR)/ ; \ - fi - -@@ -1746,7 +1747,7 @@ libainstall: @DEF_MAKE_RULE@ python-config - # Install the dynamically loadable modules - # This goes into $(exec_prefix) - sharedinstall: sharedmods -- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ -+ $(RUNSHARED) $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \ - --prefix=$(prefix) \ - --install-scripts=$(BINDIR) \ - --install-platlib=$(DESTSHARED) \ -diff --git a/configure b/configure -index 19f1bd59ba..5075304e93 100755 ---- a/configure -+++ b/configure -@@ -760,6 +760,7 @@ CONFIG_ARGS - SOVERSION - VERSION - PYTHON_FOR_BUILD -+PY_BUILD_ENVIRON - PYTHON_FOR_REGEN - host_os - host_vendor -@@ -3019,7 +3020,8 @@ $as_echo_n "checking for python interpreter for cross build... " >&6; } - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5 - $as_echo "$interp" >&6; } -- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp -+ PY_BUILD_ENVIRON='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH)' -+ PYTHON_FOR_BUILD=$interp - fi - elif test "$cross_compiling" = maybe; then - as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5 -diff --git a/configure.ac b/configure.ac -index 763fc697be..4e026c2a0f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -82,13 +82,15 @@ if test "$cross_compiling" = yes; then - AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found]) - fi - AC_MSG_RESULT($interp) -- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) '$interp -+ PY_BUILD_ENVIRON='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH)' -+ PYTHON_FOR_BUILD=$interp - fi - elif test "$cross_compiling" = maybe; then - AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH]) - else - PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E' - fi -+AC_SUBST(PY_BUILD_ENVIRON) - AC_SUBST(PYTHON_FOR_BUILD) - - dnl Ensure that if prefix is specified, it does not end in a slash. If --- -2.32.1 (Apple Git-133) - diff --git a/recipe/patches/0004-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch b/recipe/patches/0003-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch similarity index 73% rename from recipe/patches/0004-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch rename to recipe/patches/0003-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch index b89e0db58..d2c6b0b12 100644 --- a/recipe/patches/0004-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch +++ b/recipe/patches/0003-bpo-45258-search-for-isysroot-in-addition-to-sysroot.patch @@ -1,7 +1,7 @@ -From 7701b45e89abdbf1980152441b239f717396813e Mon Sep 17 00:00:00 2001 +From 53a6d082fb1061af74311708100a88913153c808 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Tue, 21 Sep 2021 13:05:20 -0500 -Subject: [PATCH 04/25] bpo-45258: search for -isysroot in addition to +Subject: [PATCH 03/24] bpo-45258: search for -isysroot in addition to --sysroot -isysroot is for macOS, while --sysroot is for gcc/linux @@ -10,10 +10,10 @@ Subject: [PATCH 04/25] bpo-45258: search for -isysroot in addition to 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py -index e74a275edb..534b14104b 100644 +index 15d0d4576a..a15a7a46e0 100644 --- a/setup.py +++ b/setup.py -@@ -163,7 +163,7 @@ def sysroot_paths(make_vars, subdirs): +@@ -166,7 +166,7 @@ def sysroot_paths(make_vars, subdirs): for var_name in make_vars: var = sysconfig.get_config_var(var_name) if var is not None: @@ -23,5 +23,5 @@ index e74a275edb..534b14104b 100644 sysroot = m.group(1).strip('"') for subdir in subdirs: -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0005-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch b/recipe/patches/0004-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch similarity index 88% rename from recipe/patches/0005-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch rename to recipe/patches/0004-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch index ad8d216d9..652f94438 100644 --- a/recipe/patches/0005-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch +++ b/recipe/patches/0004-runtime_library_dir_option-Use-1st-word-of-CC-as-com.patch @@ -1,7 +1,7 @@ -From edf60960821da692372bef7afcdc6e1e23c3594e Mon Sep 17 00:00:00 2001 +From 81d65b9b739c1406919b62412b8318e63e898e02 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Thu, 5 Oct 2017 02:00:41 +0100 -Subject: [PATCH 05/25] runtime_library_dir_option: Use 1st word of CC as +Subject: [PATCH 04/24] runtime_library_dir_option: Use 1st word of CC as compiler Previous, 'CC' got passed to os.path.basename, so any paths in it after @@ -26,5 +26,5 @@ index d00c48981e..54dd556fe5 100644 # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0006-Win32-Do-not-download-externals.patch b/recipe/patches/0005-Win32-Do-not-download-externals.patch similarity index 82% rename from recipe/patches/0006-Win32-Do-not-download-externals.patch rename to recipe/patches/0005-Win32-Do-not-download-externals.patch index 9e8411524..62c244aa1 100644 --- a/recipe/patches/0006-Win32-Do-not-download-externals.patch +++ b/recipe/patches/0005-Win32-Do-not-download-externals.patch @@ -1,7 +1,7 @@ -From d9038a6a49c00958b6cc0663c28656d4016ec25a Mon Sep 17 00:00:00 2001 +From a5c0a0c323dd6b6082f85b4ba7f77218074a02f8 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Thu, 7 Sep 2017 11:35:47 +0100 -Subject: [PATCH 06/25] Win32: Do not download externals +Subject: [PATCH 05/24] Win32: Do not download externals --- PCbuild/build.bat | 2 +- @@ -21,5 +21,5 @@ index d333ceabd2..11e3d16a4f 100644 if "%do_pgo%" EQU "true" if "%platf%" EQU "x64" ( if "%PROCESSOR_ARCHITEW6432%" NEQ "AMD64" if "%PROCESSOR_ARCHITECTURE%" NEQ "AMD64" ( -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0007-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch b/recipe/patches/0006-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch similarity index 94% rename from recipe/patches/0007-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch rename to recipe/patches/0006-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch index 05d920f19..da33ba564 100644 --- a/recipe/patches/0007-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch +++ b/recipe/patches/0006-Fix-find_library-so-that-it-looks-in-sys.prefix-lib-.patch @@ -1,7 +1,7 @@ -From c94bc0d0943c40d929253967649806d9c4920a7e Mon Sep 17 00:00:00 2001 +From 913551a5eea896e3873d4374cbfb66ea4e2db45d Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 5 Dec 2017 22:47:59 +0000 -Subject: [PATCH 07/25] Fix find_library so that it looks in sys.prefix/lib +Subject: [PATCH 06/24] Fix find_library so that it looks in sys.prefix/lib first --- @@ -10,7 +10,7 @@ Subject: [PATCH 07/25] Fix find_library so that it looks in sys.prefix/lib 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Lib/ctypes/macholib/dyld.py b/Lib/ctypes/macholib/dyld.py -index 1c3f8fd38b..82a4b4fd58 100644 +index 583c47daff..ab9b01c87e 100644 --- a/Lib/ctypes/macholib/dyld.py +++ b/Lib/ctypes/macholib/dyld.py @@ -93,6 +93,10 @@ def dyld_executable_path_search(name, executable_path=None): @@ -72,5 +72,5 @@ index 0c2510e161..72b46cc481 100644 ################################################################ # test code -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0008-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch b/recipe/patches/0007-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch similarity index 87% rename from recipe/patches/0008-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch rename to recipe/patches/0007-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch index 9a2a42956..0d7b86ad4 100644 --- a/recipe/patches/0008-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch +++ b/recipe/patches/0007-bpo-22699-Allow-compiling-on-debian-ubuntu-with-a-di.patch @@ -1,7 +1,7 @@ -From 344f12bdb694314ca85da16a5b7d0d59d41d9b2f Mon Sep 17 00:00:00 2001 +From 2996846711c9bb12c3e35e75b7d0d6699057cbc5 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 16 Sep 2021 15:46:09 -0500 -Subject: [PATCH 08/25] bpo-22699: Allow compiling on debian/ubuntu with a +Subject: [PATCH 07/24] bpo-22699: Allow compiling on debian/ubuntu with a different compiler This PR fixes one issue mentioned in the bpo @@ -12,10 +12,10 @@ patch than given 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py -index 534b14104b..9c3dd04989 100644 +index a15a7a46e0..25fc167722 100644 --- a/setup.py +++ b/setup.py -@@ -667,9 +667,30 @@ def check_extension_import(self, ext): +@@ -687,9 +687,30 @@ def check_extension_import(self, ext): def add_multiarch_paths(self): # Debian/Ubuntu multiarch support. # https://wiki.ubuntu.com/MultiarchSpec @@ -48,5 +48,5 @@ index 534b14104b..9c3dd04989 100644 '%s -print-multiarch > %s 2> /dev/null' % (CC, tmpfile)) multiarch_path_component = '' -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0008-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch b/recipe/patches/0008-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch new file mode 100644 index 000000000..d230db0b7 --- /dev/null +++ b/recipe/patches/0008-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch @@ -0,0 +1,1201 @@ +From 8e033994de66ce822a007c44d833a27bb4818bfc Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Sat, 27 Oct 2018 18:48:30 +0100 +Subject: [PATCH 08/24] Disable registry lookup unless CONDA_PY_ALLOW_REG_PATHS + is not 0 + +Co-authored-by: Isuru Fernando +--- + Modules/getpath.c | 1 + + Modules/getpath.py | 3 +- + PC/getpathp.c | 1145 ++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 1148 insertions(+), 1 deletion(-) + create mode 100644 PC/getpathp.c + +diff --git a/Modules/getpath.c b/Modules/getpath.c +index 94479887cf..5ca10cb0f2 100644 +--- a/Modules/getpath.c ++++ b/Modules/getpath.c +@@ -894,6 +894,7 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config) + !env_to_dict(dict, "ENV_PATH", 0) || + !env_to_dict(dict, "ENV_PYTHONHOME", 0) || + !env_to_dict(dict, "ENV_PYTHONEXECUTABLE", 0) || ++ !env_to_dict(dict, "ENV_CONDA_PY_ALLOW_REG_PATHS", 0) || + !env_to_dict(dict, "ENV___PYVENV_LAUNCHER__", 1) || + !progname_to_dict(dict, "real_executable") || + !library_to_dict(dict, "library") || +diff --git a/Modules/getpath.py b/Modules/getpath.py +index dceeed7702..334455f7d6 100644 +--- a/Modules/getpath.py ++++ b/Modules/getpath.py +@@ -51,6 +51,7 @@ + # ENV_PYTHONHOME -- [in] getenv(...) + # ENV_PYTHONEXECUTABLE -- [in] getenv(...) + # ENV___PYVENV_LAUNCHER__ -- [in] getenv(...) ++# ENV_CONDA_PY_ALLOW_REG_PATHS -- [in] getenv(...) + + # ** Values calculated at runtime ** + # config -- [in/out] dict of the PyConfig structure +@@ -654,7 +655,7 @@ def search_up(prefix, *landmarks, test=isfile): + else: + pythonpath.append(joinpath(prefix, ZIP_LANDMARK)) + +- if os_name == 'nt' and use_environment and winreg: ++ if os_name == 'nt' and use_environment and winreg and ENV_CONDA_PY_ALLOW_REG_PATHS and ENV_CONDA_PY_ALLOW_REG_PATHS != '0': + # QUIRK: Windows also lists paths in the registry. Paths are stored + # as the default value of each subkey of + # {HKCU,HKLM}\Software\Python\PythonCore\{winver}\PythonPath +diff --git a/PC/getpathp.c b/PC/getpathp.c +new file mode 100644 +index 0000000000..a73ea8a0e9 +--- /dev/null ++++ b/PC/getpathp.c +@@ -0,0 +1,1145 @@ ++ ++/* Return the initial module search path. */ ++/* Used by DOS, Windows 3.1, Windows 95/98, Windows NT. */ ++ ++/* ---------------------------------------------------------------- ++ PATH RULES FOR WINDOWS: ++ This describes how sys.path is formed on Windows. It describes the ++ functionality, not the implementation (ie, the order in which these ++ are actually fetched is different). The presence of a python._pth or ++ pythonXY._pth file alongside the program overrides these rules - see ++ below. ++ ++ * Python always adds an empty entry at the start, which corresponds ++ to the current directory. ++ ++ * If the PYTHONPATH env. var. exists, its entries are added next. ++ ++ * We look in the registry for "application paths" - that is, sub-keys ++ under the main PythonPath registry key. These are added next (the ++ order of sub-key processing is undefined). ++ HKEY_CURRENT_USER is searched and added first. ++ HKEY_LOCAL_MACHINE is searched and added next. ++ (Note that all known installers only use HKLM, so HKCU is typically ++ empty) ++ ++ * We attempt to locate the "Python Home" - if the PYTHONHOME env var ++ is set, we believe it. Otherwise, we use the path of our host .EXE's ++ to try and locate one of our "landmarks" and deduce our home. ++ - If we DO have a Python Home: The relevant sub-directories (Lib, ++ DLLs, etc) are based on the Python Home ++ - If we DO NOT have a Python Home, the core Python Path is ++ loaded from the registry. (This is the main PythonPath key, ++ and both HKLM and HKCU are combined to form the path) ++ ++ * Iff - we can not locate the Python Home, have not had a PYTHONPATH ++ specified, and can't locate any Registry entries (ie, we have _nothing_ ++ we can assume is a good path), a default path with relative entries is ++ used (eg. .\Lib;.\DLLs, etc) ++ ++ ++ If a '._pth' file exists adjacent to the executable with the same base name ++ (e.g. python._pth adjacent to python.exe) or adjacent to the shared library ++ (e.g. python36._pth adjacent to python36.dll), it is used in preference to ++ the above process. The shared library file takes precedence over the ++ executable. The path file must contain a list of paths to add to sys.path, ++ one per line. Each path is relative to the directory containing the file. ++ Blank lines and comments beginning with '#' are permitted. ++ ++ In the presence of this ._pth file, no other paths are added to the search ++ path, the registry finder is not enabled, site.py is not imported and ++ isolated mode is enabled. The site package can be enabled by including a ++ line reading "import site"; no other imports are recognized. Any invalid ++ entry (other than directories that do not exist) will result in immediate ++ termination of the program. ++ ++ ++ The end result of all this is: ++ * When running python.exe, or any other .exe in the main Python directory ++ (either an installed version, or directly from the PCbuild directory), ++ the core path is deduced, and the core paths in the registry are ++ ignored. Other "application paths" in the registry are always read. ++ ++ * When Python is hosted in another exe (different directory, embedded via ++ COM, etc), the Python Home will not be deduced, so the core path from ++ the registry is used. Other "application paths" in the registry are ++ always read. ++ ++ * If Python can't find its home and there is no registry (eg, frozen ++ exe, some very strange installation setup) you get a path with ++ some default, but relative, paths. ++ ++ * An embedding application can use Py_SetPath() to override all of ++ these automatic path computations. ++ ++ * An install of Python can fully specify the contents of sys.path using ++ either a 'EXENAME._pth' or 'DLLNAME._pth' file, optionally including ++ "import site" to enable the site module. ++ ++ ---------------------------------------------------------------- */ ++ ++ ++#include "Python.h" ++#include "pycore_initconfig.h" // PyStatus ++#include "pycore_pathconfig.h" // _PyPathConfig ++#include "osdefs.h" // SEP, ALTSEP ++#include ++ ++#ifndef MS_WINDOWS ++#error getpathp.c should only be built on Windows ++#endif ++ ++#include ++#include ++ ++#ifdef HAVE_SYS_TYPES_H ++#include ++#endif /* HAVE_SYS_TYPES_H */ ++ ++#ifdef HAVE_SYS_STAT_H ++#include ++#endif /* HAVE_SYS_STAT_H */ ++ ++#include ++ ++/* Search in some common locations for the associated Python libraries. ++ * ++ * Py_GetPath() tries to return a sensible Python module search path. ++ * ++ * The approach is an adaptation for Windows of the strategy used in ++ * ../Modules/getpath.c; it uses the Windows Registry as one of its ++ * information sources. ++ * ++ * Py_SetPath() can be used to override this mechanism. Call Py_SetPath ++ * with a semicolon separated path prior to calling Py_Initialize. ++ */ ++ ++#ifndef LANDMARK ++# define LANDMARK L"lib\\os.py" ++#endif ++ ++#define INIT_ERR_BUFFER_OVERFLOW() _PyStatus_ERR("buffer overflow") ++ ++ ++typedef struct { ++ const wchar_t *path_env; /* PATH environment variable */ ++ const wchar_t *home; /* PYTHONHOME environment variable */ ++ ++ /* Registry key "Software\Python\PythonCore\X.Y\PythonPath" ++ where X.Y is the Python version (major.minor) */ ++ wchar_t *machine_path; /* from HKEY_LOCAL_MACHINE */ ++ wchar_t *user_path; /* from HKEY_CURRENT_USER */ ++ ++ const wchar_t *pythonpath_env; ++} PyCalculatePath; ++ ++ ++/* determine if "ch" is a separator character */ ++static int ++is_sep(wchar_t ch) ++{ ++#ifdef ALTSEP ++ return ch == SEP || ch == ALTSEP; ++#else ++ return ch == SEP; ++#endif ++} ++ ++ ++/* assumes 'dir' null terminated in bounds. Never writes ++ beyond existing terminator. */ ++static void ++reduce(wchar_t *dir) ++{ ++ size_t i = wcsnlen_s(dir, MAXPATHLEN+1); ++ if (i >= MAXPATHLEN+1) { ++ Py_FatalError("buffer overflow in getpathp.c's reduce()"); ++ } ++ ++ while (i > 0 && !is_sep(dir[i])) ++ --i; ++ dir[i] = '\0'; ++} ++ ++ ++static int ++change_ext(wchar_t *dest, const wchar_t *src, const wchar_t *ext) ++{ ++ if (src && src != dest) { ++ size_t src_len = wcsnlen_s(src, MAXPATHLEN+1); ++ size_t i = src_len; ++ if (i >= MAXPATHLEN+1) { ++ Py_FatalError("buffer overflow in getpathp.c's reduce()"); ++ } ++ ++ while (i > 0 && src[i] != '.' && !is_sep(src[i])) ++ --i; ++ ++ if (i == 0) { ++ dest[0] = '\0'; ++ return -1; ++ } ++ ++ if (is_sep(src[i])) { ++ i = src_len; ++ } ++ ++ if (wcsncpy_s(dest, MAXPATHLEN+1, src, i)) { ++ dest[0] = '\0'; ++ return -1; ++ } ++ } else { ++ wchar_t *s = wcsrchr(dest, L'.'); ++ if (s) { ++ s[0] = '\0'; ++ } ++ } ++ ++ if (wcscat_s(dest, MAXPATHLEN+1, ext)) { ++ dest[0] = '\0'; ++ return -1; ++ } ++ ++ return 0; ++} ++ ++ ++static int ++exists(const wchar_t *filename) ++{ ++ return GetFileAttributesW(filename) != 0xFFFFFFFF; ++} ++ ++ ++/* Is module -- check for .pyc too. ++ Assumes 'filename' MAXPATHLEN+1 bytes long - ++ may extend 'filename' by one character. */ ++static int ++ismodule(wchar_t *filename, int update_filename) ++{ ++ size_t n; ++ ++ if (exists(filename)) { ++ return 1; ++ } ++ ++ /* Check for the compiled version of prefix. */ ++ n = wcsnlen_s(filename, MAXPATHLEN+1); ++ if (n < MAXPATHLEN) { ++ int exist = 0; ++ filename[n] = L'c'; ++ filename[n + 1] = L'\0'; ++ exist = exists(filename); ++ if (!update_filename) { ++ filename[n] = L'\0'; ++ } ++ return exist; ++ } ++ return 0; ++} ++ ++ ++/* Add a path component, by appending stuff to buffer. ++ buffer must have at least MAXPATHLEN + 1 bytes allocated, and contain a ++ NUL-terminated string with no more than MAXPATHLEN characters (not counting ++ the trailing NUL). It's a fatal error if it contains a string longer than ++ that (callers must be careful!). If these requirements are met, it's ++ guaranteed that buffer will still be a NUL-terminated string with no more ++ than MAXPATHLEN characters at exit. If stuff is too long, only as much of ++ stuff as fits will be appended. ++*/ ++ ++static void ++join(wchar_t *buffer, const wchar_t *stuff) ++{ ++ if (FAILED(PathCchCombineEx(buffer, MAXPATHLEN+1, buffer, stuff, 0))) { ++ Py_FatalError("buffer overflow in getpathp.c's join()"); ++ } ++} ++ ++/* Call PathCchCanonicalizeEx(path): remove navigation elements such as "." ++ and ".." to produce a direct, well-formed path. */ ++static PyStatus ++canonicalize(wchar_t *buffer, const wchar_t *path) ++{ ++ if (buffer == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ ++ if (FAILED(PathCchCanonicalizeEx(buffer, MAXPATHLEN + 1, path, 0))) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ return _PyStatus_OK(); ++} ++ ++ ++/* gotlandmark only called by search_for_prefix, which ensures ++ 'prefix' is null terminated in bounds. join() ensures ++ 'landmark' can not overflow prefix if too long. */ ++static int ++gotlandmark(const wchar_t *prefix, const wchar_t *landmark) ++{ ++ wchar_t filename[MAXPATHLEN+1]; ++ memset(filename, 0, sizeof(filename)); ++ wcscpy_s(filename, Py_ARRAY_LENGTH(filename), prefix); ++ join(filename, landmark); ++ return ismodule(filename, FALSE); ++} ++ ++ ++/* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd. ++ assumption provided by only caller, calculate_path() */ ++static int ++search_for_prefix(wchar_t *prefix, const wchar_t *argv0_path, const wchar_t *landmark) ++{ ++ /* Search from argv0_path, until landmark is found */ ++ wcscpy_s(prefix, MAXPATHLEN + 1, argv0_path); ++ do { ++ if (gotlandmark(prefix, landmark)) { ++ return 1; ++ } ++ reduce(prefix); ++ } while (prefix[0]); ++ return 0; ++} ++ ++ ++static int ++get_dllpath(wchar_t *dllpath) ++{ ++#ifdef Py_ENABLE_SHARED ++ extern HANDLE PyWin_DLLhModule; ++ if (PyWin_DLLhModule && GetModuleFileNameW(PyWin_DLLhModule, dllpath, MAXPATHLEN)) { ++ return 0; ++ } ++#endif ++ return -1; ++} ++ ++ ++#ifdef Py_ENABLE_SHARED ++ ++/* a string loaded from the DLL at startup.*/ ++extern const char *PyWin_DLLVersionString; ++ ++/* Load a PYTHONPATH value from the registry. ++ Load from either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. ++ ++ Works in both Unicode and 8bit environments. Only uses the ++ Ex family of functions so it also works with Windows CE. ++ ++ Returns NULL, or a pointer that should be freed. ++ ++ XXX - this code is pretty strange, as it used to also ++ work on Win16, where the buffer sizes were not available ++ in advance. It could be simplied now Win16/Win32s is dead! ++*/ ++static wchar_t * ++getpythonregpath(HKEY keyBase, int skipcore) ++{ ++ HKEY newKey = 0; ++ DWORD dataSize = 0; ++ DWORD numKeys = 0; ++ LONG rc; ++ wchar_t *retval = NULL; ++ WCHAR *dataBuf = NULL; ++ static const WCHAR keyPrefix[] = L"Software\\Python\\PythonCore\\"; ++ static const WCHAR keySuffix[] = L"\\PythonPath"; ++ size_t versionLen, keyBufLen; ++ DWORD index; ++ WCHAR *keyBuf = NULL; ++ WCHAR *keyBufPtr; ++ WCHAR **ppPaths = NULL; ++ ++ /* Tried to use sysget("winver") but here is too early :-( */ ++ versionLen = strlen(PyWin_DLLVersionString); ++ /* Space for all the chars, plus one \0 */ ++ keyBufLen = sizeof(keyPrefix) + ++ sizeof(WCHAR)*(versionLen-1) + ++ sizeof(keySuffix); ++ keyBuf = keyBufPtr = PyMem_RawMalloc(keyBufLen); ++ if (keyBuf==NULL) { ++ goto done; ++ } ++ ++ memcpy_s(keyBufPtr, keyBufLen, keyPrefix, sizeof(keyPrefix)-sizeof(WCHAR)); ++ keyBufPtr += Py_ARRAY_LENGTH(keyPrefix) - 1; ++ mbstowcs(keyBufPtr, PyWin_DLLVersionString, versionLen); ++ keyBufPtr += versionLen; ++ /* NULL comes with this one! */ ++ memcpy(keyBufPtr, keySuffix, sizeof(keySuffix)); ++ /* Open the root Python key */ ++ rc=RegOpenKeyExW(keyBase, ++ keyBuf, /* subkey */ ++ 0, /* reserved */ ++ KEY_READ, ++ &newKey); ++ if (rc!=ERROR_SUCCESS) { ++ goto done; ++ } ++ /* Find out how big our core buffer is, and how many subkeys we have */ ++ rc = RegQueryInfoKeyW(newKey, NULL, NULL, NULL, &numKeys, NULL, NULL, ++ NULL, NULL, &dataSize, NULL, NULL); ++ if (rc!=ERROR_SUCCESS) { ++ goto done; ++ } ++ if (skipcore) { ++ dataSize = 0; /* Only count core ones if we want them! */ ++ } ++ /* Allocate a temp array of char buffers, so we only need to loop ++ reading the registry once ++ */ ++ ppPaths = PyMem_RawCalloc(numKeys, sizeof(WCHAR *)); ++ if (ppPaths==NULL) { ++ goto done; ++ } ++ /* Loop over all subkeys, allocating a temp sub-buffer. */ ++ for(index=0;index 0) { ++ *(szCur++) = L';'; ++ dataSize--; ++ } ++ if (ppPaths[index]) { ++ Py_ssize_t len = wcslen(ppPaths[index]); ++ wcsncpy(szCur, ppPaths[index], len); ++ szCur += len; ++ assert(dataSize > (DWORD)len); ++ dataSize -= (DWORD)len; ++ } ++ } ++ if (skipcore) { ++ *szCur = '\0'; ++ } ++ else { ++ /* If we have no values, we don't need a ';' */ ++ if (numKeys) { ++ *(szCur++) = L';'; ++ dataSize--; ++ } ++ /* Now append the core path entries - ++ this will include the NULL ++ */ ++ rc = RegQueryValueExW(newKey, NULL, 0, NULL, ++ (LPBYTE)szCur, &dataSize); ++ if (rc != ERROR_SUCCESS) { ++ PyMem_RawFree(dataBuf); ++ goto done; ++ } ++ } ++ /* And set the result - caller must free */ ++ retval = dataBuf; ++ } ++done: ++ /* Loop freeing my temp buffers */ ++ if (ppPaths) { ++ for(index=0; indexbase_executable == NULL) { ++ pathconfig->base_executable = PyMem_RawMalloc( ++ sizeof(wchar_t) * (MAXPATHLEN + 1)); ++ if (pathconfig->base_executable == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ ++ status = canonicalize(pathconfig->base_executable, ++ program_full_path); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ } ++ ++ wcscpy_s(program_full_path, MAXPATHLEN+1, pyvenv_launcher); ++ /* bpo-35873: Clear the environment variable to avoid it being ++ * inherited by child processes. */ ++ _wputenv_s(L"__PYVENV_LAUNCHER__", L""); ++ } ++ ++ if (pathconfig->program_full_path == NULL) { ++ pathconfig->program_full_path = PyMem_RawMalloc( ++ sizeof(wchar_t) * (MAXPATHLEN + 1)); ++ if (pathconfig->program_full_path == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ ++ status = canonicalize(pathconfig->program_full_path, ++ program_full_path); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ } ++ return _PyStatus_OK(); ++} ++ ++ ++static PyStatus ++read_pth_file(_PyPathConfig *pathconfig, wchar_t *prefix, const wchar_t *path, ++ int *found) ++{ ++ PyStatus status; ++ wchar_t *buf = NULL; ++ wchar_t *wline = NULL; ++ FILE *sp_file; ++ ++ sp_file = _Py_wfopen(path, L"r"); ++ if (sp_file == NULL) { ++ return _PyStatus_OK(); ++ } ++ ++ wcscpy_s(prefix, MAXPATHLEN+1, path); ++ reduce(prefix); ++ pathconfig->isolated = 1; ++ pathconfig->site_import = 0; ++ ++ size_t bufsiz = MAXPATHLEN; ++ size_t prefixlen = wcslen(prefix); ++ ++ buf = (wchar_t*)PyMem_RawMalloc(bufsiz * sizeof(wchar_t)); ++ if (buf == NULL) { ++ status = _PyStatus_NO_MEMORY(); ++ goto done; ++ } ++ buf[0] = '\0'; ++ ++ while (!feof(sp_file)) { ++ char line[MAXPATHLEN + 1]; ++ char *p = fgets(line, Py_ARRAY_LENGTH(line), sp_file); ++ if (!p) { ++ break; ++ } ++ if (*p == '\0' || *p == '\r' || *p == '\n' || *p == '#') { ++ continue; ++ } ++ while (*++p) { ++ if (*p == '\r' || *p == '\n') { ++ *p = '\0'; ++ break; ++ } ++ } ++ ++ if (strcmp(line, "import site") == 0) { ++ pathconfig->site_import = 1; ++ continue; ++ } ++ else if (strncmp(line, "import ", 7) == 0) { ++ status = _PyStatus_ERR("only 'import site' is supported " ++ "in ._pth file"); ++ goto done; ++ } ++ ++ DWORD wn = MultiByteToWideChar(CP_UTF8, 0, line, -1, NULL, 0); ++ wchar_t *wline = (wchar_t*)PyMem_RawMalloc((wn + 1) * sizeof(wchar_t)); ++ if (wline == NULL) { ++ status = _PyStatus_NO_MEMORY(); ++ goto done; ++ } ++ wn = MultiByteToWideChar(CP_UTF8, 0, line, -1, wline, wn + 1); ++ wline[wn] = '\0'; ++ ++ size_t usedsiz = wcslen(buf); ++ while (usedsiz + wn + prefixlen + 4 > bufsiz) { ++ bufsiz += MAXPATHLEN; ++ wchar_t *tmp = (wchar_t*)PyMem_RawRealloc(buf, (bufsiz + 1) * ++ sizeof(wchar_t)); ++ if (tmp == NULL) { ++ status = _PyStatus_NO_MEMORY(); ++ goto done; ++ } ++ buf = tmp; ++ } ++ ++ if (usedsiz) { ++ wcscat_s(buf, bufsiz, L";"); ++ usedsiz += 1; ++ } ++ ++ errno_t result; ++ _Py_BEGIN_SUPPRESS_IPH ++ result = wcscat_s(buf, bufsiz, prefix); ++ _Py_END_SUPPRESS_IPH ++ ++ if (result == EINVAL) { ++ status = _PyStatus_ERR("invalid argument during ._pth processing"); ++ goto done; ++ } else if (result == ERANGE) { ++ status = _PyStatus_ERR("buffer overflow during ._pth processing"); ++ goto done; ++ } ++ ++ wchar_t *b = &buf[usedsiz]; ++ join(b, wline); ++ ++ PyMem_RawFree(wline); ++ wline = NULL; ++ } ++ ++ if (pathconfig->module_search_path == NULL) { ++ pathconfig->module_search_path = _PyMem_RawWcsdup(buf); ++ if (pathconfig->module_search_path == NULL) { ++ status = _PyStatus_NO_MEMORY(); ++ goto done; ++ } ++ } ++ ++ *found = 1; ++ status = _PyStatus_OK(); ++ goto done; ++ ++done: ++ PyMem_RawFree(buf); ++ PyMem_RawFree(wline); ++ fclose(sp_file); ++ return status; ++} ++ ++ ++static int ++get_pth_filename(PyCalculatePath *calculate, wchar_t *filename, ++ const _PyPathConfig *pathconfig) ++{ ++ if (!get_dllpath(filename) && ++ !change_ext(filename, filename, L"._pth") && ++ exists(filename)) ++ { ++ return 1; ++ } ++ if (pathconfig->program_full_path[0] && ++ !change_ext(filename, pathconfig->program_full_path, L"._pth") && ++ exists(filename)) ++ { ++ return 1; ++ } ++ return 0; ++} ++ ++ ++static PyStatus ++calculate_pth_file(PyCalculatePath *calculate, _PyPathConfig *pathconfig, ++ wchar_t *prefix, int *found) ++{ ++ wchar_t filename[MAXPATHLEN+1]; ++ ++ if (!get_pth_filename(calculate, filename, pathconfig)) { ++ return _PyStatus_OK(); ++ } ++ ++ return read_pth_file(pathconfig, prefix, filename, found); ++} ++ ++ ++/* Search for an environment configuration file, first in the ++ executable's directory and then in the parent directory. ++ If found, open it for use when searching for prefixes. ++*/ ++static PyStatus ++calculate_pyvenv_file(PyCalculatePath *calculate, ++ wchar_t *argv0_path, size_t argv0_path_len) ++{ ++ wchar_t filename[MAXPATHLEN+1]; ++ const wchar_t *env_cfg = L"pyvenv.cfg"; ++ ++ /* Filename: / "pyvenv.cfg" */ ++ wcscpy_s(filename, MAXPATHLEN+1, argv0_path); ++ join(filename, env_cfg); ++ ++ FILE *env_file = _Py_wfopen(filename, L"r"); ++ if (env_file == NULL) { ++ errno = 0; ++ ++ /* Filename: / "pyvenv.cfg" */ ++ reduce(filename); ++ reduce(filename); ++ join(filename, env_cfg); ++ ++ env_file = _Py_wfopen(filename, L"r"); ++ if (env_file == NULL) { ++ errno = 0; ++ return _PyStatus_OK(); ++ } ++ } ++ ++ /* Look for a 'home' variable and set argv0_path to it, if found */ ++ wchar_t *home = NULL; ++ PyStatus status = _Py_FindEnvConfigValue(env_file, L"home", &home); ++ if (_PyStatus_EXCEPTION(status)) { ++ fclose(env_file); ++ return status; ++ } ++ if (home) { ++ wcscpy_s(argv0_path, argv0_path_len, home); ++ PyMem_RawFree(home); ++ } ++ fclose(env_file); ++ return _PyStatus_OK(); ++} ++ ++ ++static void ++calculate_home_prefix(PyCalculatePath *calculate, ++ const wchar_t *argv0_path, ++ const wchar_t *zip_path, ++ wchar_t *prefix) ++{ ++ if (calculate->home == NULL || *calculate->home == '\0') { ++ if (zip_path[0] && exists(zip_path)) { ++ wcscpy_s(prefix, MAXPATHLEN+1, zip_path); ++ reduce(prefix); ++ calculate->home = prefix; ++ } ++ else if (search_for_prefix(prefix, argv0_path, LANDMARK)) { ++ calculate->home = prefix; ++ } ++ else { ++ calculate->home = NULL; ++ } ++ } ++ else { ++ wcscpy_s(prefix, MAXPATHLEN+1, calculate->home); ++ } ++} ++ ++ ++static PyStatus ++calculate_module_search_path(PyCalculatePath *calculate, ++ _PyPathConfig *pathconfig, ++ const wchar_t *argv0_path, ++ wchar_t *prefix, ++ const wchar_t *zip_path) ++{ ++ int skiphome = calculate->home==NULL ? 0 : 1; ++ char * allow_registry_paths = getenv("CONDA_PY_ALLOW_REG_PATHS"); ++ if (!Py_IgnoreEnvironmentFlag && allow_registry_paths && allow_registry_paths[0] != '0') ++ { ++ calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome); ++ calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome); ++ } ++ else ++ { ++ calculate->machine_path = NULL; ++ calculate->user_path = NULL; ++ } ++ ++ /* We only use the default relative PYTHONPATH if we haven't ++ anything better to use! */ ++ int skipdefault = (calculate->pythonpath_env != NULL || ++ calculate->home != NULL || ++ calculate->machine_path != NULL || ++ calculate->user_path != NULL); ++ ++ /* We need to construct a path from the following parts. ++ (1) the PYTHONPATH environment variable, if set; ++ (2) for Win32, the zip archive file path; ++ (3) for Win32, the machine_path and user_path, if set; ++ (4) the PYTHONPATH config macro, with the leading "." ++ of each component replaced with home, if set; ++ (5) the directory containing the executable (argv0_path). ++ The length calculation calculates #4 first. ++ Extra rules: ++ - If PYTHONHOME is set (in any way) item (3) is ignored. ++ - If registry values are used, (4) and (5) are ignored. ++ */ ++ ++ /* Calculate size of return buffer */ ++ size_t bufsz = 0; ++ if (calculate->home != NULL) { ++ const wchar_t *p; ++ bufsz = 1; ++ for (p = PYTHONPATH; *p; p++) { ++ if (*p == DELIM) { ++ bufsz++; /* number of DELIM plus one */ ++ } ++ } ++ bufsz *= wcslen(calculate->home); ++ } ++ bufsz += wcslen(PYTHONPATH) + 1; ++ bufsz += wcslen(argv0_path) + 1; ++ if (calculate->user_path) { ++ bufsz += wcslen(calculate->user_path) + 1; ++ } ++ if (calculate->machine_path) { ++ bufsz += wcslen(calculate->machine_path) + 1; ++ } ++ bufsz += wcslen(zip_path) + 1; ++ if (calculate->pythonpath_env != NULL) { ++ bufsz += wcslen(calculate->pythonpath_env) + 1; ++ } ++ ++ wchar_t *buf, *start_buf; ++ buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t)); ++ if (buf == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ start_buf = buf; ++ ++ if (calculate->pythonpath_env) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), ++ calculate->pythonpath_env)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ if (zip_path[0]) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), zip_path)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ if (calculate->user_path) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), calculate->user_path)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ if (calculate->machine_path) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), calculate->machine_path)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ if (calculate->home == NULL) { ++ if (!skipdefault) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), PYTHONPATH)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ } else { ++ const wchar_t *p = PYTHONPATH; ++ const wchar_t *q; ++ size_t n; ++ for (;;) { ++ q = wcschr(p, DELIM); ++ if (q == NULL) { ++ n = wcslen(p); ++ } ++ else { ++ n = q-p; ++ } ++ if (p[0] == '.' && is_sep(p[1])) { ++ if (wcscpy_s(buf, bufsz - (buf - start_buf), calculate->home)) { ++ return INIT_ERR_BUFFER_OVERFLOW(); ++ } ++ buf = wcschr(buf, L'\0'); ++ p++; ++ n--; ++ } ++ wcsncpy(buf, p, n); ++ buf += n; ++ *buf++ = DELIM; ++ if (q == NULL) { ++ break; ++ } ++ p = q+1; ++ } ++ } ++ if (argv0_path) { ++ wcscpy(buf, argv0_path); ++ buf = wcschr(buf, L'\0'); ++ *buf++ = DELIM; ++ } ++ *(buf - 1) = L'\0'; ++ ++ /* Now to pull one last hack/trick. If sys.prefix is ++ empty, then try and find it somewhere on the paths ++ we calculated. We scan backwards, as our general policy ++ is that Python core directories are at the *end* of ++ sys.path. We assume that our "lib" directory is ++ on the path, and that our 'prefix' directory is ++ the parent of that. ++ */ ++ if (prefix[0] == L'\0') { ++ wchar_t lookBuf[MAXPATHLEN+1]; ++ const wchar_t *look = buf - 1; /* 'buf' is at the end of the buffer */ ++ while (1) { ++ Py_ssize_t nchars; ++ const wchar_t *lookEnd = look; ++ /* 'look' will end up one character before the ++ start of the path in question - even if this ++ is one character before the start of the buffer ++ */ ++ while (look >= start_buf && *look != DELIM) ++ look--; ++ nchars = lookEnd-look; ++ wcsncpy(lookBuf, look+1, nchars); ++ lookBuf[nchars] = L'\0'; ++ /* Up one level to the parent */ ++ reduce(lookBuf); ++ if (search_for_prefix(prefix, lookBuf, LANDMARK)) { ++ break; ++ } ++ /* If we are out of paths to search - give up */ ++ if (look < start_buf) { ++ break; ++ } ++ look--; ++ } ++ } ++ ++ pathconfig->module_search_path = start_buf; ++ return _PyStatus_OK(); ++} ++ ++ ++static PyStatus ++calculate_path(PyCalculatePath *calculate, _PyPathConfig *pathconfig) ++{ ++ PyStatus status; ++ ++ status = get_program_full_path(pathconfig); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ ++ /* program_full_path guaranteed \0 terminated in MAXPATH+1 bytes. */ ++ wchar_t argv0_path[MAXPATHLEN+1]; ++ memset(argv0_path, 0, sizeof(argv0_path)); ++ ++ wcscpy_s(argv0_path, MAXPATHLEN+1, pathconfig->program_full_path); ++ reduce(argv0_path); ++ ++ wchar_t prefix[MAXPATHLEN+1]; ++ memset(prefix, 0, sizeof(prefix)); ++ ++ /* Search for a sys.path file */ ++ int pth_found = 0; ++ status = calculate_pth_file(calculate, pathconfig, prefix, &pth_found); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ if (pth_found) { ++ goto done; ++ } ++ ++ status = calculate_pyvenv_file(calculate, ++ argv0_path, Py_ARRAY_LENGTH(argv0_path)); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ ++ /* Calculate zip archive path from DLL or exe path */ ++ wchar_t zip_path[MAXPATHLEN+1]; ++ memset(zip_path, 0, sizeof(zip_path)); ++ ++ if (get_dllpath(zip_path) || change_ext(zip_path, zip_path, L".zip")) ++ { ++ if (change_ext(zip_path, pathconfig->program_full_path, L".zip")) { ++ zip_path[0] = L'\0'; ++ } ++ } ++ ++ calculate_home_prefix(calculate, argv0_path, zip_path, prefix); ++ ++ if (pathconfig->module_search_path == NULL) { ++ status = calculate_module_search_path(calculate, pathconfig, ++ argv0_path, prefix, zip_path); ++ if (_PyStatus_EXCEPTION(status)) { ++ return status; ++ } ++ } ++ ++done: ++ if (pathconfig->prefix == NULL) { ++ pathconfig->prefix = _PyMem_RawWcsdup(prefix); ++ if (pathconfig->prefix == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ } ++ if (pathconfig->exec_prefix == NULL) { ++ pathconfig->exec_prefix = _PyMem_RawWcsdup(prefix); ++ if (pathconfig->exec_prefix == NULL) { ++ return _PyStatus_NO_MEMORY(); ++ } ++ } ++ ++ return _PyStatus_OK(); ++} ++ ++ ++static PyStatus ++calculate_init(PyCalculatePath *calculate, _PyPathConfig *pathconfig, ++ const PyConfig *config) ++{ ++ calculate->home = pathconfig->home; ++ calculate->path_env = _wgetenv(L"PATH"); ++ ++ calculate->pythonpath_env = config->pythonpath_env; ++ ++ return _PyStatus_OK(); ++} ++ ++ ++static void ++calculate_free(PyCalculatePath *calculate) ++{ ++ PyMem_RawFree(calculate->machine_path); ++ PyMem_RawFree(calculate->user_path); ++} ++ ++ ++/* Calculate the Python path configuration. ++ ++ Inputs: ++ ++ - PyConfig.pythonpath_env: PYTHONPATH environment variable ++ - _PyPathConfig.home: Py_SetPythonHome() or PYTHONHOME environment variable ++ - PATH environment variable ++ - __PYVENV_LAUNCHER__ environment variable ++ - GetModuleFileNameW(NULL): fully qualified path of the executable file of ++ the current process ++ - ._pth configuration file ++ - pyvenv.cfg configuration file ++ - Registry key "Software\Python\PythonCore\X.Y\PythonPath" ++ of HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE where X.Y is the Python ++ version. ++ ++ Outputs, 'pathconfig' fields: ++ ++ - base_executable ++ - program_full_path ++ - module_search_path ++ - prefix ++ - exec_prefix ++ - isolated ++ - site_import ++ ++ If a field is already set (non NULL), it is left unchanged. */ ++PyStatus ++_PyPathConfig_Calculate(_PyPathConfig *pathconfig, const PyConfig *config) ++{ ++ PyStatus status; ++ PyCalculatePath calculate; ++ memset(&calculate, 0, sizeof(calculate)); ++ ++ status = calculate_init(&calculate, pathconfig, config); ++ if (_PyStatus_EXCEPTION(status)) { ++ goto done; ++ } ++ ++ status = calculate_path(&calculate, pathconfig); ++ ++done: ++ calculate_free(&calculate); ++ return status; ++} ++ ++ ++/* Load python3.dll before loading any extension module that might refer ++ to it. That way, we can be sure that always the python3.dll corresponding ++ to this python DLL is loaded, not a python3.dll that might be on the path ++ by chance. ++ Return whether the DLL was found. ++*/ ++static int python3_checked = 0; ++static HANDLE hPython3; ++int ++_Py_CheckPython3(void) ++{ ++ wchar_t py3path[MAXPATHLEN+1]; ++ if (python3_checked) { ++ return hPython3 != NULL; ++ } ++ python3_checked = 1; ++ ++ /* If there is a python3.dll next to the python3y.dll, ++ use that DLL */ ++ if (!get_dllpath(py3path)) { ++ reduce(py3path); ++ join(py3path, PY3_DLLNAME); ++ hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); ++ if (hPython3 != NULL) { ++ return 1; ++ } ++ } ++ ++ /* If we can locate python3.dll in our application dir, ++ use that DLL */ ++ hPython3 = LoadLibraryExW(PY3_DLLNAME, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR); ++ if (hPython3 != NULL) { ++ return 1; ++ } ++ ++ /* For back-compat, also search {sys.prefix}\DLLs, though ++ that has not been a normal install layout for a while */ ++ wcscpy(py3path, Py_GetPrefix()); ++ if (py3path[0]) { ++ join(py3path, L"DLLs\\" PY3_DLLNAME); ++ hPython3 = LoadLibraryExW(py3path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); ++ } ++ return hPython3 != NULL; ++} +-- +2.30.2 + diff --git a/recipe/patches/0009-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch b/recipe/patches/0009-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch deleted file mode 100644 index 2c99ca855..000000000 --- a/recipe/patches/0009-Disable-registry-lookup-unless-CONDA_PY_ALLOW_REG_PA.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4f44e06371573bd9fb419d8157ff204bcdb1200e Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Sat, 27 Oct 2018 18:48:30 +0100 -Subject: [PATCH 09/25] Disable registry lookup unless CONDA_PY_ALLOW_REG_PATHS - is not 0 - ---- - PC/getpathp.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - -diff --git a/PC/getpathp.c b/PC/getpathp.c -index 7c0eeab5db..a73ea8a0e9 100644 ---- a/PC/getpathp.c -+++ b/PC/getpathp.c -@@ -778,13 +778,18 @@ calculate_module_search_path(PyCalculatePath *calculate, - const wchar_t *zip_path) - { - int skiphome = calculate->home==NULL ? 0 : 1; --#ifdef Py_ENABLE_SHARED -- if (!Py_IgnoreEnvironmentFlag) { -- calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, -- skiphome); -+ char * allow_registry_paths = getenv("CONDA_PY_ALLOW_REG_PATHS"); -+ if (!Py_IgnoreEnvironmentFlag && allow_registry_paths && allow_registry_paths[0] != '0') -+ { -+ calculate->machine_path = getpythonregpath(HKEY_LOCAL_MACHINE, skiphome); - calculate->user_path = getpythonregpath(HKEY_CURRENT_USER, skiphome); - } --#endif -+ else -+ { -+ calculate->machine_path = NULL; -+ calculate->user_path = NULL; -+ } -+ - /* We only use the default relative PYTHONPATH if we haven't - anything better to use! */ - int skipdefault = (calculate->pythonpath_env != NULL || --- -2.32.1 (Apple Git-133) - diff --git a/recipe/patches/0010-Unvendor-openssl.patch b/recipe/patches/0009-Unvendor-openssl.patch similarity index 89% rename from recipe/patches/0010-Unvendor-openssl.patch rename to recipe/patches/0009-Unvendor-openssl.patch index b5672a1ff..16169e00b 100644 --- a/recipe/patches/0010-Unvendor-openssl.patch +++ b/recipe/patches/0009-Unvendor-openssl.patch @@ -1,18 +1,18 @@ -From b01afea20430e9dd2787bf1549fe09876aefadf7 Mon Sep 17 00:00:00 2001 +From 717e6526e2f32877a9fad11c76df9674b2928424 Mon Sep 17 00:00:00 2001 From: Nehal J Wani Date: Sat, 24 Nov 2018 20:38:02 -0600 -Subject: [PATCH 10/25] Unvendor openssl +Subject: [PATCH 09/24] Unvendor openssl Co-authored-by: Isuru Fernando --- PCbuild/_ssl.vcxproj | 3 -- PCbuild/_ssl.vcxproj.filters | 3 -- - PCbuild/openssl.props | 10 ++----- + PCbuild/openssl.props | 16 ++--------- PCbuild/openssl.vcxproj | 56 ------------------------------------ PCbuild/python.props | 1 + PCbuild/python.vcxproj | 3 ++ PCbuild/pythonw.vcxproj | 3 ++ - 7 files changed, 9 insertions(+), 70 deletions(-) + 7 files changed, 10 insertions(+), 75 deletions(-) diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index 4907f49b66..b2c23d5e8c 100644 @@ -43,7 +43,7 @@ index 716a69a41a..8aef9e03fc 100644 diff --git a/PCbuild/openssl.props b/PCbuild/openssl.props -index a7e16793c7..f7e9be4d11 100644 +index 6081d3c8c6..3538596cbf 100644 --- a/PCbuild/openssl.props +++ b/PCbuild/openssl.props @@ -2,10 +2,10 @@ @@ -59,18 +59,23 @@ index a7e16793c7..f7e9be4d11 100644 ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies) -@@ -20,10 +20,4 @@ +@@ -21,14 +21,4 @@ <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" /> <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" /> -- +- - - -- +- - - - +- \ No newline at end of file ++ diff --git a/PCbuild/openssl.vcxproj b/PCbuild/openssl.vcxproj index 0da6f67495..17eee400eb 100644 --- a/PCbuild/openssl.vcxproj @@ -141,22 +146,22 @@ index 0da6f67495..17eee400eb 100644 diff --git a/PCbuild/python.props b/PCbuild/python.props -index c451429da2..6bb03008bf 100644 +index 7f10e7c45e..bd9e59f4c5 100644 --- a/PCbuild/python.props +++ b/PCbuild/python.props -@@ -55,6 +55,7 @@ - +@@ -59,6 +59,7 @@ + $(EXTERNALS_DIR) + $(LIBRARY_PREFIX)\ $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`)) $(ExternalsDir)\ - $(ExternalsDir)sqlite-3.37.2.0\ + $(ExternalsDir)sqlite-3.38.4.0\ diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj -index b6dcf14823..3481ed3d47 100644 +index d07db3a681..5f2356cb36 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj -@@ -105,6 +105,9 @@ +@@ -106,6 +106,9 @@ @@ -181,5 +186,5 @@ index e7216dec3a..247ea10d5c 100644 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0011-Unvendor-sqlite3.patch b/recipe/patches/0010-Unvendor-sqlite3.patch similarity index 66% rename from recipe/patches/0011-Unvendor-sqlite3.patch rename to recipe/patches/0010-Unvendor-sqlite3.patch index 2eb50bae8..9c89c2596 100644 --- a/recipe/patches/0011-Unvendor-sqlite3.patch +++ b/recipe/patches/0010-Unvendor-sqlite3.patch @@ -1,33 +1,33 @@ -From a542bfd9b01c68e204da423ba2311d7fef13a041 Mon Sep 17 00:00:00 2001 +From 04c5f33620723af188539ac03c3cd464b9297edf Mon Sep 17 00:00:00 2001 From: Nehal J Wani Date: Tue, 5 Oct 2021 12:42:06 -0700 -Subject: [PATCH 11/25] Unvendor sqlite3 +Subject: [PATCH 10/24] Unvendor sqlite3 --- - PCbuild/_sqlite3.vcxproj | 9 ++++----- + PCbuild/_sqlite3.vcxproj | 11 +++++------ PCbuild/pcbuild.sln | 2 -- - PCbuild/python.props | 2 +- PCbuild/sqlite3.vcxproj | 12 ++++++------ - 4 files changed, 11 insertions(+), 14 deletions(-) + 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj -index 5eb8559d29..fcdee1be60 100644 +index 57c7413671..4735477f00 100644 --- a/PCbuild/_sqlite3.vcxproj +++ b/PCbuild/_sqlite3.vcxproj -@@ -93,8 +93,11 @@ +@@ -93,9 +93,12 @@ - $(sqlite3Dir);%(AdditionalIncludeDirectories) -+ $(sqlite3Dir)\include;%(AdditionalIncludeDirectories) ++ $(condaDir)\include;%(AdditionalIncludeDirectories) + PY_SQLITE_HAVE_SERIALIZE;PY_SQLITE_ENABLE_LOAD_EXTENSION;%(PreprocessorDefinitions) + -+ $(sqlite3Dir)\lib\sqlite3.lib;%(AdditionalDependencies) ++ $(condaDir)\lib\sqlite3.lib;%(AdditionalDependencies) + - -@@ -126,10 +129,6 @@ + +@@ -127,12 +130,8 @@ {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26} false @@ -38,11 +38,15 @@ index 5eb8559d29..fcdee1be60 100644 + +- +\ No newline at end of file ++ diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln -index 3507b97279..2b4ac3258c 100644 +index 3629a8508a..94148c9ee3 100644 --- a/PCbuild/pcbuild.sln +++ b/PCbuild/pcbuild.sln -@@ -55,8 +55,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcxproj" +@@ -58,8 +58,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pyexpat", "pyexpat.vcxproj" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcxproj", "{447F05A8-F581-4CAC-A466-5AC7936E207E}" EndProject @@ -51,21 +55,8 @@ index 3507b97279..2b4ac3258c 100644 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multiprocessing.vcxproj", "{9E48B300-37D1-11DD-8C41-005056C00008}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python3dll", "python3dll.vcxproj", "{885D4898-D08D-4091-9C40-C700CFE3FC5A}" -diff --git a/PCbuild/python.props b/PCbuild/python.props -index 6bb03008bf..0abbd875a1 100644 ---- a/PCbuild/python.props -+++ b/PCbuild/python.props -@@ -58,7 +58,7 @@ - $(LIBRARY_PREFIX)\ - $([System.IO.Path]::GetFullPath(`$(PySourcePath)externals`)) - $(ExternalsDir)\ -- $(ExternalsDir)sqlite-3.37.2.0\ -+ $(SQLITE3_DIR)\ - $(ExternalsDir)bzip2-1.0.8\ - $(ExternalsDir)xz-5.2.5\ - $(ExternalsDir)libffi-3.3.0\ diff --git a/PCbuild/sqlite3.vcxproj b/PCbuild/sqlite3.vcxproj -index e39e2d9c22..63d1c27fbc 100644 +index c502d51833..c1ff0c9a08 100644 --- a/PCbuild/sqlite3.vcxproj +++ b/PCbuild/sqlite3.vcxproj @@ -88,12 +88,12 @@ @@ -88,5 +79,5 @@ index e39e2d9c22..63d1c27fbc 100644 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0012-Use-ranlib-from-env-if-env-variable-is-set.patch b/recipe/patches/0011-Use-ranlib-from-env-if-env-variable-is-set.patch similarity index 70% rename from recipe/patches/0012-Use-ranlib-from-env-if-env-variable-is-set.patch rename to recipe/patches/0011-Use-ranlib-from-env-if-env-variable-is-set.patch index be8ea5c16..a8ba7d52d 100644 --- a/recipe/patches/0012-Use-ranlib-from-env-if-env-variable-is-set.patch +++ b/recipe/patches/0011-Use-ranlib-from-env-if-env-variable-is-set.patch @@ -1,17 +1,17 @@ -From f0a563100fda2ad855af87a633d60df5e3713dfb Mon Sep 17 00:00:00 2001 +From 7575960f02022ed119f247828856a663b61cc5ad Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sun, 3 Nov 2019 15:09:45 -0600 -Subject: [PATCH 12/25] Use ranlib from env if env variable is set +Subject: [PATCH 11/24] Use ranlib from env if env variable is set --- Lib/distutils/sysconfig.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py -index 3414a761e7..181f66708e 100644 +index 03b8558419..00133ded58 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py -@@ -263,6 +263,9 @@ def customize_compiler(compiler): +@@ -258,6 +258,9 @@ def customize_compiler(compiler): linker_exe=cc, archiver=archiver) @@ -22,5 +22,5 @@ index 3414a761e7..181f66708e 100644 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0012-Add-CondaEcosystemModifyDllSearchPath.patch b/recipe/patches/0012-Add-CondaEcosystemModifyDllSearchPath.patch new file mode 100644 index 000000000..6b57b5f97 --- /dev/null +++ b/recipe/patches/0012-Add-CondaEcosystemModifyDllSearchPath.patch @@ -0,0 +1,158 @@ +From d906e29bacb60724b1862ecef527ad623bddee3f Mon Sep 17 00:00:00 2001 +From: Ray Donnelly +Date: Tue, 24 Dec 2019 18:37:17 +0100 +Subject: [PATCH 12/24] Add CondaEcosystemModifyDllSearchPath() + + The python interpreter is modifed so that it works as if the python interpreter + was called with the following conda directories. + + os.add_dll_directory(join(sys.prefix, 'bin')) + os.add_dll_directory(join(sys.prefix, 'Scripts')) + os.add_dll_directory(join(sys.prefix, 'Library', 'bin')) + os.add_dll_directory(join(sys.prefix, 'Library', 'usr', 'bin')) + os.add_dll_directory(join(sys.prefix, 'Library', 'mingw-w64', 'bin')) + + Search order + - The directory that contains the DLL (if looking for a dependency) + - Application (python.exe) directory + - Directories added with os.add_dll_directory + - The 5 conda directories + - C:\Windows\System32 + + Note that the default behaviour changed in conda python 3.10 to + make os.add_dll_directory work in user code. + + Note that in conda python <3.11, there was an option + CONDA_DLL_SEARCH_MODIFICATION=1 to add directories in PATH to the search + order, but this was deprecated in 3.10 and removed in 3.11 in favour of using + AddDllDirectory + +Co-authored-by: Isuru Fernando +--- + Python/pylifecycle.c | 96 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 96 insertions(+) + +diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c +index 960a38aebe..a05002b904 100644 +--- a/Python/pylifecycle.c ++++ b/Python/pylifecycle.c +@@ -53,6 +53,10 @@ extern void _PyIO_Fini(void); + #ifdef MS_WINDOWS + # undef BYTE + # include "windows.h" ++# include ++# include ++# include ++# include + + extern PyTypeObject PyWindowsConsoleIO_Type; + # define PyWindowsConsoleIO_Check(op) \ +@@ -105,6 +109,94 @@ __attribute__ ((section (".PyRuntime"))) + = _PyRuntimeState_INIT; + _Py_COMP_DIAG_POP + ++#ifdef MS_WINDOWS ++/* ++ This function will modify the DLL search path so that /Library\bin ++ and other conda PATHS are added to the front of the DLL search path. ++*/ ++ ++#if !defined(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS) ++#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000 ++#endif ++ ++typedef void (WINAPI *ADD)(PCWSTR NewDirectory); ++static ADD pAddDllDirectory = NULL; ++typedef struct ++{ ++ wchar_t *p_relative; ++ wchar_t *p_name; ++} CONDA_PATH; ++ ++#define NUM_CONDA_PATHS 5 ++ ++static CONDA_PATH condaPaths[NUM_CONDA_PATHS] = ++{ ++ {L"Library\\mingw-w64\\bin", NULL}, ++ {L"Library\\usr\\bin", NULL}, ++ {L"Library\\bin", NULL}, ++ {L"Scripts", NULL}, ++ {L"bin", NULL} ++}; ++static wchar_t sv_dll_dirname[1024]; ++ ++int CondaEcosystemModifyDllSearchPath_Init() ++{ ++ int debug_it = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_DEBUG") ? 1 : 0; ++ wchar_t* enable = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_ENABLE"); ++ int res = 0; ++ long long j; ++ CONDA_PATH *p_conda_path; ++ HMODULE dll_handle = NULL; ++ ++ if (pAddDllDirectory == NULL) ++ { ++ pAddDllDirectory = (ADD)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "AddDllDirectory"); ++ ++ /* Determine sv_dll_dirname */ ++ if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, ++ (LPCSTR) &CondaEcosystemModifyDllSearchPath_Init, &dll_handle) == 0) ++ { ++ // Getting the pythonxx.dll path failed. Fall back to relative path of python.exe ++ // assuming that the executable that is running this code is python.exe ++ dll_handle = NULL; ++ } ++ GetModuleFileNameW(dll_handle, &sv_dll_dirname[0], sizeof(sv_dll_dirname)/sizeof(sv_dll_dirname[0])-1); ++ sv_dll_dirname[sizeof(sv_dll_dirname)/sizeof(sv_dll_dirname[0])-1] = L'\0'; ++ if (wcsrchr(sv_dll_dirname, L'\\')) ++ *wcsrchr(sv_dll_dirname, L'\\') = L'\0'; ++ ++ for (p_conda_path = &condaPaths[0]; p_conda_path < &condaPaths[NUM_CONDA_PATHS]; ++p_conda_path) ++ { ++ size_t n_chars_dll_dirname = wcslen(sv_dll_dirname); ++ size_t n_chars_p_relative = wcslen(p_conda_path->p_relative); ++ p_conda_path->p_name = malloc(sizeof(wchar_t) * (n_chars_dll_dirname + n_chars_p_relative + 2)); ++ wcsncpy(p_conda_path->p_name, sv_dll_dirname, n_chars_dll_dirname+1); ++ wcsncat(p_conda_path->p_name, L"\\", 2); ++ wcsncat(p_conda_path->p_name, p_conda_path->p_relative, n_chars_p_relative+1); ++ } ++ ++ } ++ ++ if (pAddDllDirectory == NULL) ++ { ++ if (debug_it) ++ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: WARNING :: Please install KB2533623 from http://go.microsoft.com/fwlink/p/?linkid=217865\n"\ ++ L"CondaEcosystemModifyDllSearchPath() :: WARNING :: to improve conda ecosystem DLL isolation"); ++ res = 2; ++ } ++ else { ++ 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() :: AddDllDirectory(%ls - ExePrefix)\n", p_conda_path->p_name); ++ pAddDllDirectory(p_conda_path->p_name); ++ } ++ } ++ return res; ++} ++ ++#endif ++ + static int runtime_initialized = 0; + + PyStatus +@@ -121,6 +213,10 @@ _PyRuntime_Initialize(void) + } + runtime_initialized = 1; + ++#ifdef MS_WINDOWS ++ extern int CondaEcosystemModifyDllSearchPath_Init(); ++ CondaEcosystemModifyDllSearchPath_Init(); ++#endif + return _PyRuntimeState_Init(&_PyRuntime); + } + +-- +2.30.2 + diff --git a/recipe/patches/0013-Add-CondaEcosystemModifyDllSearchPath.patch b/recipe/patches/0013-Add-CondaEcosystemModifyDllSearchPath.patch deleted file mode 100644 index a7e037b1b..000000000 --- a/recipe/patches/0013-Add-CondaEcosystemModifyDllSearchPath.patch +++ /dev/null @@ -1,488 +0,0 @@ -From 6b14ef83a0c5778cacfda90d127c87f94c03cbff Mon Sep 17 00:00:00 2001 -From: Ray Donnelly -Date: Tue, 24 Dec 2019 18:37:17 +0100 -Subject: [PATCH 13/25] Add CondaEcosystemModifyDllSearchPath() - -There are 2 modes depending on CONDA_DLL_SEARCH_MODIFICATION env variable - -- unset CONDA_DLL_SEARCH_MODIFICATION (Default) - - In this mode, the python interpreter works as if the python interpreter - was called with the following conda directories. - - os.add_dll_directory(join(sys.prefix, 'bin')) - os.add_dll_directory(join(sys.prefix, 'Scripts')) - os.add_dll_directory(join(sys.prefix, 'Library', 'bin')) - os.add_dll_directory(join(sys.prefix, 'Library', 'usr', 'bin')) - os.add_dll_directory(join(sys.prefix, 'Library', 'mingw-w64', 'bin')) - - Search order - - The directory that contains the DLL (if looking for a dependency) - - Application (python.exe) directory - - Directories added with os.add_dll_directory - - The 5 conda directories - - C:\Windows\System32 - - Note that the default behaviour changed in conda python 3.10 to - make os.add_dll_directory work in user code. - -- CONDA_DLL_SEARCH_MODIFICATION=1 - - Search order is roughly, - - - The directory that contains the DLL (if looking for a dependency) - - Application (python.exe) directory - - C:\Windows - - Current working directory - - The 5 conda directories - - PATH - - Directories added with os.add_dll_directory - - Old PATH entries (Deficiency in current patch) - - Old working directories (Deficiency in current patch) - - C:\Windows\System32 - -This changes the DLL search order so that C:\Windows\System32 does not -get searched in before entries in PATH. - -Reviewed by Kai Tietz 7.2.2019 - -Updated a bit to include other directories. - -Made fwprintfs breakpointable - -From Shaun Walbridge: -Fix CondaEcosystemModifyDllSearchPath for users of the Python DLL - -Co-authored-by: Isuru Fernando ---- - Modules/main.c | 370 +++++++++++++++++++++++++++++++++++++++++++ - Python/dynload_win.c | 4 + - Python/pylifecycle.c | 5 +- - 3 files changed, 378 insertions(+), 1 deletion(-) - -diff --git a/Modules/main.c b/Modules/main.c -index 2684d23067..d04a4962b7 100644 ---- a/Modules/main.c -+++ b/Modules/main.c -@@ -17,6 +17,10 @@ - #endif - #ifdef MS_WINDOWS - # include // STATUS_CONTROL_C_EXIT -+# include -+# include -+# include -+# include - #endif - /* End of includes for exit_sigint() */ - -@@ -680,10 +684,376 @@ Py_RunMain(void) - return exitcode; - } - -+#ifdef MS_WINDOWS -+/* Please do not remove this function. It is needed for testing -+ CondaEcosystemModifyDllSearchPath(). */ -+ -+/* -+void LoadAndUnloadTestDLL(wchar_t* test_dll) -+{ -+ wchar_t test_path[MAX_PATH + 1]; -+ HMODULE hDLL = LoadLibraryExW(&test_dll[0], NULL, 0); -+ if (hDLL == NULL) -+ { -+ wchar_t err_msg[256]; -+ DWORD err_code = GetLastError(); -+ FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, -+ NULL, err_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), -+ err_msg, (sizeof(err_msg) / sizeof(wchar_t)), NULL); -+ fwprintf(stderr, L"LoadAndUnloadTestDLL() :: ERROR :: Failed to load %ls, error is: %ls\n", &test_dll[0], &err_msg[0]); -+ } -+ GetModuleFileNameW(hDLL, &test_path[0], MAX_PATH); -+ fwprintf(stderr, L"LoadAndUnloadTestDLL() :: %ls loaded from %ls\n", &test_dll[0], &test_path[0]); -+ if (FreeLibrary(hDLL) == 0) -+ { -+ wchar_t err_msg[256]; -+ DWORD err_code = GetLastError(); -+ FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, -+ NULL, err_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), -+ err_msg, (sizeof(err_msg) / sizeof(wchar_t)), NULL); -+ fwprintf(stderr, L"LoadAndUnloadTestDLL() :: ERROR :: Failed to free %ls, error is: %ls\n", &test_dll[0], &err_msg[0]); -+ } -+} -+*/ -+ -+/* -+ Provided CONDA_DLL_SEARCH_MODIFICATION_ENABLE is set (to anything at all!) -+ this function will modify the DLL search path so that C:\Windows\System32 -+ does not appear before entries in PATH. If it does appear in PATH then it -+ gets added at the position it was in in PATH. -+ -+ This is achieved via a call to SetDefaultDllDirectories() then calls to -+ AddDllDirectory() for each entry in PATH. We also take the opportunity to -+ clean-up these PATH entries such that any '/' are replaced with '\', no -+ double quotes occour and no PATH entry ends with '\'. -+ -+ Caution: Microsoft's documentation says that the search order of entries -+ passed to AddDllDirectory is not respected and arbitrary. I do not think -+ this will be the case but it is worth bearing in mind. -+*/ -+ -+#if !defined(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS) -+#define LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 0x00001000 -+#endif -+ -+/* Caching of prior processed PATH environment */ -+static wchar_t *sv_path_env = NULL; -+typedef void (WINAPI *SDDD)(DWORD DirectoryFlags); -+typedef void (WINAPI *SDD)(PCWSTR SetDir); -+typedef void (WINAPI *ADD)(PCWSTR NewDirectory); -+static SDDD pSetDefaultDllDirectories = NULL; -+static SDD pSetDllDirectory = NULL; -+static ADD pAddDllDirectory = NULL; -+static int sv_failed_to_find_dll_fns = 0; -+/* Have hidden this behind a define because it is clearly not code that -+ could be considered for upstreaming so clearly delimiting it makes it -+ easier to remove. */ -+#define HARDCODE_CONDA_PATHS -+#if defined(HARDCODE_CONDA_PATHS) -+typedef struct -+{ -+ wchar_t *p_relative; -+ wchar_t *p_name; -+} CONDA_PATH; -+ -+#define NUM_CONDA_PATHS 5 -+ -+static CONDA_PATH condaPaths[NUM_CONDA_PATHS] = -+{ -+ {L"Library\\mingw-w64\\bin", NULL}, -+ {L"Library\\usr\\bin", NULL}, -+ {L"Library\\bin", NULL}, -+ {L"Scripts", NULL}, -+ {L"bin", NULL} -+}; -+#endif /* HARDCODE_CONDA_PATHS */ -+static wchar_t sv_dll_dirname[1024]; -+static wchar_t sv_windows_directory[1024]; -+static wchar_t *sv_added_windows_directory = NULL; -+static wchar_t *sv_added_cwd = NULL; -+ -+int CondaEcosystemModifyDllSearchPath_Init() -+{ -+ int debug_it = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_DEBUG") ? 1 : 0; -+ wchar_t* enable = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_ENABLE"); -+ int res = 0; -+#if defined(HARDCODE_CONDA_PATHS) -+ long long j; -+ CONDA_PATH *p_conda_path; -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ HMODULE dll_handle = NULL; -+ -+ if (pSetDefaultDllDirectories == NULL) -+ { -+ wchar_t *conda_prefix = _wgetenv(L"CONDA_PREFIX"); -+ wchar_t *build_prefix = _wgetenv(L"BUILD_PREFIX"); -+ wchar_t *prefix = _wgetenv(L"PREFIX"); -+ pSetDefaultDllDirectories = (SDDD)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories"); -+ pSetDllDirectory = (SDD)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDllDirectoryW"); -+ pAddDllDirectory = (ADD)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "AddDllDirectory"); -+ -+ /* Determine sv_dll_dirname */ -+ if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, -+ (LPCSTR) &CondaEcosystemModifyDllSearchPath_Init, &dll_handle) == 0) -+ { -+ // Getting the pythonxx.dll path failed. Fall back to relative path of python.exe -+ // assuming that the executable that is running this code is python.exe -+ dll_handle = NULL; -+ } -+ GetModuleFileNameW(dll_handle, &sv_dll_dirname[0], sizeof(sv_dll_dirname)/sizeof(sv_dll_dirname[0])-1); -+ sv_dll_dirname[sizeof(sv_dll_dirname)/sizeof(sv_dll_dirname[0])-1] = L'\0'; -+ if (wcsrchr(sv_dll_dirname, L'\\')) -+ *wcsrchr(sv_dll_dirname, L'\\') = L'\0'; -+ -+#if defined(HARDCODE_CONDA_PATHS) -+ for (p_conda_path = &condaPaths[0]; p_conda_path < &condaPaths[NUM_CONDA_PATHS]; ++p_conda_path) -+ { -+ size_t n_chars_dll_dirname = wcslen(sv_dll_dirname); -+ size_t n_chars_p_relative = wcslen(p_conda_path->p_relative); -+ p_conda_path->p_name = malloc(sizeof(wchar_t) * (n_chars_dll_dirname + n_chars_p_relative + 2)); -+ wcsncpy(p_conda_path->p_name, sv_dll_dirname, n_chars_dll_dirname+1); -+ wcsncat(p_conda_path->p_name, L"\\", 2); -+ wcsncat(p_conda_path->p_name, p_conda_path->p_relative, n_chars_p_relative+1); -+ } -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ -+ /* Determine sv_windows_directory */ -+ { -+ char tmp_ascii[1024]; -+ size_t convertedChars = 0; -+ GetWindowsDirectory(&tmp_ascii[0], sizeof(tmp_ascii) / sizeof(tmp_ascii[0]) - 1); -+ tmp_ascii[sizeof(tmp_ascii) / sizeof(tmp_ascii[0]) - 1] = L'\0'; -+ mbstowcs_s(&convertedChars, sv_windows_directory, strlen(tmp_ascii)+1, tmp_ascii, _TRUNCATE); -+ sv_windows_directory[sizeof(sv_windows_directory) / sizeof(sv_windows_directory[0]) - 1] = L'\0'; -+ } -+ } -+ -+ if (pSetDefaultDllDirectories == NULL || pSetDllDirectory == NULL || pAddDllDirectory == NULL) -+ { -+ if (debug_it) -+ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: WARNING :: Please install KB2533623 from http://go.microsoft.com/fwlink/p/?linkid=217865\n"\ -+ L"CondaEcosystemModifyDllSearchPath() :: WARNING :: to improve conda ecosystem DLL isolation"); -+ sv_failed_to_find_dll_fns = 1; -+ res = 2; -+ } -+#if defined(HARDCODE_CONDA_PATHS) -+ else if (enable == NULL || !wcscmp(enable, L"0")) { -+ 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() :: AddDllDirectory(%ls - ExePrefix)\n", p_conda_path->p_name); -+ pAddDllDirectory(p_conda_path->p_name); -+ } -+ } -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ return res; -+} -+ -+int CondaEcosystemModifyDllSearchPath(int add_windows_directory, int add_cwd) { -+ int debug_it = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_DEBUG") ? 1 : 0; -+ const wchar_t *path_env = _wgetenv(L"PATH"); -+ wchar_t current_working_directory[1024]; -+ const wchar_t *p_cwd = NULL; -+ long long entry_num = 0; -+ long long i; -+ wchar_t **path_entries; -+ wchar_t *path_end; -+ long long num_entries = 1; -+#if defined(HARDCODE_CONDA_PATHS) -+ long long j; -+ CONDA_PATH *p_conda_path; -+ int foundCondaPath[NUM_CONDA_PATHS] = {0, 0, 0, 0, 0}; -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ wchar_t *enable; -+ -+ int SetDllDirectoryValue = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS; -+ if (sv_failed_to_find_dll_fns) -+ return 1; -+ -+ /* Fix for embedding the Python DLL. Courtesy of Shaun Walbridge -+ * if the CondaEcosystemModifyDllSearchPath_Init(argc, argv) code hasn't been run -+ * or failed to bind to the required functions in kernel32.dll, fail early to avoid -+ * an access violation. */ -+ if (pSetDefaultDllDirectories == NULL || pSetDllDirectory == NULL || pAddDllDirectory == NULL) -+ return 1; -+ -+ enable = _wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_ENABLE"); -+ if (enable == NULL || !wcscmp(enable, L"0")) -+ return 0; -+ if (_wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_NEVER_ADD_WINDOWS_DIRECTORY")) -+ add_windows_directory = 0; -+ if (_wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_NEVER_ADD_CWD")) -+ add_cwd = 0; -+ -+ if (add_cwd) -+ { -+ _wgetcwd(¤t_working_directory[0], (sizeof(current_working_directory)/sizeof(current_working_directory[0])) - 1); -+ current_working_directory[sizeof(current_working_directory)/sizeof(current_working_directory[0]) - 1] = L'\0'; -+ p_cwd = ¤t_working_directory[0]; -+ } -+ -+ /* cache path to avoid multiple adds */ -+ if (sv_path_env != NULL && path_env != NULL && !wcscmp(path_env, sv_path_env)) -+ { -+ if ((add_windows_directory && sv_added_windows_directory != NULL) || -+ (!add_windows_directory && sv_added_windows_directory == NULL) ) -+ { -+ if ((p_cwd == NULL && sv_added_cwd == NULL) || -+ p_cwd != NULL && sv_added_cwd != NULL && !wcscmp(p_cwd, sv_added_cwd)) -+ { -+ if (_wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_NEVER_CACHE") == NULL) -+ { -+ if (debug_it) -+ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: INFO :: Values unchanged\n"); -+ return 0; -+ } -+ } -+ } -+ } -+ /* Something has changed. -+ Reset to default search order */ -+ pSetDllDirectory(NULL); -+ -+ if (sv_path_env != NULL) -+ { -+ free(sv_path_env); -+ } -+ sv_path_env = (path_env == NULL) ? NULL : _wcsdup(path_env); -+ -+ if (path_env != NULL) -+ { -+ 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); -+ memcpy(path, path_env, (len + 1) * sizeof(wchar_t)); -+ /* Convert any / to \ */ -+ /* Replace slash with backslash */ -+ while ((path_end = wcschr(path, L'/'))) -+ *path_end = L'\\'; -+ /* Remove all double quotes */ -+ while ((path_end = wcschr(path, L'"'))) -+ memmove(path_end, path_end + 1, sizeof(wchar_t) * (len-- - (path_end - path))); -+ /* Remove all leading and double ';' */ -+ while (*path == L';') -+ memmove(path, path + 1, sizeof(wchar_t) * len--); -+ while ((path_end = wcsstr(path, L";;"))) -+ memmove(path_end, path_end + 1, sizeof(wchar_t) * (len-- - (path_end - path))); -+ /* Remove trailing ;'s */ -+ while(path[len-1] == L';') -+ path[len-- - 1] = L'\0'; -+ -+ if (len == 0) -+ return 2; -+ -+ /* Count the number of path entries */ -+ path_end = path; -+ while ((path_end = wcschr(path_end, L';'))) -+ { -+ ++num_entries; -+ ++path_end; -+ } -+ -+ path_entries = (wchar_t **)alloca((num_entries) * sizeof(wchar_t *)); -+ path_end = wcschr(path, L';'); -+ -+ if (getenv("CONDA_DLL_SET_DLL_DIRECTORY_VALUE") != NULL) -+ SetDllDirectoryValue = atoi(getenv("CONDA_DLL_SET_DLL_DIRECTORY_VALUE")); -+ pSetDefaultDllDirectories(SetDllDirectoryValue); -+ while (path != NULL) -+ { -+ if (path_end != NULL) -+ { -+ *path_end = L'\0'; -+ /* Hygiene, no \ at the end */ -+ while (path_end > path && path_end[-1] == L'\\') -+ { -+ --path_end; -+ *path_end = L'\0'; -+ } -+ } -+ if (wcslen(path) != 0) -+ path_entries[entry_num++] = path; -+ path = path_end; -+ if (path != NULL) -+ { -+ while (*path == L'\0') -+ ++path; -+ path_end = wcschr(path, L';'); -+ } -+ } -+ for (i = num_entries - 1; i > -1; --i) -+ { -+#if defined(HARDCODE_CONDA_PATHS) -+ for (j = 0, p_conda_path = &condaPaths[0]; p_conda_path < &condaPaths[NUM_CONDA_PATHS]; ++j, ++p_conda_path) -+ { -+ if (!foundCondaPath[j] && !wcscmp(path_entries[i], p_conda_path->p_name)) -+ { -+ foundCondaPath[j] = 1; -+ break; -+ } -+ } -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ if (debug_it) -+ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls)\n", path_entries[i]); -+ pAddDllDirectory(path_entries[i]); -+ } -+ } -+ -+#if defined(HARDCODE_CONDA_PATHS) -+ if (_wgetenv(L"CONDA_DLL_SEARCH_MODIFICATION_DO_NOT_ADD_EXEPREFIX") == NULL) -+ { -+ 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 (!foundCondaPath[j]) -+ { -+ if (debug_it) -+ fwprintf(stderr, L"CondaEcosystemModifyDllSearchPath() :: AddDllDirectory(%ls - ExePrefix)\n", p_conda_path->p_name); -+ pAddDllDirectory(p_conda_path->p_name); -+ } -+ } -+ } -+#endif /* defined(HARDCODE_CONDA_PATHS) */ -+ -+ if (p_cwd) -+ { -+ if (sv_added_cwd != NULL && wcscmp(p_cwd, sv_added_cwd)) -+ { -+ free(sv_added_cwd); -+ } -+ sv_added_cwd = _wcsdup(p_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); -+ pAddDllDirectory(sv_windows_directory); -+ } -+ else -+ { -+ sv_added_windows_directory = NULL; -+ } -+ -+ return 0; -+} -+#endif -+ - - static int - pymain_main(_PyArgv *args) - { -+#ifdef MS_WINDOWS -+ /* LoadAndUnloadTestDLL(L"libiomp5md.dll"); */ -+ CondaEcosystemModifyDllSearchPath_Init(args->argc, args->wchar_argv); -+ /* LoadAndUnloadTestDLL(L"libiomp5md.dll"); */ -+#endif - PyStatus status = pymain_init(args); - if (_PyStatus_IS_EXIT(status)) { - pymain_free(); -diff --git a/Python/dynload_win.c b/Python/dynload_win.c -index 5702ab2cd7..e2efd4c8ea 100644 ---- a/Python/dynload_win.c -+++ b/Python/dynload_win.c -@@ -190,6 +190,10 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix, - to avoid DLL preloading attacks and enable use of the - 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_LIBRARY_SEARCH_DEFAULT_DIRS | -diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c -index eeaf20b461..a32aa666e4 100644 ---- a/Python/pylifecycle.c -+++ b/Python/pylifecycle.c -@@ -101,7 +101,10 @@ _PyRuntime_Initialize(void) - return _PyStatus_OK(); - } - runtime_initialized = 1; -- -+#ifdef MS_WINDOWS -+ extern int CondaEcosystemModifyDllSearchPath_Init(); -+ CondaEcosystemModifyDllSearchPath_Init(); -+#endif - return _PyRuntimeState_Init(&_PyRuntime); - } - --- -2.32.1 (Apple Git-133) - diff --git a/recipe/patches/0014-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch b/recipe/patches/0013-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch similarity index 90% rename from recipe/patches/0014-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch rename to recipe/patches/0013-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch index c31bc92d4..beca04052 100644 --- a/recipe/patches/0014-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch +++ b/recipe/patches/0013-Add-d1trimfile-SRC_DIR-to-make-pdbs-more-relocatable.patch @@ -1,7 +1,7 @@ -From fcb13bcd963edda1caa5aad3a1065eccd749e52f Mon Sep 17 00:00:00 2001 +From 1d43e738cc6c68f35b4701ece5c5642948ae3d85 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 31 Dec 2019 20:46:36 +0100 -Subject: [PATCH 14/25] Add /d1trimfile:%SRC_DIR% to make pdbs more relocatable +Subject: [PATCH 13/24] Add /d1trimfile:%SRC_DIR% to make pdbs more relocatable --- Lib/distutils/_msvccompiler.py | 9 ++++++++- @@ -35,5 +35,5 @@ index af8099a407..0b245adb30 100644 args.append('/EHsc') args.append(input_opt) -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0015-Doing-d1trimfile.patch b/recipe/patches/0014-Doing-d1trimfile.patch similarity index 94% rename from recipe/patches/0015-Doing-d1trimfile.patch rename to recipe/patches/0014-Doing-d1trimfile.patch index f228a67b0..782e2f374 100644 --- a/recipe/patches/0015-Doing-d1trimfile.patch +++ b/recipe/patches/0014-Doing-d1trimfile.patch @@ -1,7 +1,7 @@ -From 7df56c01f83fa3524b7c2045388458fc32146c4b Mon Sep 17 00:00:00 2001 +From 38c7deb367f0ac42ac2091e21bc4f08f6ecc3513 Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Tue, 31 Dec 2019 21:47:47 +0100 -Subject: [PATCH 15/25] Doing d1trimfile +Subject: [PATCH 14/24] Doing d1trimfile --- PCbuild/_asyncio.vcxproj | 20 ++++++++++++++++++++ @@ -9,8 +9,8 @@ Subject: [PATCH 15/25] Doing d1trimfile PCbuild/_ctypes.vcxproj | 4 ++++ PCbuild/_ctypes_test.vcxproj | 20 ++++++++++++++++++++ PCbuild/_decimal.vcxproj | 4 ++++ - PCbuild/_elementtree.vcxproj | 4 ++++ - PCbuild/_freeze_importlib.vcxproj | 4 ++++ + PCbuild/_elementtree.vcxproj | 6 +++++- + PCbuild/_freeze_module.vcxproj | 4 ++++ PCbuild/_hashlib.vcxproj | 12 ++++++++++++ PCbuild/_lzma.vcxproj | 4 ++++ PCbuild/_msi.vcxproj | 12 ++++++++++++ @@ -46,7 +46,7 @@ Subject: [PATCH 15/25] Doing d1trimfile PCbuild/winsound.vcxproj | 12 ++++++++++++ PCbuild/xxlimited.vcxproj | 6 ++++++ PCbuild/xxlimited_35.vcxproj | 6 ++++++ - 42 files changed, 363 insertions(+), 3 deletions(-) + 42 files changed, 364 insertions(+), 4 deletions(-) diff --git a/PCbuild/_asyncio.vcxproj b/PCbuild/_asyncio.vcxproj index ed1e1bc0a4..47d322be5f 100644 @@ -95,13 +95,13 @@ index 3fe95fbf83..0402f7a9aa 100644 diff --git a/PCbuild/_ctypes.vcxproj b/PCbuild/_ctypes.vcxproj -index 69e4271a9b..f28002d190 100644 +index 6ac26f1916..07a58154f7 100644 --- a/PCbuild/_ctypes.vcxproj +++ b/PCbuild/_ctypes.vcxproj @@ -95,6 +95,10 @@ - FFI_BUILDING;%(PreprocessorDefinitions) + USING_MALLOC_CLOSURE_DOT_C=1;%(PreprocessorDefinitions) + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% @@ -156,13 +156,15 @@ index 0916f1a2d3..17a4cbfcd7 100644 diff --git a/PCbuild/_elementtree.vcxproj b/PCbuild/_elementtree.vcxproj -index 4a125b243b..20cc09d63f 100644 +index 8da5244bac..20cc09d63f 100644 --- a/PCbuild/_elementtree.vcxproj +++ b/PCbuild/_elementtree.vcxproj -@@ -95,6 +95,10 @@ +@@ -94,7 +94,11 @@ + ..\Modules\expat;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) +- _CRT_SECURE_NO_WARNINGS;XML_STATIC;%(PreprocessorDefinitions) ++ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions) + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% @@ -170,14 +172,14 @@ index 4a125b243b..20cc09d63f 100644 -diff --git a/PCbuild/_freeze_importlib.vcxproj b/PCbuild/_freeze_importlib.vcxproj -index e437412a16..c4d5886b9f 100644 ---- a/PCbuild/_freeze_importlib.vcxproj -+++ b/PCbuild/_freeze_importlib.vcxproj -@@ -89,6 +89,10 @@ - - - _CONSOLE;%(PreprocessorDefinitions) +diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj +index 0a74f5850a..b23ab1ba6a 100644 +--- a/PCbuild/_freeze_module.vcxproj ++++ b/PCbuild/_freeze_module.vcxproj +@@ -91,6 +91,10 @@ + Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions) + Disabled + false + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% @@ -347,20 +349,20 @@ index 8fd75f90e7..b403828291 100644 diff --git a/PCbuild/_sqlite3.vcxproj b/PCbuild/_sqlite3.vcxproj -index fcdee1be60..ec2680955f 100644 +index 4735477f00..c7c377e217 100644 --- a/PCbuild/_sqlite3.vcxproj +++ b/PCbuild/_sqlite3.vcxproj -@@ -94,6 +94,10 @@ - +@@ -95,6 +95,10 @@ - $(sqlite3Dir)\include;%(AdditionalIncludeDirectories) + $(condaDir)\include;%(AdditionalIncludeDirectories) + PY_SQLITE_HAVE_SERIALIZE;PY_SQLITE_ENABLE_LOAD_EXTENSION;%(PreprocessorDefinitions) + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% - $(sqlite3Dir)\lib\sqlite3.lib;%(AdditionalDependencies) + $(condaDir)\lib\sqlite3.lib;%(AdditionalDependencies) diff --git a/PCbuild/_ssl.vcxproj b/PCbuild/_ssl.vcxproj index b2c23d5e8c..ebe4e88848 100644 --- a/PCbuild/_ssl.vcxproj @@ -584,13 +586,13 @@ index 4dd42ab98a..7c2dbc7e70 100644 diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj -index b2d9f5d57d..26ac82980c 100644 +index 001f8afd89..3be4ac06dd 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) + _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;XML_STATIC;%(PreprocessorDefinitions) + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% + /d1trimfile:%SRC_DIR% @@ -599,7 +601,7 @@ index b2d9f5d57d..26ac82980c 100644 diff --git a/PCbuild/pylauncher.vcxproj b/PCbuild/pylauncher.vcxproj -index 550e084230..0ea871bddb 100644 +index 35f2f7e505..02d7961c5d 100644 --- a/PCbuild/pylauncher.vcxproj +++ b/PCbuild/pylauncher.vcxproj @@ -93,6 +93,10 @@ @@ -612,7 +614,7 @@ index 550e084230..0ea871bddb 100644 + /d1trimfile:%SRC_DIR% - version.lib;%(AdditionalDependencies) + shell32.lib;pathcch.lib;%(AdditionalDependencies) diff --git a/PCbuild/pyshellext.vcxproj b/PCbuild/pyshellext.vcxproj index ea432d6bc9..13bc692103 100644 --- a/PCbuild/pyshellext.vcxproj @@ -629,7 +631,7 @@ index ea432d6bc9..13bc692103 100644 version.lib;shlwapi.lib;%(AdditionalDependencies) diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj -index 3481ed3d47..06b0858e22 100644 +index 5f2356cb36..0fd20d010e 100644 --- a/PCbuild/python.vcxproj +++ b/PCbuild/python.vcxproj @@ -91,6 +91,10 @@ @@ -672,7 +674,7 @@ index fb27e9e712..f8dc841ef1 100644 windowsapp.lib;%(AdditionalDependencies) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj -index 3ba6358764..5d15834900 100644 +index a38040159e..c4cb39c821 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -99,7 +99,7 @@ @@ -721,7 +723,7 @@ index e21e46a1b7..ff7dc6635d 100644 windowsapp.lib;%(AdditionalDependencies) diff --git a/PCbuild/pywlauncher.vcxproj b/PCbuild/pywlauncher.vcxproj -index 44e3fc2927..1105c99807 100644 +index e50b69aefe..3aa738bb7f 100644 --- a/PCbuild/pywlauncher.vcxproj +++ b/PCbuild/pywlauncher.vcxproj @@ -93,6 +93,10 @@ @@ -734,7 +736,7 @@ index 44e3fc2927..1105c99807 100644 + /d1trimfile:%SRC_DIR% - version.lib;%(AdditionalDependencies) + shell32.lib;pathcch.lib;%(AdditionalDependencies) diff --git a/PCbuild/select.vcxproj b/PCbuild/select.vcxproj index 750a713949..1da66eaddc 100644 --- a/PCbuild/select.vcxproj @@ -877,5 +879,5 @@ index dd830b3b6a..fef2c5b9f4 100644 wsock32.lib;%(AdditionalDependencies) -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0016-cross-compile-darwin.patch b/recipe/patches/0015-cross-compile-darwin.patch similarity index 80% rename from recipe/patches/0016-cross-compile-darwin.patch rename to recipe/patches/0015-cross-compile-darwin.patch index 1d96a34c6..8d05bcfe2 100644 --- a/recipe/patches/0016-cross-compile-darwin.patch +++ b/recipe/patches/0015-cross-compile-darwin.patch @@ -1,7 +1,7 @@ -From 9cacbfb49d32940ff3830d131c657e291e32b755 Mon Sep 17 00:00:00 2001 +From 0264f5cfd14e95977ef764e59a45733d28e9bf8c Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Fri, 2 Oct 2020 00:03:12 +0200 -Subject: [PATCH 16/25] cross compile darwin +Subject: [PATCH 15/24] cross compile darwin By Isuru Fernando. --- @@ -12,10 +12,10 @@ By Isuru Fernando. 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Lib/platform.py b/Lib/platform.py -index e32f9c11cd..5f7e46fb6c 100755 +index c272c407c7..c05b9b8ea9 100755 --- a/Lib/platform.py +++ b/Lib/platform.py -@@ -411,7 +411,12 @@ def win32_ver(release='', version='', csd='', ptype=''): +@@ -413,7 +413,12 @@ def win32_ver(release='', version='', csd='', ptype=''): def _mac_ver_xml(): fn = '/System/Library/CoreServices/SystemVersion.plist' if not os.path.exists(fn): @@ -30,10 +30,10 @@ index e32f9c11cd..5f7e46fb6c 100755 try: import plistlib diff --git a/configure b/configure -index 5075304e93..9399fe6cd8 100755 +index 91227f00be..b89d1a380a 100755 --- a/configure +++ b/configure -@@ -3393,6 +3393,9 @@ if test "$cross_compiling" = yes; then +@@ -3873,6 +3873,9 @@ if test "$cross_compiling" = yes; then _host_cpu=$host_cpu esac ;; @@ -43,7 +43,7 @@ index 5075304e93..9399fe6cd8 100755 *-*-cygwin*) _host_cpu= ;; -@@ -6250,7 +6253,7 @@ esac +@@ -7051,7 +7054,7 @@ esac fi fi @@ -53,10 +53,10 @@ index 5075304e93..9399fe6cd8 100755 readelf|:) as_fn_error $? "readelf for the host is required for cross builds" "$LINENO" 5 diff --git a/configure.ac b/configure.ac -index 4e026c2a0f..3b76442881 100644 +index 77fb609b74..1d9fa9e4ef 100644 --- a/configure.ac +++ b/configure.ac -@@ -448,6 +448,9 @@ if test "$cross_compiling" = yes; then +@@ -597,6 +597,9 @@ if test "$cross_compiling" = yes; then _host_cpu=$host_cpu esac ;; @@ -66,7 +66,7 @@ index 4e026c2a0f..3b76442881 100644 *-*-cygwin*) _host_cpu= ;; -@@ -1211,7 +1214,7 @@ then +@@ -1590,7 +1593,7 @@ then fi AC_CHECK_TOOLS([READELF], [readelf], [:]) @@ -76,10 +76,10 @@ index 4e026c2a0f..3b76442881 100644 readelf|:) AC_MSG_ERROR([readelf for the host is required for cross builds]) diff --git a/setup.py b/setup.py -index 9c3dd04989..0001e40a32 100644 +index 25fc167722..1a354d5bd4 100644 --- a/setup.py +++ b/setup.py -@@ -83,7 +83,7 @@ def get_platform(): +@@ -81,7 +81,7 @@ def get_platform(): HOST_PLATFORM = get_platform() MS_WINDOWS = (HOST_PLATFORM == 'win32') CYGWIN = (HOST_PLATFORM == 'cygwin') @@ -87,8 +87,8 @@ index 9c3dd04989..0001e40a32 100644 +MACOS = (HOST_PLATFORM.startswith('darwin')) AIX = (HOST_PLATFORM.startswith('aix')) VXWORKS = ('vxworks' in HOST_PLATFORM) - CC = os.environ.get("CC") -@@ -1099,11 +1099,11 @@ def detect_readline_curses(self): + EMSCRIPTEN = HOST_PLATFORM == 'emscripten-wasm32' +@@ -1067,11 +1067,11 @@ def detect_readline_curses(self): readline_lib = 'readline' do_readline = self.compiler.find_library_file(self.lib_dirs, readline_lib) @@ -103,5 +103,5 @@ index 9c3dd04989..0001e40a32 100644 else: ret = 1 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0017-Fix-TZPATH-on-windows.patch b/recipe/patches/0016-Fix-TZPATH-on-windows.patch similarity index 63% rename from recipe/patches/0017-Fix-TZPATH-on-windows.patch rename to recipe/patches/0016-Fix-TZPATH-on-windows.patch index a35fe3013..c6b4b3b24 100644 --- a/recipe/patches/0017-Fix-TZPATH-on-windows.patch +++ b/recipe/patches/0016-Fix-TZPATH-on-windows.patch @@ -1,24 +1,24 @@ -From e5d365fb1b73272492ef47eea91481190c845d8b Mon Sep 17 00:00:00 2001 +From cedc51e9b9484cd0db7c07722d1c480107216c0d Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Oct 2020 10:08:30 -0500 -Subject: [PATCH 17/25] Fix TZPATH on windows +Subject: [PATCH 16/24] Fix TZPATH on windows --- Lib/sysconfig.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py -index daf9f00006..5d12426756 100644 +index ebe3711827..d51ba78d51 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py -@@ -611,6 +611,7 @@ def get_config_vars(*args): - +@@ -666,6 +666,7 @@ def get_config_vars(*args): if os.name == 'nt': _init_non_posix(_CONFIG_VARS) + _CONFIG_VARS['VPATH'] = sys._vpath + _CONFIG_VARS['TZPATH'] = os.path.join(_PREFIX, "share", "zoneinfo") if os.name == 'posix': _init_posix(_CONFIG_VARS) - # For backward compatibility, see issue19555 + if _HAS_USER_BASE: -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0018-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch b/recipe/patches/0017-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch similarity index 82% rename from recipe/patches/0018-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch rename to recipe/patches/0017-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch index 039cf9ab9..d0a5d77a7 100644 --- a/recipe/patches/0018-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch +++ b/recipe/patches/0017-Make-dyld-search-work-with-SYSTEM_VERSION_COMPAT-1.patch @@ -1,7 +1,7 @@ -From 8c363a53d48ea68c9df913f344dd0b9fee34896f Mon Sep 17 00:00:00 2001 +From dedf7f42b63f5953d24204e2e8b87137d0e054bf Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 25 Jan 2021 03:28:08 -0600 -Subject: [PATCH 18/25] Make dyld search work with SYSTEM_VERSION_COMPAT=1 +Subject: [PATCH 17/24] Make dyld search work with SYSTEM_VERSION_COMPAT=1 In macOS Big Sur, if the executable was compiled with `MACOSX_DEPLOYMENT_TARGET=10.15` or below, then SYSTEM_VERSION_COMPAT=1 is the default which means that Big Sur @@ -15,10 +15,10 @@ as that part is compiled with `MACOSX_DEPLOYMENT_TARGET=11.0`) 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c -index 48694760db..e72352ffac 100644 +index 3fab9ad0c1..66d52a1314 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c -@@ -1445,7 +1445,7 @@ copy_com_pointer(PyObject *self, PyObject *args) +@@ -1440,7 +1440,7 @@ copy_com_pointer(PyObject *self, PyObject *args) #ifdef __APPLE__ #ifdef HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH #define HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH_RUNTIME \ @@ -28,5 +28,5 @@ index 48694760db..e72352ffac 100644 // Support the deprecated case of compiling on an older macOS version static void *libsystem_b_handle; -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0019-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch b/recipe/patches/0018-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch similarity index 78% rename from recipe/patches/0019-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch rename to recipe/patches/0018-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch index ac1d9c893..46eb6a567 100644 --- a/recipe/patches/0019-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch +++ b/recipe/patches/0018-Fix-LDSHARED-when-CC-is-overriden-on-Linux-too.patch @@ -1,17 +1,17 @@ -From 6902e25f8baa61fdc1f7e78cb2e361d12682b008 Mon Sep 17 00:00:00 2001 +From 125971faa2ca552eb8976f6aa85fb4485c8c0692 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 16 Aug 2021 02:18:50 -0700 -Subject: [PATCH 19/25] Fix LDSHARED when CC is overriden on Linux too +Subject: [PATCH 18/24] Fix LDSHARED when CC is overriden on Linux too --- Lib/distutils/sysconfig.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py -index 181f66708e..07bb42df04 100644 +index 00133ded58..43eef57419 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py -@@ -222,10 +222,9 @@ def customize_compiler(compiler): +@@ -217,10 +217,9 @@ def customize_compiler(compiler): if 'CC' in os.environ: newcc = os.environ['CC'] @@ -25,5 +25,5 @@ index 181f66708e..07bb42df04 100644 ldshared = newcc + ldshared[len(cc):] cc = newcc -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0020-Unvendor-bzip2.patch b/recipe/patches/0019-Unvendor-bzip2.patch similarity index 94% rename from recipe/patches/0020-Unvendor-bzip2.patch rename to recipe/patches/0019-Unvendor-bzip2.patch index c2b7e0b4c..057f98494 100644 --- a/recipe/patches/0020-Unvendor-bzip2.patch +++ b/recipe/patches/0019-Unvendor-bzip2.patch @@ -1,7 +1,7 @@ -From ccd0b73ad01c5301f948d62800d5ccd102d39c21 Mon Sep 17 00:00:00 2001 +From d28868966d973a9b09909567ae6522e182f87c9a Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 16 Aug 2021 02:56:27 -0700 -Subject: [PATCH 20/25] Unvendor bzip2 +Subject: [PATCH 19/24] Unvendor bzip2 --- PCbuild/_bz2.vcxproj | 15 +++++---------- @@ -86,5 +86,5 @@ index 7c0b516253..c1f960608c 100644 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0021-Unvendor-libffi.patch b/recipe/patches/0020-Unvendor-libffi.patch similarity index 77% rename from recipe/patches/0021-Unvendor-libffi.patch rename to recipe/patches/0020-Unvendor-libffi.patch index cb83b407a..49b1ba481 100644 --- a/recipe/patches/0021-Unvendor-libffi.patch +++ b/recipe/patches/0020-Unvendor-libffi.patch @@ -1,14 +1,14 @@ -From f79b4ea35df7853bdf6faa2881e0bdc07c935243 Mon Sep 17 00:00:00 2001 +From 42878cbda85eb54cc8c7ce5db987cd37b8cea4cc Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Mon, 16 Aug 2021 03:07:40 -0700 -Subject: [PATCH 21/25] Unvendor libffi +Subject: [PATCH 20/24] Unvendor libffi --- - PCbuild/libffi.props | 15 +++------------ - 1 file changed, 3 insertions(+), 12 deletions(-) + PCbuild/libffi.props | 17 ++++------------- + 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/PCbuild/libffi.props b/PCbuild/libffi.props -index 975c4a0d35..97fb5966bf 100644 +index 22c9550e2c..40ddb08d2b 100644 --- a/PCbuild/libffi.props +++ b/PCbuild/libffi.props @@ -2,20 +2,11 @@ @@ -20,13 +20,13 @@ index 975c4a0d35..97fb5966bf 100644 - $(libffiOutDir);%(AdditionalLibraryDirectories) -- libffi-7.lib;%(AdditionalDependencies) +- libffi-8.lib;%(AdditionalDependencies) + $(condaDir)\lib;%(AdditionalLibraryDirectories) + ffi.lib;%(AdditionalDependencies) - -- <_LIBFFIDLL Include="$(libffiOutDir)\libffi-7.dll" /> +- <_LIBFFIDLL Include="$(libffiOutDir)\libffi-8.dll" /> - - - @@ -34,8 +34,9 @@ index 975c4a0d35..97fb5966bf 100644 - - - - +- \ No newline at end of file ++ -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0022-Unvendor-tcltk.patch b/recipe/patches/0021-Unvendor-tcltk.patch similarity index 64% rename from recipe/patches/0022-Unvendor-tcltk.patch rename to recipe/patches/0021-Unvendor-tcltk.patch index 8c8afb3b6..c6e2caa8d 100644 --- a/recipe/patches/0022-Unvendor-tcltk.patch +++ b/recipe/patches/0021-Unvendor-tcltk.patch @@ -1,17 +1,17 @@ -From 4966a9e99c4ad67ce3b14b37761932e26ea816d0 Mon Sep 17 00:00:00 2001 +From 601a2843ef2afef6b9d747d5a7d2079d967c2f20 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 20 Aug 2021 10:23:51 -0700 -Subject: [PATCH 22/25] Unvendor tcltk +Subject: [PATCH 21/24] Unvendor tcltk --- - PCbuild/tcltk.props | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) + PCbuild/tcltk.props | 12 +++++------- + 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/PCbuild/tcltk.props b/PCbuild/tcltk.props -index 16dc35d45e..f0ae3372f3 100644 +index 7fd43e8279..5d7f07567d 100644 --- a/PCbuild/tcltk.props +++ b/PCbuild/tcltk.props -@@ -14,10 +14,10 @@ +@@ -14,13 +14,11 @@ 4 3 6 @@ -19,13 +19,17 @@ index 16dc35d45e..f0ae3372f3 100644 - $(ExternalsDir)tk-$(TkMajorVersion).$(TkMinorVersion).$(TkPatchLevel).$(TkRevision)\ - $(ExternalsDir)tix-$(TixMajorVersion).$(TixMinorVersion).$(TixPatchLevel).$(TixRevision)\ - $(ExternalsDir)tcltk-$(TclMajorVersion).$(TclMinorVersion).$(TclPatchLevel).$(TclRevision)\$(ArchName)\ +- $(tcltkDir)\bin\tclsh$(TclMajorVersion)$(TclMinorVersion)t.exe +- $(tcltkDir)\..\win32\bin\tclsh$(TclMajorVersion)$(TclMinorVersion)t.exe +- + $(condaDir) + $(condaDir) + $(condaDir) + $(condaDir) ++ $(condaDir)\bin\tclsh$(TclMajorVersion)$(TclMinorVersion)t.exe tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).dll tcl$(TclMajorVersion)$(TclMinorVersion)t$(TclDebugExt).lib -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0023-unvendor-xz.patch b/recipe/patches/0022-unvendor-xz.patch similarity index 93% rename from recipe/patches/0023-unvendor-xz.patch rename to recipe/patches/0022-unvendor-xz.patch index 632fe08d7..b485c5c45 100644 --- a/recipe/patches/0023-unvendor-xz.patch +++ b/recipe/patches/0022-unvendor-xz.patch @@ -1,7 +1,7 @@ -From ae05d55281b0ff567c0ff37fa86db701b28ed5fe Mon Sep 17 00:00:00 2001 +From 57c17d3e3a4e85c56d6801468488d1f795d732c5 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Sat, 25 Sep 2021 10:07:05 -0700 -Subject: [PATCH 23/25] unvendor xz +Subject: [PATCH 22/24] unvendor xz --- PCbuild/_lzma.vcxproj | 10 +++------- @@ -42,5 +42,5 @@ index 0565132363..e8b2704cee 100644 -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0024-unvendor-zlib.patch b/recipe/patches/0023-unvendor-zlib.patch similarity index 89% rename from recipe/patches/0024-unvendor-zlib.patch rename to recipe/patches/0023-unvendor-zlib.patch index a8b21e850..ee6d23a22 100644 --- a/recipe/patches/0024-unvendor-zlib.patch +++ b/recipe/patches/0023-unvendor-zlib.patch @@ -1,7 +1,7 @@ -From a28ceb5075fb996975641c2fc1db86a0850b45e6 Mon Sep 17 00:00:00 2001 +From 6e3cba5e8119a2b5d3cc5d6459fb793374e55b42 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 29 Sep 2021 15:21:55 -0700 -Subject: [PATCH 24/25] unvendor zlib +Subject: [PATCH 23/24] unvendor zlib --- PCbuild/pythoncore.vcxproj | 33 ++------------- @@ -9,7 +9,7 @@ Subject: [PATCH 24/25] unvendor zlib 2 files changed, 4 insertions(+), 95 deletions(-) diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj -index 5d15834900..16ccc8a349 100644 +index c4cb39c821..c1b60bd45b 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -82,7 +82,7 @@ @@ -31,15 +31,15 @@ index 5d15834900..16ccc8a349 100644 _Py_HAVE_ZLIB;%(PreprocessorDefinitions) -- version.lib;ws2_32.lib;pathcch.lib;%(AdditionalDependencies) -+ version.lib;ws2_32.lib;pathcch.lib;zlib.lib;%(AdditionalDependencies) +- version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies) ++ version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;zlib.lib;%(AdditionalDependencies) + $(condaDir)\lib;%(AdditionalLibraryDirectories) -@@ -301,19 +302,6 @@ +@@ -330,19 +331,6 @@ + - - - @@ -57,7 +57,7 @@ index 5d15834900..16ccc8a349 100644 -@@ -496,19 +484,6 @@ +@@ -542,19 +530,6 @@ @@ -78,10 +78,10 @@ index 5d15834900..16ccc8a349 100644 diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters -index 55b57ef29d..2fc1a57161 100644 +index e3fe9271dd..334cb226e2 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters -@@ -606,39 +606,6 @@ +@@ -651,39 +651,6 @@ Include\internal @@ -118,10 +118,10 @@ index 55b57ef29d..2fc1a57161 100644 - - Modules\zlib - - - - -@@ -1151,39 +1118,6 @@ + + Include\internal + +@@ -1208,39 +1175,6 @@ Modules @@ -162,5 +162,5 @@ index 55b57ef29d..2fc1a57161 100644 Python -- -2.32.1 (Apple Git-133) +2.30.2 diff --git a/recipe/patches/0025-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch b/recipe/patches/0024-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch similarity index 62% rename from recipe/patches/0025-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch rename to recipe/patches/0024-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch index a2d514c52..018d263a3 100644 --- a/recipe/patches/0025-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch +++ b/recipe/patches/0024-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch @@ -1,7 +1,7 @@ -From 03c7a620cc45b740a778415eb885497ed97e94d5 Mon Sep 17 00:00:00 2001 +From 0f8e9aef6c845d89471aa936bb2ac75996256b9b Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Wed, 16 Aug 2017 11:45:28 +0100 -Subject: [PATCH 25/25] Do not pass -g to GCC when not Py_DEBUG +Subject: [PATCH 24/24] Do not pass -g to GCC when not Py_DEBUG This bloats our exe and our modules a lot. --- @@ -10,10 +10,10 @@ This bloats our exe and our modules a lot. 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure -index 9399fe6cd8..1ff8defeec 100755 +index b89d1a380a..439493615a 100755 --- a/configure +++ b/configure -@@ -4299,9 +4299,9 @@ if test "$ac_test_CFLAGS" = set; then +@@ -4782,9 +4782,9 @@ if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -25,9 +25,9 @@ index 9399fe6cd8..1ff8defeec 100755 fi else if test "$GCC" = yes; then -@@ -7025,7 +7025,7 @@ then - OPT="-g -O0 -Wall" - fi +@@ -7934,7 +7934,7 @@ then + if test "$Py_DEBUG" = 'true' ; then + OPT="-g $PYDEBUG_CFLAGS -Wall" else - OPT="-g $WRAP -O3 -Wall" + OPT="$WRAP -O3 -Wall" @@ -35,12 +35,12 @@ index 9399fe6cd8..1ff8defeec 100755 ;; *) diff --git a/configure.ac b/configure.ac -index 3b76442881..f89cc0ff8a 100644 +index 1d9fa9e4ef..0babe7c917 100644 --- a/configure.ac +++ b/configure.ac -@@ -1584,7 +1584,7 @@ then - OPT="-g -O0 -Wall" - fi +@@ -2043,7 +2043,7 @@ then + if test "$Py_DEBUG" = 'true' ; then + OPT="-g $PYDEBUG_CFLAGS -Wall" else - OPT="-g $WRAP -O3 -Wall" + OPT="$WRAP -O3 -Wall" @@ -48,5 +48,5 @@ index 3b76442881..f89cc0ff8a 100644 ;; *) -- -2.32.1 (Apple Git-133) +2.30.2