Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 42 additions & 39 deletions recipe/build_base.bat
Original file line number Diff line number Diff line change
Expand Up @@ -102,43 +102,42 @@ for %%x in (python%THREAD%%_D%.pdb python%VERNODOTS%%THREAD%%_D%.pdb pythonw%THR

@echo on

:: AR: classic Win prefix (DLLs/, Lib/, libs/, include/). CPython getpath
:: landmarks Lib\os.py; CF install_base.bat uses the same layout.
copy %SRC_DIR%\LICENSE %PREFIX%\LICENSE_PYTHON.txt
:: 0027 unixy Win prefix (lib\python, include\python). getpath landmarks lib\python\os.py.
mkdir %PREFIX%\lib\python
copy %SRC_DIR%\LICENSE %PREFIX%\lib\python\LICENSE_PYTHON.txt
if errorlevel 1 exit 1

:: Populate the DLLs directory
mkdir %PREFIX%\DLLs
xcopy /s /y %SRC_DIR%\PCBuild\%BUILD_PATH%\*.pyd %PREFIX%\DLLs\
:: Populate lib-dynload (was DLLs)
mkdir %PREFIX%\lib\python\lib-dynload
xcopy /s /y %SRC_DIR%\PCBuild\%BUILD_PATH%\*.pyd %PREFIX%\lib\python\lib-dynload\
if errorlevel 1 exit 1

copy /Y %SRC_DIR%\PC\icons\py.ico %PREFIX%\DLLs\
copy /Y %SRC_DIR%\PC\icons\py.ico %PREFIX%\lib\python\lib-dynload\
if errorlevel 1 exit 1
copy /Y %SRC_DIR%\PC\icons\pyc.ico %PREFIX%\DLLs\
copy /Y %SRC_DIR%\PC\icons\pyc.ico %PREFIX%\lib\python\lib-dynload\
if errorlevel 1 exit 1


:: Populate the Tools directory
mkdir %PREFIX%\Tools
xcopy /s /y /i %SRC_DIR%\Tools\i18n %PREFIX%\Tools\i18n
if errorlevel 1 exit 1
xcopy /s /y /i %SRC_DIR%\Tools\scripts %PREFIX%\Tools\scripts
mkdir %PREFIX%\lib\python\Tools
xcopy /s /y /i %SRC_DIR%\Tools\scripts %PREFIX%\lib\python\Tools\scripts
if errorlevel 1 exit 1

del %PREFIX%\Tools\scripts\README
del %PREFIX%\lib\python\Tools\scripts\README
if errorlevel 1 exit 1
del %PREFIX%\Tools\scripts\idle3
del %PREFIX%\lib\python\Tools\scripts\idle3
if errorlevel 1 exit 1

move /y %PREFIX%\Tools\scripts\pydoc3 %PREFIX%\Tools\scripts\pydoc3.py
move /y %PREFIX%\lib\python\Tools\scripts\pydoc3 %PREFIX%\lib\python\Tools\scripts\pydoc3.py
if errorlevel 1 exit 1

:: Populate the include directory
xcopy /s /y %SRC_DIR%\Include %PREFIX%\include\
mkdir %PREFIX%\include\python
xcopy /s /y %SRC_DIR%\Include %PREFIX%\include\python\
if errorlevel 1 exit 1

:: Copy generated pyconfig.h
copy /Y %SRC_DIR%\PC\pyconfig.h %PREFIX%\include\
copy /Y %SRC_DIR%\PC\pyconfig.h %PREFIX%\include\python\
if errorlevel 1 exit 1

:: Populate the Scripts directory
Expand All @@ -150,50 +149,54 @@ for %%x in (idle pydoc) do (
if errorlevel 1 exit 1
)

:: Populate the libs directory
if not exist %PREFIX%\libs mkdir %PREFIX%\libs
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib %PREFIX%\libs\
if errorlevel 1 exit 1
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib %PREFIX%\libs\
if errorlevel 1 exit 1
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\libs\
if errorlevel 1 exit 1
:: Import libs into BOTH lib\ (CFEP-27 unixy layout) and libs\ (link-time compat:
:: distutils/setuptools build_ext hardcodes exec_prefix\libs on nt; meson cannot
:: query it either. CFEP-27 section 6 / conda-forge PR 918 — do not drop libs\.)
for %%x in (lib libs) do (
if not exist %PREFIX%\%%x mkdir %PREFIX%\%%x
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python%VERNODOTS%%THREAD%%_D%.lib %PREFIX%\%%x\
if errorlevel 1 exit 1
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\python3%THREAD%%_D%.lib %PREFIX%\%%x\
if errorlevel 1 exit 1
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\_tkinter%_D%.lib %PREFIX%\%%x\
if errorlevel 1 exit 1
)


:: Populate the Lib directory
del %PREFIX%\libs\libpython*.a
xcopy /s /y %SRC_DIR%\Lib %PREFIX%\Lib\
:: Populate lib\python (stdlib)
del %PREFIX%\lib\libpython*.a
xcopy /s /y %SRC_DIR%\Lib %PREFIX%\lib\python\
if errorlevel 1 exit 1

:: Copy venv[w]launcher scripts to venv\scripts\nt
:: See https://github.com/python/cpython/blob/b4a316087c32d83e375087fd35fc511bc430ee8b/Lib/venv/__init__.py#L334-L376
if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe (
@rem We did copy pythonw.exe until 3.12 but starting with 3.13 we seem to need the latter. Should we omit the first?
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\python.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvlauncher%THREAD%%_D%.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\lib\python\venv\scripts\nt\python.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe %PREFIX%\lib\python\venv\scripts\nt\venvlauncher%THREAD%%_D%.exe
) else (
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvlauncher%THREAD%%_D%.exe does not exist"
)

if exist %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe (
@rem We did copy pythonw.exe until 3.12 but starting with 3.13 we seem to need the latter. Should we omit the first?
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\pythonw.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\Lib\venv\scripts\nt\venvwlauncher%THREAD%%_D%.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\lib\python\venv\scripts\nt\pythonw.exe
copy /Y %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe %PREFIX%\lib\python\venv\scripts\nt\venvwlauncher%THREAD%%_D%.exe
) else (
echo "WARNING :: %SRC_DIR%\PCbuild\%BUILD_PATH%\venvwlauncher%THREAD%%_D%.exe does not exist"
)

:: Remove test data to save space.
:: Though keep `support` as some things use that.
mkdir %PREFIX%\Lib\test_keep
mkdir %PREFIX%\lib\python\test_keep
if errorlevel 1 exit 1
move %PREFIX%\Lib\test\__init__.py %PREFIX%\Lib\test_keep\
move %PREFIX%\lib\python\test\__init__.py %PREFIX%\lib\python\test_keep\
if errorlevel 1 exit 1
move %PREFIX%\Lib\test\support %PREFIX%\Lib\test_keep\
move %PREFIX%\lib\python\test\support %PREFIX%\lib\python\test_keep\
if errorlevel 1 exit 1
rd /s /q %PREFIX%\Lib\test
rd /s /q %PREFIX%\lib\python\test
if errorlevel 1 exit 1
move %PREFIX%\Lib\test_keep %PREFIX%\Lib\test
move %PREFIX%\lib\python\test_keep %PREFIX%\lib\python\test
if errorlevel 1 exit 1

:: We need our Python to be found!
Expand All @@ -202,7 +205,7 @@ if "%EXE_T%" neq "" copy %PREFIX%\python%EXE_T%.exe %PREFIX%\python.exe

set "PYTHON=%PREFIX%\python.exe"
:: bytecode compile the standard library
%PYTHON% -Wi %PREFIX%\Lib\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\Lib
%PYTHON% -Wi %PREFIX%\lib\python\compileall.py -f -q -x "bad_coding|badsyntax|py2_" %PREFIX%\lib\python
if errorlevel 1 exit 1

:: Ensure that scripts are generated
Expand All @@ -227,7 +230,7 @@ echo "Testing import of os (no DLL needed) does not print: The specified module
if %errorlevel% neq 1 exit /b 1

echo "Testing import of %%m (DLL located via PATH needed) does not print: The specified module could not be found"
:: The names are our unvendored modules mapped to ...\DLLs\X.pyd
:: The names are our unvendored modules mapped to ...\lib\python\lib-dynload\X.pyd
:: missing: libffi, expat, zlib(-ng)

:: Also %errorlevel% will not be updated round the loop so use && to
Expand Down
66 changes: 30 additions & 36 deletions recipe/build_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ fi
VERFULL=${PKG_VERSION}
VER=${PKG_VERSION%.*}
VERNODOTS=${VER//./}
# tk 9 ships libtcl9.0.so + libtcl9tk9.0.so (not libtk9.0.so).
TCLTK_VER=${tk}
TK_MAJOR_VER=${tk%.*}
# LLVM version to use for LTO/PGO. Align it with c_compiler_version on osx-arm64.
LLVM_VER=${c_compiler_version%.*}
if [[ ${target_platform} == osx-arm64 ]]; then
LLVM_VER=21
fi

# Disables some PGO/LTO
QUICK_BUILD=no

Expand All @@ -56,12 +51,6 @@ else
_OPTIMIZED=yes
fi

if [[ ${target_platform} == linux-ppc64le ]]; then
_OPTIMIZED=no
# ppc64le cdt need to be rebuilt with files in powerpc64le-conda-linux-gnu instead of powerpc64le-conda_cos7-linux-gnu. In the mean time:
cp --force --archive --update --link $BUILD_PREFIX/powerpc64le-conda_cos7-linux-gnu/. $BUILD_PREFIX/powerpc64le-conda-linux-gnu
fi

declare -a _dbg_opts
if [[ ${DEBUG_PY} == yes ]]; then
# This Python will not be usable with non-debug Python modules.
Expand Down Expand Up @@ -264,8 +253,10 @@ _common_configure_args+=(--with-tzpath=${PREFIX}/share/zoneinfo)
_common_configure_args+=(--with-computed-gotos)
_common_configure_args+=(--with-system-expat)
_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 -ltcl${TCLTK_VER} -ltcl${TK_MAJOR_VER}tk${TCLTK_VER}")
# TODO: Remove this comment in PR#256
# Dropped dead tcltk configure flags — log-confirmed unused in 3.15.0rc2:
# configure: WARNING: unrecognized options: --with-tcltk-includes, --with-tcltk-libs
# _tkinter already comes from pkg-config.
_common_configure_args+=(--with-platlibdir=lib)
_common_configure_args+=(--with-system-libmpdec=yes)

Expand Down Expand Up @@ -405,6 +396,28 @@ if [[ ${target_platform} =~ .*linux.* ]]; then
ln -sf ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}.1.0 ${PREFIX}/lib/libpython${VERABI}${SHLIB_EXT}
fi

# create libpython3.dylib; linux gets libpython3.so from upstream's Makefile,
# macOS has no upstream rule — build the stable-ABI re-export dylib ourselves
# (same as CF install_shared.sh). Release only, matching linux.
if [[ "$target_platform" == osx-* && ${PY_INTERP_DEBUG} == no ]]; then
# need to filter out windows-specific symbols & PyOS_CheckStack from
# https://github.com/python/cpython/blob/main/Doc/data/stable_abi.dat
awk -F',' '
($1 == "func" || $1 == "data") &&
$4 != "on Windows" &&
$2 != "PyOS_CheckStack" {
print "_" $2
}
' ${SRC_DIR}/Doc/data/stable_abi.dat > ${_buildd_shared}/stable_abi_exports.txt

$CC -dynamiclib \
-install_name @rpath/libpython3.dylib \
-compatibility_version 3.0 -current_version ${VER}.0 \
-Wl,-reexport_library,${PREFIX}/lib/libpython${VERABI}.dylib \
-Wl,-exported_symbols_list,${_buildd_shared}/stable_abi_exports.txt \
-o ${PREFIX}/lib/libpython3.dylib
fi

# AR: keep sysconfig from the *static* build (same as CF install_base.sh).
# A shared-build sysconfig made python3-config --embed emit -lpython3.15, so
# libpython-static tests linked the dylib and dyld aborted on osx-arm64.
Expand Down Expand Up @@ -454,22 +467,6 @@ pushd ${PREFIX}
fi
popd

# OLD_HOST is with CentOS version in them. When building this recipe
# with the compilers from conda-forge OLD_HOST != HOST, but when building
# with the compilers from defaults OLD_HOST == HOST. Both cases are handled in the
# code below
case "$target_platform" in
linux-64)
OLD_HOST=$(echo ${HOST} | sed -e 's/-conda-/-conda_cos6-/g')
;;
linux-*)
OLD_HOST=$(echo ${HOST} | sed -e 's/-conda-/-conda_cos7-/g')
;;
*)
OLD_HOST=$HOST
;;
esac

# Copy sysconfig that gets recorded to a non-default name
# using the new compilers with python will require setting _PYTHON_SYSCONFIGDATA_NAME
# to the name of this file (minus the .py extension)
Expand Down Expand Up @@ -500,13 +497,9 @@ pushd "${PREFIX}"/lib/python${VERABI}
sed -i.bak "s/'GNULD': 'yes'/'GNULD': 'no'/g" sysconfigfile
cp sysconfigfile ${our_compilers_name}

sed -i.bak "s@${HOST}@${OLD_HOST}@g" sysconfigfile
old_compiler_name=_sysconfigdata_$(echo ${OLD_HOST} | sed -e 's/[.-]/_/g').py
cp sysconfigfile ${old_compiler_name}

# For system gcc remove the triple
sed -i.bak "s@$OLD_HOST-c++@g++@g" sysconfigfile
sed -i.bak "s@$OLD_HOST-@@g" sysconfigfile
sed -i.bak "s@$HOST-c++@g++@g" sysconfigfile
sed -i.bak "s@$HOST-@@g" sysconfigfile
if [[ "$target_platform" == linux* ]]; then
# For linux, make sure the system gcc uses our linker
sed -i.bak "s@-pthread@-pthread -B $PREFIX/compiler_compat@g" sysconfigfile
Expand Down Expand Up @@ -566,3 +559,4 @@ fi
# fallback). That dir is unused here, but a conda-site.pth entry still puts it
# on sys.path and breaks imports (numba on this 3.15 rc1). AR does not ship
# CFEP-65 unixy layout.
#echo "${PREFIX}/lib/python/site-packages" >> $SP_DIR/conda-site.pth
13 changes: 10 additions & 3 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Clobber aggregate's python zip (python/numpy/is_freethreading/is_python_min).
# conda-build requires ALL four keys at the same length; otherwise 3.15 is not a
# subspace of aggregate python 3.10–3.14 (no rocket) and PY_VER stays 3.10.
python:
- 3.15 # [ANACONDA_ROCKET_ENABLE_PY315]
- 3.15
numpy:
- 2.5
is_freethreading:
- false
is_python_min:
- false
python_impl:
- cpython
numpy:
- 2.5 # [ANACONDA_ROCKET_ENABLE_PY315]
# Override aggregate global tk 8.6 — build/test against tk 9 from pkgs/main
tk:
- '9.0'
Expand Down
23 changes: 16 additions & 7 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set version = "3.15.0" %}
{% set dev = "rc1" %}
{% set dev = "rc2" %}
{% set dev_ = "" %}
{% set ver2 = '.'.join(version.split('.')[0:2]) %}
{% set ver2nd = ''.join(version.split('.')[0:2]) %}
Expand Down Expand Up @@ -61,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: f84dad680ab2147417d2739355c2678f0f9acffe4ae8ef77895de1454b384b07
sha256: 8d93af5eaaaea5adfd41bd786a7ba3f03f2ad1ab57c6a65e0b963deab91d5ad7
{% endif %}
patches:
- patches/0001-Win32-Change-FD_SETSIZE-from-512-to-2048.patch
Expand All @@ -88,12 +88,17 @@ source:
- patches/0017-Do-not-pass-g-to-GCC-when-not-Py_DEBUG.patch
- patches/0018-Unvendor-expat.patch
- patches/0019-Remove-unused-readelf.patch
- patches/0020-Don-t-checksharedmods-if-cross-compiling.patch

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping it here because it's always confusing where 0020 is. But we can comment it out.

- patches/0021-Override-configure-LIBFFI.patch
- patches/0022-Unvendor-libmpdec.patch
- patches/0023-branding.patch
- patches/0024-Unvendor-zlib-ng.patch
- patches/0024-Do-not-define-pid_t-as-it-might-conflict-with-the-ac.patch
- patches/0025-Unvendor-zstd.patch
- patches/0026-xxlimited-freethreading-stable-abi-link.patch # [win and gil_type == "disabled"]
- patches/0026-Set-Py_GIL_DISABLED-in-windows-to-match-unix.patch # [win and gil_type == "disabled"]
- patches/0027-More-unixy-layout-for-windows.patch
- patches/0028-Avoid-erroring-when-conda-site.pth-has-non-existent-.patch
- patches/0029-Unvendor-zlib-ng.patch
- patches/0030-xxlimited-freethreading-stable-abi-link.patch # [win and gil_type == "disabled"]

build:
number: {{ build_number }}
Expand Down Expand Up @@ -280,16 +285,19 @@ outputs:
# ships in this package, so do not assert their absence. Static libs must not.
- test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.a # [unix]
- test ! -f ${PREFIX}/lib/libpython${PKG_VERSION%.*}.nolto.a # [unix]
# stable-ABI re-export dylib (upstream has no macOS rule; CF install_shared.sh parity)
- test -f ${PREFIX}/lib/libpython3.dylib # [osx]
# https://github.com/conda-forge/python-feedstock/issues/384
- if exist %PREFIX%\\Scripts\\pydoc exit 1 # [win]
- if exist %PREFIX%\\Scripts\\idle exit 1 # [win]
- if not exist %PREFIX%\\Scripts\\pydoc-script.py exit 1 # [win]
- if not exist %PREFIX%\\Scripts\\idle-script.py exit 1 # [win]
- if not exist %PREFIX%\\Scripts\\idle.exe exit 1 # [win]
- if not exist %PREFIX%\\Scripts\\pydoc.exe exit 1 # [win]
# AR: classic Win layout (Lib/, include/, libs/). getpath looks for Lib\os.py;
# CF install_base.bat is the same — not lib\python.
- if not exist %PREFIX%\\include\\pyconfig.h exit 1 # [win]
# 0027 unixy Win layout: getpath landmarks lib\python\os.py and include\python.
- if not exist %PREFIX%\\include\\python\\pyconfig.h exit 1 # [win]
- if not exist %PREFIX%\\lib\\python{{ ver2nd }}{{ abi_suffix }}.lib exit 1 # [win]
# libs\ kept for link-time compat (CFEP-27 section 6, conda-forge PR 918)
- if not exist %PREFIX%\\libs\\python{{ ver2nd }}{{ abi_suffix }}.lib exit 1 # [win]
- pushd tests
- pushd prefix-replacement # [unix]
Expand Down Expand Up @@ -424,3 +432,4 @@ extra:
- xhochy
skip-lints:
- license_file_overspecified
- parsing_jinja_failure # gil_type / channel_targets jinja; linter cannot expand this recipe
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
From 627caa150ced4ec40716cc62366c19a200f5cc0d Mon Sep 17 00:00:00 2001
From b51c74365f2f62c84d2f174c2d68e38ca4e16765 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Wed, 16 Aug 2017 11:53:55 +0100
Subject: [PATCH 01/25] Win32: Change FD_SETSIZE from 512 to 2048
Subject: [PATCH 01/27] 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 2c56dbc6a5..845ff4732c 100644
index b9fb7762e3d..e6102e8c589 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -45,7 +45,7 @@
Expand All @@ -21,6 +21,3 @@ index 2c56dbc6a5..845ff4732c 100644
#endif

#if defined(HAVE_POLL_H)
--
2.51.0

Loading