diff --git a/recipes/cpython/all/conandata.yml b/recipes/cpython/all/conandata.yml
index 80e01a0b76111..97a5105587069 100644
--- a/recipes/cpython/all/conandata.yml
+++ b/recipes/cpython/all/conandata.yml
@@ -1,65 +1,79 @@
sources:
- "3.10.0":
- url: "https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz"
- sha256: "c4e0cbad57c90690cb813fb4663ef670b4d0f587d8171e2c42bd4c9245bd2758"
- "3.9.7":
- url: "https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz"
- sha256: "a838d3f9360d157040142b715db34f0218e535333696a5569dc6f854604eb9d1"
- "3.8.12":
- url: "https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tgz"
- sha256: "316aa33f3b7707d041e73f246efedb297a70898c4b91f127f66dc8d80c596f1a"
+ "3.12.2":
+ url: "https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz"
+ sha256: "a7c4f6a9dc423d8c328003254ab0c9338b83037bd787d680826a5bf84308116e"
+ "3.11.9":
+ url: "https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz"
+ sha256: "e7de3240a8bc2b1e1ba5c81bf943f06861ff494b69fda990ce2722a504c6153d"
+ "3.10.14":
+ url: "https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tgz"
+ sha256: "cefea32d3be89c02436711c95a45c7f8e880105514b78680c14fe76f5709a0f6"
+ "3.9.19":
+ url: "https://www.python.org/ftp/python/3.9.19/Python-3.9.19.tgz"
+ sha256: "f5f9ec8088abca9e399c3b62fd8ef31dbd2e1472c0ccb35070d4d136821aaf71"
+ "3.8.19":
+ url: "https://www.python.org/ftp/python/3.8.19/Python-3.8.19.tgz"
+ sha256: "c7fa55a36e5c7a19ec37d8f90f60a2197548908c9ac8b31e7c0dbffdd470eeac"
patches:
- "3.10.0":
- - patch_file: "patches/3.10/3.10.0-0001-msvc.patch"
- patch_description: "Version specific patches to MSVC projects to allow injection of dependencies"
+ "3.12.2":
+ - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch"
+ patch_description: "Fix ARM/ARM64 mismatch in project file"
+ patch_type: "bugfix"
+ - patch_file: "patches/3.12/3.12.1-0001-_ctypes-ffi.patch"
+ patch_description: "Support shared libffi"
+ patch_type: "portability"
+ - patch_file: "patches/3.x-0001-relocatable-python-config.patch"
+ patch_description: "Allow package to be relocatable"
+ patch_type: "conan"
+ - patch_file: "patches/3.12/3.12.1-0002-remove-module-deps.patch"
+ patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe"
+ patch_type: "conan"
+ "3.11.8":
+ - patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch"
+ patch_description: "Fix ARM/ARM64 mismatch in project file"
+ patch_type: "bugfix"
+ - patch_file: "patches/3.11/3.11.7-0001-_ctypes-ffi.patch"
+ patch_description: "Support shared libffi"
+ patch_type: "portability"
+ - patch_file: "patches/3.x-0001-relocatable-python-config.patch"
+ patch_description: "Allow package to be relocatable"
patch_type: "conan"
+ - patch_file: "patches/3.x-0002-remove-module-deps.patch"
+ patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe"
+ patch_type: "conan"
+ "3.10.14":
- patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch"
patch_description: "Fix ARM/ARM64 mismatch in project file"
patch_type: "bugfix"
- patch_file: "patches/3.10/3.10.0-0003-_ctypes-ffi.patch"
patch_description: "Remove duplicate libffi symbols and support shared libffi"
patch_type: "portability"
- - patch_file: "patches/3.10/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch"
- patch_description: "Pass C and CPP flags from configure script to setup.py"
- patch_type: "bugfix"
- - patch_file: "patches/3.10/3.10.0-0005-disable-macos-tcltk.patch"
- patch_description: "Unconditionally enable tcl/tk on Mac"
- patch_type: "conan"
- patch_file: "patches/3.x-0001-relocatable-python-config.patch"
patch_description: "Allow package to be relocatable"
patch_type: "conan"
- "3.9.7":
- - patch_file: "patches/3.9/3.9.7-0001-msvc.patch"
- patch_description: "Version specific patches to MSVC projects to allow injection of dependencies"
+ - patch_file: "patches/3.x-0002-remove-module-deps.patch"
+ patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe"
patch_type: "conan"
+ "3.9.19":
- patch_file: "patches/3.9/3.9.7-0002-_msi-vcxproj.patch"
patch_description: "Fix ARM/ARM64 mismatch in project file"
patch_type: "bugfix"
- patch_file: "patches/3.9/3.9.7-0003-_ctypes-ffi.patch"
patch_description: "Remove duplicate libffi symbols and support shared libffi"
patch_type: "portability"
- - patch_file: "patches/3.9/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch"
- patch_description: "Pass C and CPP flags from configure script to setup.py"
- patch_type: "bugfix"
- - patch_file: "patches/3.9/3.9.7-0005-disable-macos-tcltk.patch"
- patch_description: "Unconditionally enable tcl/tk on Mac"
- patch_type: "conan"
- patch_file: "patches/3.x-0001-relocatable-python-config.patch"
patch_description: "Allow package to be relocatable"
patch_type: "conan"
- "3.8.12":
- - patch_file: "patches/3.8/3.8.12-0001-msvc.patch"
- patch_description: "Version specific patches to MSVC projects to allow injection of dependencies"
+ - patch_file: "patches/3.x-0002-remove-module-deps.patch"
+ patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe"
patch_type: "conan"
+ "3.8.19":
- patch_file: "patches/3.8/3.8.12-0002-_ctypes-ffi.patch"
patch_description: "Remove duplicate libffi symbols and support shared libffi"
patch_type: "portability"
- - patch_file: "patches/3.8/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch"
- patch_description: "Pass C and CPP flags from configure script to setup.py"
- patch_type: "bugfix"
- - patch_file: "patches/3.8/3.8.12-0004-disable-macos-tcltk.patch"
- patch_description: "Unconditionally enable tcl/tk on Mac"
- patch_type: "conan"
- patch_file: "patches/3.x-0001-relocatable-python-config.patch"
patch_description: "Allow package to be relocatable"
patch_type: "conan"
+ - patch_file: "patches/3.x-0002-remove-module-deps.patch"
+ patch_description: "Remove section of solution file forcing projects to be built that might not be used for this recipe"
+ patch_type: "conan"
diff --git a/recipes/cpython/all/conanfile.py b/recipes/cpython/all/conanfile.py
index 2c579fc71772b..ee7d7fdc621f9 100644
--- a/recipes/cpython/all/conanfile.py
+++ b/recipes/cpython/all/conanfile.py
@@ -3,11 +3,11 @@
import textwrap
from conan import ConanFile
-from conan.errors import ConanInvalidConfiguration, ConanException
+from conan.errors import ConanInvalidConfiguration
from conan.tools.apple import is_apple_os, fix_apple_shared_install_name
from conan.tools.env import VirtualRunEnv
-from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, replace_in_file, rm, rmdir, unzip
-from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps
+from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, mkdir, replace_in_file, rm, rmdir, save, unzip
+from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.microsoft import MSBuildDeps, MSBuildToolchain, MSBuild, is_msvc, is_msvc_static_runtime, msvc_runtime_flag, msvs_toolset
from conan.tools.scm import Version
@@ -102,6 +102,10 @@ def configure(self):
def layout(self):
basic_layout(self, src_folder="src")
+ def build_requirements(self):
+ if Version(self.version) >= "3.11" and not is_msvc(self) and not self.conf.get("tools.gnu:pkg_config", check_type=str):
+ self.tool_requires("pkgconf/2.1.0")
+
def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")
if self._supports_modules:
@@ -116,8 +120,12 @@ def requirements(self):
if self.settings.os != "Windows":
if not is_apple_os(self):
self.requires("util-linux-libuuid/2.39.2")
- # If crypt.h is detected, it is included in the public headers.
- self.requires("libxcrypt/4.4.36", transitive_headers=True, transitive_libs=True)
+ # In <3.9 and lower patch versions of 3.9/10/11, crypt.h was exposed in Python.h
+ # This was removed in 3.11 and backported: https://github.com/python/cpython/issues/88914
+ # For the sake of this recipe, we only have later patch versions, so this version check
+ # may be slightly inaccurate if a lower patch version is desired.
+ transitive_crypt = Version(self.version) < "3.9"
+ self.requires("libxcrypt/4.4.36", transitive_headers=transitive_crypt, transitive_libs=transitive_crypt)
if self.options.get_safe("with_bz2"):
self.requires("bzip2/1.0.8")
if self.options.get_safe("with_gdbm", False):
@@ -163,6 +171,8 @@ def validate(self):
if str(self.settings.arch) not in self._msvc_archs:
raise ConanInvalidConfiguration("Visual Studio does not support this architecture")
if not self.options.shared and Version(self.version) >= "3.10":
+ # Static CPython on Windows is only loosely supported, see https://github.com/python/cpython/issues/110234
+ # 3.10 fails during the test, 3.11 fails during the build (missing symbol that seems to be DLL specific: PyWin_DLLhModule)
raise ConanInvalidConfiguration("Static msvc build disabled (>=3.10) due to \"AttributeError: module 'sys' has no attribute 'winver'\"")
if self.options.get_safe("with_curses", False) and not self.dependencies["ncurses"].options.with_widec:
@@ -173,6 +183,9 @@ def validate(self):
if self.dependencies["mpdecimal"].ref.version < Version("2.5.0"):
raise ConanInvalidConfiguration("cpython 3.9.0 (and newer) requires (at least) mpdecimal 2.5.0")
+ if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == 9 and Version(self.version) >= "3.12":
+ raise ConanInvalidConfiguration("FIXME: GCC 9 produces an internal compiler error locally, and a link error in CCI")
+
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
@@ -185,20 +198,21 @@ def _generate_autotools(self):
"--with-doc-strings={}".format(yes_no(self.options.docstrings)),
"--with-pymalloc={}".format(yes_no(self.options.pymalloc)),
"--with-system-expat",
- "--with-system-ffi",
"--enable-optimizations={}".format(yes_no(self.options.optimizations)),
"--with-lto={}".format(yes_no(self.options.lto)),
"--with-pydebug={}".format(yes_no(self.settings.build_type == "Debug")),
"--with-system-libmpdec",
"--with-openssl={}".format(self.dependencies["openssl"].package_folder),
]
+ if Version(self.version) < "3.12":
+ tc.configure_args.append("--with-system-ffi")
if Version(self.version) >= "3.10":
tc.configure_args.append("--disable-test-modules")
if self.options.get_safe("with_sqlite3"):
tc.configure_args.append("--enable-loadable-sqlite-extensions={}".format(
yes_no(not self.dependencies["sqlite3"].options.omit_load_extension)
))
- if self.options.with_tkinter:
+ if self.options.with_tkinter and Version(self.version) < "3.11":
tcltk_includes = []
tcltk_libs = []
# FIXME: collect using some conan util (https://github.com/conan-io/conan/issues/7656)
@@ -221,6 +235,9 @@ def _generate_autotools(self):
deps = AutotoolsDeps(self)
deps.generate()
+ if Version(self.version) >= "3.11":
+ pkgdeps = PkgConfigDeps(self)
+ pkgdeps.generate()
def generate(self):
VirtualRunEnv(self).generate(scope="build")
@@ -236,11 +253,166 @@ def generate(self):
else:
self._generate_autotools()
- def _patch_sources(self):
- apply_conandata_patches(self)
+ def _msvc_project_path(self, name):
+ return os.path.join(self.source_folder, "PCBuild", f"{name}.vcxproj")
+
+ def _regex_replace_in_file(self, filename, pattern, replacement):
+ content = load(self, filename)
+ content = re.sub(pattern, replacement, content)
+ save(self, filename, content)
+
+ def _inject_conan_props_file(self, project_basename, dep_name, condition=True):
+ if condition:
+ search = ''
+ replace_in_file(self,
+ self._msvc_project_path(project_basename),
+ search,
+ search + f'')
+
+ def _patch_setup_py(self):
setup_py = os.path.join(self.source_folder, "setup.py")
if Version(self.version) < "3.10":
replace_in_file(self, setup_py, ":libmpdec.so.2", "mpdec")
+
+ if self.options.get_safe("with_curses", False):
+ libcurses = self.dependencies["ncurses"].cpp_info.components["libcurses"]
+ tinfo = self.dependencies["ncurses"].cpp_info.components["tinfo"]
+ libs = libcurses.libs + libcurses.system_libs + tinfo.libs + tinfo.system_libs
+ replace_in_file(self, setup_py,
+ "curses_libs = ",
+ "curses_libs = {} #".format(repr(libs)))
+
+ if self._supports_modules:
+ openssl = self.dependencies["openssl"].cpp_info.aggregated_components()
+ zlib = self.dependencies["zlib"].cpp_info.aggregated_components()
+ if Version(self.version) < "3.11":
+ replace_in_file(self, setup_py,
+ "openssl_includes = ",
+ f"openssl_includes = {openssl.includedirs + zlib.includedirs} #")
+ replace_in_file(self, setup_py,
+ "openssl_libdirs = ",
+ f"openssl_libdirs = {openssl.libdirs + zlib.libdirs} #")
+ replace_in_file(self, setup_py,
+ "openssl_libs = ",
+ f"openssl_libs = {openssl.libs + zlib.libs} #")
+
+ if Version(self.version) < "3.11":
+ replace_in_file(self, setup_py, "if (MACOS and self.detect_tkinter_darwin())", "if (False)")
+
+ def _patch_msvc_projects(self):
+ # Don't build vendored bz2
+ self._regex_replace_in_file(self._msvc_project_path("_bz2"), r'.*Include=\"\$\(bz2Dir\).*', "")
+
+ if self._supports_modules:
+ # Don't import vendored libffi
+ replace_in_file(self, self._msvc_project_path("_ctypes"), '', "")
+ if Version(self.version) < "3.11":
+ # Don't add this define, it should be added conditionally by the libffi package
+ replace_in_file(self, self._msvc_project_path("_ctypes"), "FFI_BUILDING;", "")
+
+ # Don't import vendored openssl
+ replace_in_file(self, self._msvc_project_path("_hashlib"), '', "")
+ replace_in_file(self, self._msvc_project_path("_ssl"), '', "")
+
+ # For mpdecimal, we need to remove all headers and all c files *except* the main module file, _decimal.c
+ self._regex_replace_in_file(self._msvc_project_path("_decimal"), r'.*Include=\"\.\.\\Modules\\_decimal\\.*\.h.*', "")
+ self._regex_replace_in_file(self._msvc_project_path("_decimal"), r'.*Include=\"\.\.\\Modules\\_decimal\\libmpdec\\.*\.c.*', "")
+ # There is also an assembly file with a complicated build step as part of the mpdecimal build
+ replace_in_file(self, self._msvc_project_path("_decimal"), "", "-->")
+ # Remove extra include directory
+ replace_in_file(self, self._msvc_project_path("_decimal"), r"..\Modules\_decimal\libmpdec;", "")
+
+ # Don't include vendored sqlite3
+ replace_in_file(self, self._msvc_project_path("_sqlite3"),
+ '',
+ '')
+
+ # Remove hardcoded reference to lzma library
+ replace_in_file(self, self._msvc_project_path("_lzma"), "$(OutDir)liblzma$(PyDebugExt).lib;", "")
+ # Don't include vendored lzma
+ replace_in_file(self, self._msvc_project_path("_lzma"),
+ '',
+ '')
+
+ # Don't include vendored expat project
+ replace_in_file(self, self._msvc_project_path("pyexpat"),
+ r"$(PySourcePath)Modules\expat;",
+ "")
+ # Remove XML_STATIC, this should conditionally be set by the expat library.
+ # TODO: Why HAVE_EXPAT_H? (It is at least removed in later versions)
+ replace_in_file(self, self._msvc_project_path("pyexpat"), ("HAVE_EXPAT_H;" if Version(self.version) < "3.11" else "") + "XML_STATIC;", "")
+ self._regex_replace_in_file(self._msvc_project_path("pyexpat"), r'.*Include=\"\.\.\\Modules\\expat\\.*" />', "")
+
+ # Don't include vendored expat headers
+ replace_in_file(self, self._msvc_project_path("_elementtree"),
+ r"..\Modules\expat;",
+ "")
+ # Remove XML_STATIC, this should conditionally be set by the expat library.
+ replace_in_file(self, self._msvc_project_path("_elementtree"), "XML_STATIC;", "")
+ # Remove vendored expat
+ self._regex_replace_in_file(self._msvc_project_path("_elementtree"), r'.*Include=\"\.\.\\Modules\\expat\\.*" />', "")
+
+ if Version(self.version) >= "3.9":
+ # deflate.c has warning 4244 disabled, need special patching else it breaks the regex below
+ # Add an extra space to avoid being picked up by the regex
+ replace_in_file(self, self._msvc_project_path("pythoncore"),
+ r'',
+ r'')
+ # Don't use vendored zlib
+ self._regex_replace_in_file(self._msvc_project_path("pythoncore"), r'.*Include=\"\$\(zlibDir\).*', "")
+
+ # Don't use vendored tcl/tk include dir
+ replace_in_file(self, self._msvc_project_path("_tkinter"), "$(tcltkDir)include;", "")
+ # Don't use hardcoded tcl/tk library
+ replace_in_file(self, self._msvc_project_path("_tkinter"), "$(tcltkLib);", "")
+ # TODO: Why?
+ replace_in_file(self, self._msvc_project_path("_tkinter"),
+ "",
+ "")
+ # Don't use vendored tcl/tk
+ self._regex_replace_in_file(self._msvc_project_path("_tkinter"), r'.*Include=\"\$\(tcltkdir\).*', "")
+
+ # Disable "ValidateUcrtbase" target (TODO: Why?)
+ replace_in_file(self, self._msvc_project_path("python"), "$(Configuration) != 'PGInstrument'", "False")
+
+ if Version(self.version) < "3.11":
+ # TODO: Why?
+ replace_in_file(self, self._msvc_project_path("_freeze_importlib"),
+ "',
+ r'')
+
+ self._inject_conan_props_file("_bz2", "bzip2", self.options.get_safe("with_bz2"))
+ self._inject_conan_props_file("_elementtree", "expat", self._supports_modules)
+ self._inject_conan_props_file("pyexpat", "expat", self._supports_modules)
+ self._inject_conan_props_file("_hashlib", "openssl", self._supports_modules)
+ self._inject_conan_props_file("_ssl", "openssl", self._supports_modules)
+ self._inject_conan_props_file("_sqlite3", "sqlite3", self.options.get_safe("with_sqlite3"))
+ self._inject_conan_props_file("_tkinter", "tk", self.options.get_safe("with_tkinter"))
+ self._inject_conan_props_file("pythoncore", "zlib")
+ self._inject_conan_props_file("python", "zlib")
+ self._inject_conan_props_file("pythonw", "zlib")
+ self._inject_conan_props_file("_ctypes", "libffi", self._supports_modules)
+ self._inject_conan_props_file("_decimal", "mpdecimal", self._supports_modules)
+ self._inject_conan_props_file("_lzma", "xz_utils", self.options.get_safe("with_lzma"))
+ self._inject_conan_props_file("_bsddb", "libdb", self.options.get_safe("with_bsddb"))
+
+ def _patch_sources(self):
+ apply_conandata_patches(self)
+ # <=3.10 requires a lot of manual injection of dependencies through setup.py
+ # 3.12 removes setup.py completely, and uses pkgconfig dependencies
+ # 3.11 is an in awkward transition state where some dependencies use pkgconfig, and others use setup.py
+ if Version(self.version) < "3.12":
+ self._patch_setup_py()
+ if Version(self.version) >= "3.11":
+ replace_in_file(self, os.path.join(self.source_folder, "configure"),
+ 'OPENSSL_LIBS="-lssl -lcrypto"',
+ 'OPENSSL_LIBS="-lssl -lcrypto -lz"')
if is_msvc(self):
runtime_library = {
"MT": "MultiThreaded",
@@ -258,25 +430,10 @@ def _patch_sources(self):
rmdir(self, os.path.join(self.source_folder, "Modules", "_decimal", "libmpdec"))
rmdir(self, os.path.join(self.source_folder, "Modules", "expat"))
- if self.options.get_safe("with_curses", False):
- # FIXME: this will link to ALL libraries of ncurses. Only need to link to ncurses(w) (+ eventually tinfo)
- ncurses_info = self.dependencies["ncurses"].cpp_info.aggregated_components()
- replace_in_file(self, setup_py,
- "curses_libs = ",
- "curses_libs = {} #".format(repr(ncurses_info.libs + ncurses_info.system_libs)))
-
- if self._supports_modules:
- openssl = self.dependencies["openssl"].cpp_info.aggregated_components()
- zlib = self.dependencies["zlib"].cpp_info.aggregated_components()
- replace_in_file(self, setup_py,
- "openssl_includes = ",
- f"openssl_includes = {openssl.includedirs + zlib.includedirs} #")
- replace_in_file(self, setup_py,
- "openssl_libdirs = ",
- f"openssl_libdirs = {openssl.libdirs + zlib.libdirs} #")
- replace_in_file(self, setup_py,
- "openssl_libs = ",
- f"openssl_libs = {openssl.libs + zlib.libs} #")
+ if Version(self.version) < "3.12":
+ replace_in_file(self, os.path.join(self.source_folder, "Makefile.pre.in"),
+ "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)'",
+ "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)'")
# Enable static MSVC cpython
if not self.options.shared:
@@ -304,25 +461,6 @@ def _patch_sources(self):
"",
"Py_NO_ENABLE_SHARED;%(PreprocessorDefinitions)")
- # Don't import projects that we aren't pulling
- deps = [
- # Option suffix, base file name, conan props suffix
- ("sqlite3", "_sqlite3", "sqlite3"),
- ("tkinter", "_tkinter", "tk"),
- ("bz2", "_bz2", "bzip2"),
- ("lzma", "_lzma", "xz_utils"),
- ]
- for opt, fname, propname in deps:
- full_file = os.path.join(self.source_folder, "PCbuild", f"{fname}.vcxproj")
- if not self.options.get_safe(f"with_{opt}", default=True):
- replace_in_file(self, full_file, f'', "")
-
- # Fix props path for dependencies we are pulling
- PCBuild = os.path.join(self.source_folder, "PCbuild")
- for filename in os.listdir(PCBuild):
- if filename.endswith(".vcxproj"):
- replace_in_file(self, os.path.join(PCBuild, filename), "CONAN_REPLACE_HERE", self.generators_folder, strict=False)
-
conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename)
replace_in_file(
self, os.path.join(self.source_folder, "PCbuild", "pythoncore.vcxproj"),
@@ -330,10 +468,8 @@ def _patch_sources(self):
f'',
)
- for project in ["python", "pythonw"]:
- replace_in_file(self, os.path.join(self.source_folder, "PCbuild", f"{project}.vcxproj"),
- '',
- f'')
+ if is_msvc(self):
+ self._patch_msvc_projects()
@property
def _solution_projects(self):
@@ -522,6 +658,9 @@ def package(self):
rm(self, "vcruntime*", os.path.join(self.package_folder, "bin"), recursive=True)
else:
autotools = Autotools(self)
+ if is_apple_os(self):
+ # FIXME: See https://github.com/python/cpython/issues/109796, this workaround is mentioned there
+ autotools.make(target="sharedinstall", args=["DESTDIR="])
autotools.install(args=["DESTDIR="])
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))
@@ -631,7 +770,7 @@ def package_info(self):
"pkg_config_name", f"python-{py_version.major}.{py_version.minor}"
)
self.cpp_info.components["python"].set_property(
- "pkg_config_aliases", f"python{py_version.major}"
+ "pkg_config_aliases", [f"python{py_version.major}"]
)
self.cpp_info.components["python"].libdirs = []
@@ -643,7 +782,7 @@ def package_info(self):
"pkg_config_name", f"python-{py_version.major}.{py_version.minor}-embed"
)
self.cpp_info.components["embed"].set_property(
- "pkg_config_aliases", f"python{py_version.major}-embed"
+ "pkg_config_aliases", [f"python{py_version.major}-embed"]
)
self.cpp_info.components["embed"].requires = ["python"]
diff --git a/recipes/cpython/all/patches/3.10/3.10.0-0001-msvc.patch b/recipes/cpython/all/patches/3.10/3.10.0-0001-msvc.patch
deleted file mode 100644
index 9884e12e53f1e..0000000000000
--- a/recipes/cpython/all/patches/3.10/3.10.0-0001-msvc.patch
+++ /dev/null
@@ -1,416 +0,0 @@
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -58,2 +58,0 @@
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
--EndProject
---- PCbuild/python.vcxproj
-+++ PCbuild/python.vcxproj
-@@ -120,1 +120,1 @@
--
-+
---- PCbuild/_freeze_importlib.vcxproj
-+++ PCbuild/_freeze_importlib.vcxproj
-@@ -151,1 +151,1 @@
--
-+ -->
---- PCbuild/_bz2.vcxproj
-+++ PCbuild/_bz2.vcxproj
-@@ -71,7 +71,7 @@
- bz2
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -101,17 +101,17 @@
-
-
-
--
-+
-
-
--
--
-+
-
-
-
---- PCbuild/_ctypes.vcxproj
-+++ PCbuild/_ctypes.vcxproj
-@@ -71,7 +71,7 @@
- _ctypes
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -94,7 +94,7 @@
-
-
-
-- FFI_BUILDING;%(PreprocessorDefinitions)
-+ %(PreprocessorDefinitions)
-
-
- /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)
---- PCbuild/_decimal.vcxproj
-+++ PCbuild/_decimal.vcxproj
-@@ -71,7 +71,7 @@
- _decimal
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -98,11 +98,11 @@
- CONFIG_32;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;MASM;%(PreprocessorDefinitions)
-- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)
-+ ..\Modules\_decimal;%(AdditionalIncludeDirectories)
-
-
-
--
-+
-
-
-
--
-+
-
-
--
-+
-
-
-
---- PCbuild/_lzma.vcxproj
-+++ PCbuild/_lzma.vcxproj
-@@ -71,7 +71,7 @@
- lzma
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -94,10 +94,10 @@
-
-
- $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)
-- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-
-
-- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -111,10 +111,10 @@
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
- false
-
--
-+
-
-
-
---- PCbuild/_sqlite3.vcxproj
-+++ PCbuild/_sqlite3.vcxproj
-@@ -74,1 +74,1 @@
--
-+
-@@ -129,4 +129,4 @@
--
-+
---- PCbuild/pythoncore.vcxproj
-+++ PCbuild/pythoncore.vcxproj
-@@ -73,1 +73,1 @@
--
-+
-@@ -302,7 +302,7 @@
-
-
-
--
-+
-
-
-
-@@ -496,7 +496,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_hashlib.vcxproj
-+++ PCbuild/_hashlib.vcxproj
-@@ -71,7 +71,7 @@
- _hashlib
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_ssl.vcxproj
-+++ PCbuild/_ssl.vcxproj
-@@ -71,7 +71,7 @@
- _ssl
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -99,9 +99,9 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_elementtree.vcxproj
-+++ PCbuild/_elementtree.vcxproj
-@@ -71,7 +71,7 @@
- _elementtree
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -93,12 +93,12 @@
-
-
-
-- ..\Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions)
-+ %(AdditionalIncludeDirectories)
-+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions)
-
-
-
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/pyexpat.vcxproj
-+++ PCbuild/pyexpat.vcxproj
-@@ -71,7 +71,7 @@
- {D06B6426-4762-44CC-8BAD-D79052507F2F}
- pyexpat
-
--
-+
-
-
- DynamicLibrary
-@@ -90,19 +90,19 @@
-
-
-
-- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)
-+ %(AdditionalIncludeDirectories)
-+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;%(PreprocessorDefinitions)
-
-
-
--
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/_tkinter.vcxproj
-+++ PCbuild/_tkinter.vcxproj
-@@ -77,7 +77,7 @@
- DynamicLibrary
- NotSet
-
--
-+
-
- .pyd
-
-@@ -93,12 +93,12 @@
-
-
-
-- $(tcltkDir)include;%(AdditionalIncludeDirectories)
-+ %(AdditionalIncludeDirectories)
- WITH_APPINIT;%(PreprocessorDefinitions)
-- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions)
-+
-
-
-- $(tcltkLib);%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -108,10 +108,10 @@
-
-
-
--
-+
-
-
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -9,9 +9,6 @@
- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}"
-- ProjectSection(ProjectDependencies) = postProject
-- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618}
-- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
- EndProject
diff --git a/recipes/cpython/all/patches/3.10/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.10/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch
deleted file mode 100644
index 0288bdae92ee9..0000000000000
--- a/recipes/cpython/all/patches/3.10/3.10.0-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- Makefile.pre.in
-+++ Makefile.pre.in
-@@ -627,10 +627,10 @@
- *\ -s*|s*) quiet="-q";; \
- *) quiet="";; \
- esac; \
-- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
-- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-
diff --git a/recipes/cpython/all/patches/3.10/3.10.0-0005-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.10/3.10.0-0005-disable-macos-tcltk.patch
deleted file mode 100644
index ec23890e0a717..0000000000000
--- a/recipes/cpython/all/patches/3.10/3.10.0-0005-disable-macos-tcltk.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- setup.py
-+++ setup.py
-@@ -2094,8 +2094,8 @@
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
-- if (MACOS and self.detect_tkinter_darwin()):
-- return True
-+ #if (MACOS and self.detect_tkinter_darwin()):
-+ # return True
-
- # Assume we haven't found any of the libraries or include files
- # The versions with dots are used on Unix, and the versions without
diff --git a/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch
new file mode 100644
index 0000000000000..65027b60406fd
--- /dev/null
+++ b/recipes/cpython/all/patches/3.11/3.11.7-0001-_ctypes-ffi.patch
@@ -0,0 +1,37 @@
+diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
+index 9bdf1db856..799f99e809 100644
+--- a/Modules/_ctypes/cfield.c
++++ b/Modules/_ctypes/cfield.c
+@@ -1473,7 +1473,11 @@ P_get(void *ptr, Py_ssize_t size)
+ return PyLong_FromVoidPtr(*(void **)ptr);
+ }
+
+-static struct fielddesc formattable[] = {
++#define FORMATTABLE_SIZE 30
++static struct fielddesc formattable[FORMATTABLE_SIZE];
++
++static void formattable_init(void) {
++struct fielddesc my_formattable[] = {
+ { 's', s_set, s_get, NULL},
+ { 'b', b_set, b_get, NULL},
+ { 'B', B_set, B_get, NULL},
+@@ -1510,6 +1514,11 @@ static struct fielddesc formattable[] = {
+ { 'O', O_set, O_get, NULL},
+ { 0, NULL, NULL, NULL},
+ };
++ size_t nb = 1;
++ for (struct fielddesc *pos = my_formattable; pos->code; ++pos, ++nb);
++ if (FORMATTABLE_SIZE < nb) abort();
++ memcpy(formattable, my_formattable, nb * sizeof(struct fielddesc));
++}
+
+ /*
+ Ideas: Implement VARIANT in this table, using 'V' code.
+@@ -1597,6 +1606,7 @@ _ctypes_get_fielddesc(const char *fmt)
+
+ if (!initialized) {
+ initialized = 1;
++ formattable_init();
+ _ctypes_init_fielddesc();
+ }
+
diff --git a/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch b/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch
new file mode 100644
index 0000000000000..06bb62c5abd9f
--- /dev/null
+++ b/recipes/cpython/all/patches/3.12/3.12.1-0001-_ctypes-ffi.patch
@@ -0,0 +1,37 @@
+diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
+index 128506a9ee..ee9ade67b8 100644
+--- a/Modules/_ctypes/cfield.c
++++ b/Modules/_ctypes/cfield.c
+@@ -1448,7 +1448,11 @@ P_get(void *ptr, Py_ssize_t size)
+ return PyLong_FromVoidPtr(*(void **)ptr);
+ }
+
+-static struct fielddesc formattable[] = {
++#define FORMATTABLE_SIZE 30
++static struct fielddesc formattable[FORMATTABLE_SIZE];
++
++static void formattable_init(void) {
++struct fielddesc my_formattable[] = {
+ { 's', s_set, s_get, NULL},
+ { 'b', b_set, b_get, NULL},
+ { 'B', B_set, B_get, NULL},
+@@ -1485,6 +1489,11 @@ static struct fielddesc formattable[] = {
+ { 'O', O_set, O_get, NULL},
+ { 0, NULL, NULL, NULL},
+ };
++ size_t nb = 1;
++ for (struct fielddesc *pos = my_formattable; pos->code; ++pos, ++nb);
++ if (FORMATTABLE_SIZE < nb) abort();
++ memcpy(formattable, my_formattable, nb * sizeof(struct fielddesc));
++}
+
+ /*
+ Ideas: Implement VARIANT in this table, using 'V' code.
+@@ -1572,6 +1581,7 @@ _ctypes_get_fielddesc(const char *fmt)
+
+ if (!initialized) {
+ initialized = 1;
++ formattable_init();
+ _ctypes_init_fielddesc();
+ }
+
diff --git a/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch b/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch
new file mode 100644
index 0000000000000..1d9d31f011d72
--- /dev/null
+++ b/recipes/cpython/all/patches/3.12/3.12.1-0002-remove-module-deps.patch
@@ -0,0 +1,50 @@
+diff --git a/PCbuild/pcbuild.sln b/PCbuild/pcbuild.sln
+index bdddec60da..f6a30955bf 100644
+--- a/PCbuild/pcbuild.sln
++++ b/PCbuild/pcbuild.sln
+@@ -9,45 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
+ EndProjectSection
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}"
+- ProjectSection(ProjectDependencies) = postProject
+- {9E48B300-37D1-11DD-8C41-005056C00008} = {9E48B300-37D1-11DD-8C41-005056C00008}
+- {9EC7190A-249F-4180-A900-548FDCF3055F} = {9EC7190A-249F-4180-A900-548FDCF3055F}
+- {78D80A15-BD8C-44E2-B49E-1F05B0A0A687} = {78D80A15-BD8C-44E2-B49E-1F05B0A0A687}
+- {6901D91C-6E48-4BB7-9FEC-700C8131DF1D} = {6901D91C-6E48-4BB7-9FEC-700C8131DF1D}
+- {54B1431F-B86B-4ACB-B28C-88BCF93191D8} = {54B1431F-B86B-4ACB-B28C-88BCF93191D8}
+- {F749B822-B489-4CA5-A3AD-CE078F5F338A} = {F749B822-B489-4CA5-A3AD-CE078F5F338A}
+- {D06B6426-4762-44CC-8BAD-D79052507F2F} = {D06B6426-4762-44CC-8BAD-D79052507F2F}
+- {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781} = {36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}
+- {CB435430-EBB1-478B-8F4E-C256F6838F55} = {CB435430-EBB1-478B-8F4E-C256F6838F55}
+- {17E1E049-C309-4D79-843F-AE483C264AEA} = {17E1E049-C309-4D79-843F-AE483C264AEA}
+- {384C224A-7474-476E-A01B-750EA7DE918C} = {384C224A-7474-476E-A01B-750EA7DE918C}
+- {12728250-16EC-4DC6-94D7-E21DD88947F8} = {12728250-16EC-4DC6-94D7-E21DD88947F8}
+- {86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480}
+- {28B5D777-DDF2-4B6B-B34F-31D938813856} = {28B5D777-DDF2-4B6B-B34F-31D938813856}
+- {31FFC478-7B4A-43E8-9954-8D03E2187E9C} = {31FFC478-7B4A-43E8-9954-8D03E2187E9C}
+- {F9D71780-F393-11E0-BE50-0800200C9A66} = {F9D71780-F393-11E0-BE50-0800200C9A66}
+- {494BAC80-A60C-43A9-99E7-ACB691CE2C4D} = {494BAC80-A60C-43A9-99E7-ACB691CE2C4D}
+- {C6E20F84-3247-4AD6-B051-B073268F73BA} = {C6E20F84-3247-4AD6-B051-B073268F73BA}
+- {B244E787-C445-441C-BDF4-5A4F1A3A1E51} = {B244E787-C445-441C-BDF4-5A4F1A3A1E51}
+- {18CAE28C-B454-46C1-87A0-493D91D97F03} = {18CAE28C-B454-46C1-87A0-493D91D97F03}
+- {13CECB97-4119-4316-9D42-8534019A5A44} = {13CECB97-4119-4316-9D42-8534019A5A44}
+- {885D4898-D08D-4091-9C40-C700CFE3FC5A} = {885D4898-D08D-4091-9C40-C700CFE3FC5A}
+- {447F05A8-F581-4CAC-A466-5AC7936E207E} = {447F05A8-F581-4CAC-A466-5AC7936E207E}
+- {ECC7CEAC-A5E5-458E-BB9E-2413CC847881} = {ECC7CEAC-A5E5-458E-BB9E-2413CC847881}
+- {4946ECAC-2E69-4BF8-A90A-F5136F5094DF} = {4946ECAC-2E69-4BF8-A90A-F5136F5094DF}
+- {FDB84CBB-2FB6-47C8-A2D6-091E0833239D} = {FDB84CBB-2FB6-47C8-A2D6-091E0833239D}
+- {73FCD2BD-F133-46B7-8EC1-144CD82A59D5} = {73FCD2BD-F133-46B7-8EC1-144CD82A59D5}
+- {2097F1C1-597C-4167-93E3-656A7D6339B2} = {2097F1C1-597C-4167-93E3-656A7D6339B2}
+- {A2697BD3-28C1-4AEC-9106-8B748639FD16} = {A2697BD3-28C1-4AEC-9106-8B748639FD16}
+- {900342D7-516A-4469-B1AD-59A66E49A25F} = {900342D7-516A-4469-B1AD-59A66E49A25F}
+- {6DAC66D9-E703-4624-BE03-49112AB5AA62} = {6DAC66D9-E703-4624-BE03-49112AB5AA62}
+- {0E9791DB-593A-465F-98BC-681011311617} = {0E9791DB-593A-465F-98BC-681011311617}
+- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618}
+- {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E} = {EB6E69DD-04BF-4543-9B92-49FAABCEAC2E}
+- {16BFE6F0-22EF-40B5-B831-7E937119EF10} = {16BFE6F0-22EF-40B5-B831-7E937119EF10}
+- {FCBE1EF2-E0F0-40B1-88B5-00A35D378742} = {FCBE1EF2-E0F0-40B1-88B5-00A35D378742}
+- {A840DDFB-ED50-484B-B527-B32E7CF90FD5} = {A840DDFB-ED50-484B-B527-B32E7CF90FD5}
+- EndProjectSection
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
+ ProjectSection(ProjectDependencies) = postProject
diff --git a/recipes/cpython/all/patches/3.8/3.8.12-0001-msvc.patch b/recipes/cpython/all/patches/3.8/3.8.12-0001-msvc.patch
deleted file mode 100644
index 3e4f2d86c5335..0000000000000
--- a/recipes/cpython/all/patches/3.8/3.8.12-0001-msvc.patch
+++ /dev/null
@@ -1,431 +0,0 @@
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -60,2 +60,0 @@
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
--EndProject
---- PCbuild/python.vcxproj
-+++ PCbuild/python.vcxproj
-@@ -118,1 +118,1 @@
--
-+
---- PCbuild/_freeze_importlib.vcxproj
-+++ PCbuild/_freeze_importlib.vcxproj
-@@ -149,1 +149,1 @@
--
-+ -->
---- PCbuild/_bz2.vcxproj
-+++ PCbuild/_bz2.vcxproj
-@@ -71,7 +71,7 @@
- bz2
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -101,17 +101,17 @@
-
-
-
--
-+
-
-
--
--
-+
-
-
-
---- PCbuild/_ctypes.vcxproj
-+++ PCbuild/_ctypes.vcxproj
-@@ -71,7 +71,7 @@
- _ctypes
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -94,7 +94,7 @@
-
-
-
-- FFI_BUILDING;%(PreprocessorDefinitions)
-+ %(PreprocessorDefinitions)
-
-
- /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)
---- PCbuild/_decimal.vcxproj
-+++ PCbuild/_decimal.vcxproj
-@@ -71,7 +71,7 @@
- _decimal
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -98,11 +98,11 @@
- CONFIG_32;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;%(PreprocessorDefinitions)
-- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)
-+ ..\Modules\_decimal;%(AdditionalIncludeDirectories)
-
-
-
--
-+
-
-
-
--
-+
-
-
--
-+
-
-
-
---- PCbuild/_lzma.vcxproj
-+++ PCbuild/_lzma.vcxproj
-@@ -71,7 +71,7 @@
- lzma
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -94,10 +94,10 @@
-
-
- $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)
-- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-
-
-- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -111,10 +111,10 @@
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
- false
-
--
-+
-
-
-
---- PCbuild/_sqlite3.vcxproj
-+++ PCbuild/_sqlite3.vcxproj
-@@ -71,7 +71,7 @@
- _sqlite3
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -127,10 +127,10 @@
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
- false
-
--
-+
-
-
-
---- PCbuild/pythoncore.vcxproj
-+++ PCbuild/pythoncore.vcxproj
-@@ -70,7 +70,7 @@
- {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- pythoncore
-
--
-+
-
-
- DynamicLibrary
-@@ -272,7 +272,7 @@
-
-
-
--
-+
-
-
-
-@@ -468,7 +468,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_hashlib.vcxproj
-+++ PCbuild/_hashlib.vcxproj
-@@ -71,7 +71,7 @@
- _hashlib
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_ssl.vcxproj
-+++ PCbuild/_ssl.vcxproj
-@@ -71,7 +71,7 @@
- _ssl
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -99,9 +99,9 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_elementtree.vcxproj
-+++ PCbuild/_elementtree.vcxproj
-@@ -71,7 +71,7 @@
- _elementtree
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -93,12 +93,12 @@
-
-
-
-- ..\Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions)
-+ %(AdditionalIncludeDirectories)
-+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions)
-
-
-
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/pyexpat.vcxproj
-+++ PCbuild/pyexpat.vcxproj
-@@ -71,7 +71,7 @@
- {D06B6426-4762-44CC-8BAD-D79052507F2F}
- pyexpat
-
--
-+
-
-
- DynamicLibrary
-@@ -91,18 +91,18 @@
-
-
- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)
-+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;%(PreprocessorDefinitions)
-
-
-
--
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/_tkinter.vcxproj
-+++ PCbuild/_tkinter.vcxproj
-@@ -77,7 +77,7 @@
- DynamicLibrary
- NotSet
-
--
-+
-
- .pyd
-
-@@ -93,12 +93,12 @@
-
-
-
-- $(tcltkDir)include;%(AdditionalIncludeDirectories)
-+ %(AdditionalIncludeDirectories)
- WITH_APPINIT;%(PreprocessorDefinitions)
-- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions)
-+
-
-
-- $(tcltkLib);%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -108,10 +108,10 @@
-
-
-
--
-+
-
-
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -9,9 +9,6 @@
- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}"
-- ProjectSection(ProjectDependencies) = postProject
-- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618}
-- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
- EndProject
diff --git a/recipes/cpython/all/patches/3.8/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.8/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch
deleted file mode 100644
index 21527d0ed307f..0000000000000
--- a/recipes/cpython/all/patches/3.8/3.8.12-0003-setup.py-pass-CFLAGS-CPPFLAGS.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- Makefile.pre.in
-+++ Makefile.pre.in
-@@ -606,10 +606,10 @@
- *\ -s*|s*) quiet="-q";; \
- *) quiet="";; \
- esac; \
-- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
-- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-
diff --git a/recipes/cpython/all/patches/3.8/3.8.12-0004-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.8/3.8.12-0004-disable-macos-tcltk.patch
deleted file mode 100644
index 90af822b58070..0000000000000
--- a/recipes/cpython/all/patches/3.8/3.8.12-0004-disable-macos-tcltk.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- setup.py
-+++ setup.py
-@@ -1838,8 +1838,8 @@
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
-- if (MACOS and self.detect_tkinter_darwin()):
-- return True
-+ #if (MACOS and self.detect_tkinter_darwin()):
-+ # return True
-
- # Assume we haven't found any of the libraries or include files
- # The versions with dots are used on Unix, and the versions without
diff --git a/recipes/cpython/all/patches/3.9/3.9.7-0001-msvc.patch b/recipes/cpython/all/patches/3.9/3.9.7-0001-msvc.patch
deleted file mode 100644
index 0c65a84205152..0000000000000
--- a/recipes/cpython/all/patches/3.9/3.9.7-0001-msvc.patch
+++ /dev/null
@@ -1,434 +0,0 @@
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -60,2 +60,0 @@
--Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcxproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
--EndProject
---- PCbuild/python.vcxproj
-+++ PCbuild/python.vcxproj
-@@ -118,1 +118,1 @@
--
-+
---- PCbuild/_freeze_importlib.vcxproj
-+++ PCbuild/_freeze_importlib.vcxproj
-@@ -149,1 +149,1 @@
--
-+ -->
---- PCbuild/_bz2.vcxproj
-+++ PCbuild/_bz2.vcxproj
-@@ -71,7 +71,7 @@
- bz2
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -101,17 +101,17 @@
-
-
-
--
-+
-
-
--
--
-+
-
-
-
---- PCbuild/_ctypes.vcxproj
-+++ PCbuild/_ctypes.vcxproj
-@@ -71,7 +71,7 @@
- _ctypes
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -94,7 +94,7 @@
-
-
-
-- FFI_BUILDING;%(PreprocessorDefinitions)
-+ %(PreprocessorDefinitions)
-
-
- /EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)
---- PCbuild/_decimal.vcxproj
-+++ PCbuild/_decimal.vcxproj
-@@ -71,7 +71,7 @@
- _decimal
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -98,11 +98,11 @@
- CONFIG_32;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;ANSI;%(PreprocessorDefinitions)
- CONFIG_64;%(PreprocessorDefinitions)
-- ..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)
-+ ..\Modules\_decimal;%(AdditionalIncludeDirectories)
-
-
-
--
-+
-
-
-
--
-+
-
-
--
-+
-
-
-
---- PCbuild/_lzma.vcxproj
-+++ PCbuild/_lzma.vcxproj
-@@ -71,7 +71,7 @@
- lzma
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -94,10 +94,10 @@
-
-
- $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)
-- WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-+ $(ConanPreprocessorDefinitions);WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
-
-
-- $(OutDir)liblzma$(PyDebugExt).lib;%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -111,10 +111,10 @@
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
- false
-
--
-+
-
-
-
---- PCbuild/_sqlite3.vcxproj
-+++ PCbuild/_sqlite3.vcxproj
-@@ -71,7 +71,7 @@
- _sqlite3
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -127,10 +127,10 @@
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
- false
-
--
-+
-
-
-
---- PCbuild/pythoncore.vcxproj
-+++ PCbuild/pythoncore.vcxproj
-@@ -70,7 +70,7 @@
- {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
- pythoncore
-
--
-+
-
-
- DynamicLibrary
-@@ -295,7 +295,7 @@
-
-
-
--
-+
-
-
-
-@@ -497,7 +497,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_hashlib.vcxproj
-+++ PCbuild/_hashlib.vcxproj
-@@ -71,7 +71,7 @@
- _hashlib
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_ssl.vcxproj
-+++ PCbuild/_ssl.vcxproj
-@@ -71,7 +71,7 @@
- _ssl
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -86,7 +86,7 @@
-
-
-
--
-+
-
-
-
-@@ -99,9 +99,9 @@
-
-
-
--
-+
-
-
-
---- PCbuild/_elementtree.vcxproj
-+++ PCbuild/_elementtree.vcxproj
-@@ -71,7 +71,7 @@
- _elementtree
- Win32Proj
-
--
-+
-
-
- DynamicLibrary
-@@ -93,12 +93,12 @@
-
-
-
-- ..\Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions)
-+ %(AdditionalIncludeDirectories)
-+ _CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;%(PreprocessorDefinitions)
-
-
-
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/pyexpat.vcxproj
-+++ PCbuild/pyexpat.vcxproj
-@@ -71,7 +71,7 @@
- {D06B6426-4762-44CC-8BAD-D79052507F2F}
- pyexpat
-
--
-+
-
-
- DynamicLibrary
-@@ -90,19 +90,19 @@
-
-
-
-- $(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)
-- _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)
-+ %(AdditionalIncludeDirectories)
-+ _CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;%(PreprocessorDefinitions)
-
-
-
--
--
-+
-
-
-
--
-+
-
-
-
---- PCbuild/_tkinter.vcxproj
-+++ PCbuild/_tkinter.vcxproj
-@@ -77,7 +77,7 @@
- DynamicLibrary
- NotSet
-
--
-+
-
- .pyd
-
-@@ -93,12 +93,12 @@
-
-
-
-- $(tcltkDir)include;%(AdditionalIncludeDirectories)
-+ %(AdditionalIncludeDirectories)
- WITH_APPINIT;%(PreprocessorDefinitions)
-- Py_TCLTK_DIR="$(tcltkDir.TrimEnd('\').Replace('\', '\\'))";%(PreprocessorDefinitions)
-+
-
-
-- $(tcltkLib);%(AdditionalDependencies)
-+ %(AdditionalDependencies)
-
-
-
-@@ -108,10 +108,10 @@
-
-
-
--
-+
-
-
- {cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
---- PCbuild/pcbuild.sln
-+++ PCbuild/pcbuild.sln
-@@ -9,9 +9,6 @@
- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}"
-- ProjectSection(ProjectDependencies) = postProject
-- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618}
-- EndProjectSection
- EndProject
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcxproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
- EndProject
diff --git a/recipes/cpython/all/patches/3.9/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch b/recipes/cpython/all/patches/3.9/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch
deleted file mode 100644
index 0bec735b3653d..0000000000000
--- a/recipes/cpython/all/patches/3.9/3.9.7-0004-setup.py-pass-CFLAGS-CPPFLAGS.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- Makefile.pre.in
-+++ Makefile.pre.in
-@@ -630,10 +630,10 @@
- *\ -s*|s*) quiet="-q";; \
- *) quiet="";; \
- esac; \
-- echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ echo "$(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
-- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
-+ $(RUNSHARED) CC='$(CC) $(CONFIGURE_CFLAGS) $(CONFIGURE_CPPFLAGS)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
- _TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
- $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
-
diff --git a/recipes/cpython/all/patches/3.9/3.9.7-0005-disable-macos-tcltk.patch b/recipes/cpython/all/patches/3.9/3.9.7-0005-disable-macos-tcltk.patch
deleted file mode 100644
index 68a48853b3089..0000000000000
--- a/recipes/cpython/all/patches/3.9/3.9.7-0005-disable-macos-tcltk.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- setup.py
-+++ setup.py
-@@ -1986,8 +1986,8 @@
- # Rather than complicate the code below, detecting and building
- # AquaTk is a separate method. Only one Tkinter will be built on
- # Darwin - either AquaTk, if it is found, or X11 based Tk.
-- if (MACOS and self.detect_tkinter_darwin()):
-- return True
-+ #if (MACOS and self.detect_tkinter_darwin()):
-+ # return True
-
- # Assume we haven't found any of the libraries or include files
- # The versions with dots are used on Unix, and the versions without
diff --git a/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch b/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch
new file mode 100644
index 0000000000000..38a642520abb1
--- /dev/null
+++ b/recipes/cpython/all/patches/3.x-0002-remove-module-deps.patch
@@ -0,0 +1,10 @@
+--- PCbuild/pcbuild.sln
++++ PCbuild/pcbuild.sln
+@@ -9,7 +9,4 @@
+ EndProjectSection
+ EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "python", "python.vcxproj", "{B11D750F-CD1F-4A96-85CE-E69A5C5259F9}"
+- ProjectSection(ProjectDependencies) = postProject
+- {0E9791DB-593A-465F-98BC-681011311618} = {0E9791DB-593A-465F-98BC-681011311618}
+- EndProjectSection
+ EndProject
diff --git a/recipes/cpython/all/test_package/conanfile.py b/recipes/cpython/all/test_package/conanfile.py
index bca7c7fcfd3b7..14cdda464a3d6 100644
--- a/recipes/cpython/all/test_package/conanfile.py
+++ b/recipes/cpython/all/test_package/conanfile.py
@@ -53,6 +53,12 @@ def _py_version(self):
else:
return Version(self.deps_cpp_info["cpython"].version)
+ @property
+ def _test_setuptools(self):
+ # TODO Should we still try to test this?
+ # https://github.com/python/cpython/pull/101039
+ return can_run(self) and self._supports_modules and self._py_version < "3.12"
+
@property
def _cmake_try_FindPythonX(self):
return not is_msvc(self) or self.settings.build_type != "Debug"
@@ -92,15 +98,17 @@ def generate(self):
# The build also needs access to the run environment to run the python executable
VirtualRunEnv(self).generate(scope="run")
VirtualRunEnv(self).generate(scope="build")
- # Just for the distutils build
- AutotoolsDeps(self).generate(scope="build")
+
+ if self._test_setuptools:
+ # Just for the distutils build
+ AutotoolsDeps(self).generate(scope="build")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
- if can_run(self) and self._supports_modules:
+ if self._test_setuptools:
os.environ["DISTUTILS_USE_SDK"] = "1"
os.environ["MSSdk"] = "1"
setup_args = [
@@ -122,7 +130,7 @@ def build(self):
def _test_module(self, module, should_work):
try:
- self.run(f"{self._python} {self.source_folder}/test_package.py -b {self.build_folder} -t {module}", env="conanrun")
+ self.run(f"{self._python} \"{self.source_folder}/test_package.py\" -b \"{self.build_folder}\" -t {module}", env="conanrun")
except ConanException:
if should_work:
self.output.warning(f"Module '{module}' does not work, but should have worked")
@@ -177,9 +185,10 @@ def test(self):
self.output.info("Testing module (spam) using cmake built module")
self._test_module("spam", True)
- os.environ["PYTHONPATH"] = os.path.join(self.build_folder, "lib_setuptools")
- self.output.info("Testing module (spam) using setup.py built module")
- self._test_module("spam", True)
+ if self._test_setuptools:
+ os.environ["PYTHONPATH"] = os.path.join(self.build_folder, "lib_setuptools")
+ self.output.info("Testing module (spam) using setup.py built module")
+ self._test_module("spam", True)
del os.environ["PYTHONPATH"]
diff --git a/recipes/cpython/all/test_package/test_package.c b/recipes/cpython/all/test_package/test_package.c
index f5dfe41cd757c..cf1688e39502a 100644
--- a/recipes/cpython/all/test_package/test_package.c
+++ b/recipes/cpython/all/test_package/test_package.c
@@ -9,7 +9,6 @@ main(int argc, char *argv[])
fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
exit(1);
}
- Py_SetProgramName(program); /* optional but recommended */
Py_Initialize();
PyRun_SimpleString("from time import time, ctime\n"
"print('Today is', ctime(time()))\n");
diff --git a/recipes/cpython/all/test_v1_package/conanfile.py b/recipes/cpython/all/test_v1_package/conanfile.py
index b79e5742735f3..2fdcf049eb972 100644
--- a/recipes/cpython/all/test_v1_package/conanfile.py
+++ b/recipes/cpython/all/test_v1_package/conanfile.py
@@ -13,6 +13,12 @@ class TestPackageConan(ConanFile):
def _py_version(self):
return re.match(r"^([0-9.]+)", self.deps_cpp_info["cpython"].version).group(1)
+ @property
+ def _test_setuptools(self):
+ # TODO Should we still try to test this?
+ # https://github.com/python/cpython/pull/101039
+ return not tools.cross_building(self, skip_x64_x86=True) and self._supports_modules and self._py_version < tools.Version("3.12")
+
@property
def _cmake_try_FindPythonX(self):
if self.settings.compiler == "Visual Studio" and self.settings.build_type == "Debug":
@@ -63,34 +69,33 @@ def build(self):
cmake.configure()
cmake.build()
- if not tools.cross_building(self, skip_x64_x86=True):
- if self._supports_modules:
- with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op():
- env = {
- "DISTUTILS_USE_SDK": "1",
- "MSSdk": "1"
- }
- env.update(**AutoToolsBuildEnvironment(self).vars)
- with tools.environment_append(env):
- setup_args = [
- os.path.join(self.source_folder, "..", "test_package", "setup.py"),
- "build",
- "--build-base", self.build_folder,
- "--build-platlib", os.path.join(self.build_folder, "lib_setuptools"),
- # Bandaid fix: setuptools places temporary files in a subdirectory of the build folder where the
- # entirety of the absolute path up to this folder is appended (with seemingly no way to stop this),
- # essentially doubling the path length. This may run into Windows max path lengths, so we give ourselves
- # a little bit of wiggle room by making this directory name as short as possible. One of the directory
- # names goes from (for example) "temp.win-amd64-3.10-pydebug" to "t", saving us roughly 25 characters.
- "--build-temp", "t",
- ]
- if self.settings.build_type == "Debug":
- setup_args.append("--debug")
- self.run("{} {}".format(self.deps_user_info["cpython"].python, " ".join("\"{}\"".format(a) for a in setup_args)), run_environment=True)
+ if self._test_setuptools:
+ with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op():
+ env = {
+ "DISTUTILS_USE_SDK": "1",
+ "MSSdk": "1"
+ }
+ env.update(**AutoToolsBuildEnvironment(self).vars)
+ with tools.environment_append(env):
+ setup_args = [
+ os.path.join(self.source_folder, "..", "test_package", "setup.py"),
+ "build",
+ "--build-base", self.build_folder,
+ "--build-platlib", os.path.join(self.build_folder, "lib_setuptools"),
+ # Bandaid fix: setuptools places temporary files in a subdirectory of the build folder where the
+ # entirety of the absolute path up to this folder is appended (with seemingly no way to stop this),
+ # essentially doubling the path length. This may run into Windows max path lengths, so we give ourselves
+ # a little bit of wiggle room by making this directory name as short as possible. One of the directory
+ # names goes from (for example) "temp.win-amd64-3.10-pydebug" to "t", saving us roughly 25 characters.
+ "--build-temp", "t",
+ ]
+ if self.settings.build_type == "Debug":
+ setup_args.append("--debug")
+ self.run("{} {}".format(self.deps_user_info["cpython"].python, " ".join("\"{}\"".format(a) for a in setup_args)), run_environment=True)
def _test_module(self, module, should_work):
try:
- self.run("{} {}/../test_package/test_package.py -b {} -t {} ".format(
+ self.run("{} \"{}/../test_package/test_package.py\" -b \"{}\" -t {} ".format(
self.deps_user_info["cpython"].python, self.source_folder, self.build_folder, module), run_environment=True)
works = True
except ConanException as e:
@@ -143,10 +148,11 @@ def test(self):
with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib")]}):
self.output.info("Testing module (spam) using cmake built module")
self._test_module("spam", True)
-
- with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib_setuptools")]}):
- self.output.info("Testing module (spam) using setup.py built module")
- self._test_module("spam", True)
+
+ if self._test_setuptools:
+ with tools.environment_append({"PYTHONPATH": [os.path.join(self.build_folder, "lib_setuptools")]}):
+ self.output.info("Testing module (spam) using setup.py built module")
+ self._test_module("spam", True)
# MSVC builds need PYTHONHOME set. Linux and Mac don't require it to be set if tested after building,
# but if the package is relocated then it needs to be set.
diff --git a/recipes/cpython/config.yml b/recipes/cpython/config.yml
index cce5cc26948d6..87dabe8bf898b 100644
--- a/recipes/cpython/config.yml
+++ b/recipes/cpython/config.yml
@@ -1,7 +1,11 @@
versions:
- "3.10.0":
+ "3.12.2":
folder: "all"
- "3.9.7":
+ "3.11.9":
folder: "all"
- "3.8.12":
+ "3.10.14":
+ folder: "all"
+ "3.9.19":
+ folder: "all"
+ "3.8.19":
folder: "all"