Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions recipe/build_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,15 @@ else
DBG=
fi

if [[ ${PY_GIL_DISABLED} == yes ]]; then
# This Python will not be usable with non-free threading Python modules.
THREAD=t
else
THREAD=
fi

ABIFLAGS=${DBG}
VERABI=${VER}${DBG}
VERABI=${VER}${DBG}${THREAD}

# Make sure the "python" value in conda_build_config.yaml is up to date.
test "${PY_VER}" = "${VER}"
Expand Down Expand Up @@ -247,6 +254,12 @@ _common_configure_args+=(--enable-loadable-sqlite-extensions)
_common_configure_args+=(--with-tcltk-includes="-I${PREFIX}/include")
_common_configure_args+=("--with-tcltk-libs=-L${PREFIX}/lib -ltcl8.6 -ltk8.6")
_common_configure_args+=(--with-platlibdir=lib)
# TODO build libmpdec as a conda package, https://www.bytereef.org/mpdecimal/
_common_configure_args+=(--with-system-libmpdec=no)

if [[ ${PY_GIL_DISABLED} == yes ]]; then
_common_configure_args+=(--disable-gil)
fi

# Add more optimization flags for the static Python interpreter:
declare -a PROFILE_TASK=()
Expand Down Expand Up @@ -392,7 +405,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.12 ${PREFIX}/bin/python3.1
ln -s ${PREFIX}/bin/python3.13 ${PREFIX}/bin/python3.1

# Remove test data to save space
# Though keep `support` as some things use that.
Expand Down Expand Up @@ -504,11 +517,11 @@ if [[ ${HOST} =~ .*linux.* ]]; then
fi

python -c "import compileall,os;compileall.compile_dir(os.environ['PREFIX'])"
rm ${PREFIX}/lib/libpython${VER}.a
rm ${PREFIX}/lib/libpython${VERABI}.a
if [[ "$target_platform" == linux-* ]]; then
rm ${PREFIX}/include/uuid.h
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.12" "${PREFIX}/lib/python3.1"
ln -s "${PREFIX}/lib/python3.13" "${PREFIX}/lib/python3.1"
11 changes: 8 additions & 3 deletions recipe/build_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ if [[ ${DEBUG_PY} == yes ]]; then
else
DBG=
fi
if [[ ${PY_GIL_DISABLED} == yes ]]; then
THREAD=t
else
THREAD=
fi
VER=${PKG_VERSION%.*}
VERABI=${VER}${DBG}
VERABI=${VER}${DBG}${THREAD}

case "$target_platform" in
linux-64)
Expand All @@ -30,9 +35,9 @@ esac

cp -pf ${_buildd_static}/libpython${VERABI}.a ${PREFIX}/lib/libpython${VERABI}.a
if [[ ${HOST} =~ .*linux.* ]]; then
pushd ${PREFIX}/lib/python${VERABI}/config-${VERABI}-${OLD_HOST}
pushd ${PREFIX}/lib/python${VER}/config-${VERABI}-${OLD_HOST}
elif [[ ${HOST} =~ .*darwin.* ]]; then
pushd ${PREFIX}/lib/python${VERABI}/config-${VERABI}-darwin
pushd ${PREFIX}/lib/python${VER}/config-${VERABI}-darwin
fi
ln -s ../../libpython${VERABI}.a libpython${VERABI}.a
popd
Expand Down
2 changes: 1 addition & 1 deletion recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python:
- 3.12
- 3.13
python_impl:
- cpython
numpy:
Expand Down
39 changes: 29 additions & 10 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% set version = "3.12.3" %}
{% set dev = "" %}
{% set version = "3.13.0" %}
{% set dev = "b1" %}
{% set dev_ = "" %}
{% set ver2 = '.'.join(version.split('.')[0:2]) %}
{% set ver2nd = ''.join(version.split('.')[0:2]) %}
{% set ver3nd = ''.join(version.split('.')[0:3]) %}
{% set build_number = "1" %}
{% set build_number = "0" %}
{% set channel_targets = ('abc', 'def') %}
# this is just for the initial build, to break dependencies with python -> pip -> libpython-static
{% set bootstrap = "false" %}
Expand Down Expand Up @@ -39,6 +39,17 @@
{% set py_interp_debug = "no" %}
{% endif %}

# no-GIL, set using conda_build_config.yaml
{% if gil_type is defined and gil_type == "disabled" %}
{% set py_gil_disabled = "yes" %}
{% set gil = "_nogil" %}
{% set gil_abi = "t" %}
{% else %}
{% set py_gil_disabled = "no" %}
{% set gil = "" %}
{% set gil_abi = "" %}
{% endif %}

package:
name: python-split
version: {{ version }}{{ dev }}
Expand All @@ -50,7 +61,7 @@ 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 }}/
sha256: 56bfef1fdfc1221ce6720e43a661e3eb41785dd914ce99698d8c7896af4bdaa1
sha256: ba716ac56b039b545ad4a90ce586a57aa97869364553746ef2445728ceec198e
{% endif %}
patches:
- patches/0000-branding.patch
Expand Down Expand Up @@ -79,6 +90,7 @@ source:
- patches/0018-Unvendor-expat.patch
- patches/0019-Remove-unused-readelf.patch
- patches/0021-Override-configure-LIBFFI.patch
- patches/0030-skip_broken_tests_nogil.patch # [gil_type == "disabled"]

build:
number: {{ build_number }}
Expand Down Expand Up @@ -125,7 +137,7 @@ outputs:
- '*.py' # [build_platform != target_platform]
{% endif %}
string: {{ dev_ }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython # ["conda-forge" in (channel_targets or "")]
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
string: h{{ PKG_HASH }}{{ gil }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }} # ["conda-forge" not in (channel_targets or "")]
{% if 'conda-forge' in channel_targets %}
run_exports:
noarch:
Expand All @@ -136,6 +148,7 @@ outputs:
script_env:
- PY_INTERP_LINKAGE_NATURE={{ linkage_nature_env }}
- PY_INTERP_DEBUG={{ py_interp_debug }}
- PY_GIL_DISABLED={{ py_gil_disabled }}
# 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.
Expand Down Expand Up @@ -261,7 +274,11 @@ outputs:
- bash build-and-test.sh # [unix]
- popd # [unix]
- pushd cmake
- cmake -GNinja -DPY_VER={{ version }}
# TODO: cmake does not know about the free-threading ABI and fails to
# identify libpython3.13t.dylib as a valid PythonLibs target.
# Skip this test for the time being.
# https://gitlab.kitware.com/cmake/cmake/-/issues/26016
#- cmake -GNinja -DPY_VER={{ version }}
# --trace --debug-output --debug-trycompile .
- popd
- popd
Expand All @@ -285,8 +302,10 @@ outputs:
- python_abi
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}_cpython
{% else %}
string: h{{ PKG_HASH }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
string: h{{ PKG_HASH }}{{ gil }}_{{ PKG_BUILDNUM }}{{ linkage_nature }}{{ debug }}
{% endif %}
script_env:
- PY_GIL_DISABLED={{ py_gil_disabled }}
requirements:
build:
- {{ compiler('c') }}
Expand All @@ -310,9 +329,9 @@ outputs:
commands:
- pushd tests # [unix]
- pushd prefix-replacement # [unix]
- test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix]
- test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix]
- test -f ${PREFIX}/lib/python${PKG_VERSION%.*}/config-${PKG_VERSION%.*}-darwin/libpython${PKG_VERSION%.*}.a # [osx]
- test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}{{ gil_abi }}.a # [unix]
- test -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}{{ gil_abi }}.nolto.a # [unix]
- test -f ${PREFIX}/lib/python${PKG_VERSION%.*}/config-${PKG_VERSION%.*}{{ gil_abi }}-darwin/libpython${PKG_VERSION%.*}{{ gil_abi }}.a # [osx]
- bash build-and-test.sh # [unix]
- popd # [unix]
- popd # [unix]
Expand Down
10 changes: 5 additions & 5 deletions recipe/patches/0000-branding.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From 8dd435f6fe70c28bfe5dc4802da06648dc457cf9 Mon Sep 17 00:00:00 2001
From a48c883437747dbdc3eaf56708c4e83937ad2345 Mon Sep 17 00:00:00 2001
From: Charles Bousseau <[email protected]>
Date: Wed, 14 Jun 2023 22:52:16 -0400
Subject: [PATCH] branding
Subject: [PATCH 21/21] branding

---
Lib/platform.py | 2 +-
Python/getversion.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Lib/platform.py b/Lib/platform.py
index 7bb222088d..43eac9e2fc 100755
index ebaba37563..693a9c22f6 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -1067,7 +1067,7 @@ def _sys_version(sys_version=None):
@@ -1154,7 +1154,7 @@ def _sys_version(sys_version=None):
return result

sys_version_parser = re.compile(
Expand Down Expand Up @@ -45,5 +45,5 @@ index 5db836ab4b..b454828348 100644
}

--
2.32.1 (Apple Git-133)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From eea5d6141bd04ecee4c69e1c824832eaaaa868e7 Mon Sep 17 00:00:00 2001
From 70476c643bf239aca33e8b0a6ca8325e8f56f8ba Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Wed, 16 Aug 2017 11:53:55 +0100
Subject: [PATCH 01/25] Win32: Change FD_SETSIZE from 512 to 2048
Subject: [PATCH 01/21] Win32: Change FD_SETSIZE from 512 to 2048

https://github.com/ContinuumIO/anaconda-issues/issues/1241
---
Modules/selectmodule.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 4eea928a26..e3c5d82722 100644
index 3eaee22c65..c2196b92c5 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -38,7 +38,7 @@
@@ -45,7 +45,7 @@
FD_SETSIZE higher before this; e.g., via compiler /D switch.
*/
#if defined(MS_WINDOWS) && !defined(FD_SETSIZE)
Expand All @@ -22,5 +22,5 @@ index 4eea928a26..e3c5d82722 100644

#if defined(HAVE_POLL_H)
--
2.32.1 (Apple Git-133)
2.39.3 (Apple Git-146)

14 changes: 7 additions & 7 deletions recipe/patches/0002-Win32-Do-not-download-externals.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From 3aa0eec087878034251f770c7bab51823c8bdcfa Mon Sep 17 00:00:00 2001
From f1fc5d3664ca103bb7b591bf6d29afff6eb21886 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Thu, 7 Sep 2017 11:35:47 +0100
Subject: [PATCH 05/25] Win32: Do not download externals
Subject: [PATCH 02/21] Win32: Do not download externals

---
PCbuild/build.bat | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PCbuild/build.bat b/PCbuild/build.bat
index d333ceabd2..11e3d16a4f 100644
index 6c76f09a07..7c93d81b50 100644
--- a/PCbuild/build.bat
+++ b/PCbuild/build.bat
@@ -97,7 +97,7 @@ if "%IncludeCTypes%"=="" set IncludeCTypes=true
@@ -107,7 +107,7 @@ if "%IncludeCTypes%"=="" set IncludeCTypes=true
if "%IncludeSSL%"=="" set IncludeSSL=true
if "%IncludeTkinter%"=="" set IncludeTkinter=true

Expand All @@ -20,6 +20,6 @@ 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.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 82f08c684edcdddad3842c81cb19e5504157e808 Mon Sep 17 00:00:00 2001
From bd6b18f258caaf97626745ef05ae91fb1fbb8ba0 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Tue, 5 Dec 2017 22:47:59 +0000
Subject: [PATCH 06/25] Fix find_library so that it looks in sys.prefix/lib
Subject: [PATCH 03/21] Fix find_library so that it looks in sys.prefix/lib
first

---
Expand All @@ -25,11 +25,11 @@ index 583c47daff..ab9b01c87e 100644
yield os.path.join(executable_path, name[len('@executable_path/'):])

diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
index 0c2510e161..72b46cc481 100644
index 117bf06cb0..2e9fa474ac 100644
--- a/Lib/ctypes/util.py
+++ b/Lib/ctypes/util.py
@@ -70,7 +70,8 @@ def find_library(name):
elif os.name == "posix" and sys.platform == "darwin":
elif os.name == "posix" and sys.platform in {"darwin", "ios", "tvos", "watchos"}:
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
- possible = ['lib%s.dylib' % name,
Expand All @@ -38,7 +38,7 @@ index 0c2510e161..72b46cc481 100644
'%s.dylib' % name,
'%s.framework/%s' % (name, name)]
for name in possible:
@@ -324,10 +325,30 @@ def _findLib_ld(name):
@@ -336,10 +337,30 @@ def _findLib_ld(name):
pass # result will be None
return result

Expand Down Expand Up @@ -72,5 +72,5 @@ index 0c2510e161..72b46cc481 100644
################################################################
# test code
--
2.32.1 (Apple Git-133)
2.39.3 (Apple Git-146)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From ed5794ebec725f9c9c32bd8f4da80eb9b6eb9fea Mon Sep 17 00:00:00 2001
From 16990721bbde2c53abd58f490a847c8827f8d6d0 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Sat, 27 Oct 2018 18:48:30 +0100
Subject: [PATCH 08/25] Disable registry lookup unless CONDA_PY_ALLOW_REG_PATHS
Subject: [PATCH 04/21] Disable registry lookup unless CONDA_PY_ALLOW_REG_PATHS
is not 0

Co-authored-by: Isuru Fernando<[email protected]>
Expand All @@ -13,10 +13,10 @@ Co-authored-by: Isuru Fernando<[email protected]>
create mode 100644 PC/getpathp.c

diff --git a/Modules/getpath.c b/Modules/getpath.c
index 94479887cf..5ca10cb0f2 100644
index abed139028..d5d89409f1 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -894,6 +894,7 @@ _PyConfig_InitPathConfig(PyConfig *config, int compute_path_config)
@@ -945,6 +945,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) ||
Expand All @@ -25,7 +25,7 @@ index 94479887cf..5ca10cb0f2 100644
!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
index bc7053224a..16d00c2281 100644
--- a/Modules/getpath.py
+++ b/Modules/getpath.py
@@ -51,6 +51,7 @@
Expand All @@ -36,7 +36,7 @@ index dceeed7702..334455f7d6 100644

# ** Values calculated at runtime **
# config -- [in/out] dict of the PyConfig structure
@@ -654,7 +655,7 @@ def search_up(prefix, *landmarks, test=isfile):
@@ -679,7 +680,7 @@ def search_up(prefix, *landmarks, test=isfile):
else:
pythonpath.append(joinpath(prefix, ZIP_LANDMARK))

Expand Down Expand Up @@ -1197,5 +1197,5 @@ index 0000000000..a73ea8a0e9
+ return hPython3 != NULL;
+}
--
2.32.1 (Apple Git-133)
2.39.3 (Apple Git-146)

Loading