Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 3.11 #303

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [[ "${CONDA_BUILD:-0}" == "1" && "${CONDA_BUILD_STATE}" != "TEST" ]]; then
# sed -i 's/-fdiagnostics-color=always/ /g' $sysconfigdata_fn
# tail -3 $sysconfigdata_fn

sed -i 's/if _os.name == "posix" and _sys.platform == "darwin":/if False:/g' $BUILD_PREFIX/lib/python3.10/ctypes/__init__.py
sed -i 's/if _os.name == "posix" and _sys.platform == "darwin":/if False:/g' $BUILD_PREFIX/lib/python3.11/ctypes/__init__.py


unset _CONDA_PYTHON_SYSCONFIGDATA_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# Thanks to talljimbo for the patch adding the 'LDVERSION' config
# variable usage.

set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.10")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.10.a")
set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.11")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.11.a")
set(PYTHON_MODULE_EXTENSION ".so")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.10/site-packages")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.11/site-packages")
set(PYTHON_IS_DEBUG "FALSE")
mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)

Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/arrow-python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi



export INCLUDE_NUMPY_FLAGS="-I$BUILD_PREFIX/lib/python3.10/site-packages/numpy/core/include -I$PREFIX/lib/python3.10/site-packages/numpy/core/include"
export INCLUDE_NUMPY_FLAGS="-I$BUILD_PREFIX/lib/python3.11/site-packages/numpy/core/include -I$PREFIX/lib/python3.11/site-packages/numpy/core/include"

export CFLAGS="$CFLAGS $INCLUDE_NUMPY_FLAGS"
export CXXFLAGS="$CXXFLAGS $INCLUDE_NUMPY_FLAGS"
Expand Down
6 changes: 3 additions & 3 deletions recipes/recipes_emscripten/brotli/FindPythonLibsNew.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# Thanks to talljimbo for the patch adding the 'LDVERSION' config
# variable usage.

set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.10")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.10.a")
set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.11")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.11.a")
set(PYTHON_MODULE_EXTENSION ".so")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.10/site-packages")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.11/site-packages")
set(PYTHON_IS_DEBUG "FALSE")
mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)

Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/nlopt/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
export CFLAGS="${CFLAGS} -DHAVE_UINT32_T -I$BUILD_PREFIX/lib/python3.10/site-packages/numpy/core/include/"
export CFLAGS="${CFLAGS} -DHAVE_UINT32_T -I$BUILD_PREFIX/lib/python3.11/site-packages/numpy/core/include/"
${PYTHON} -m pip install .

4 changes: 2 additions & 2 deletions recipes/recipes_emscripten/nlopt/src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def configure_with_cmake():
cmd = [
"emcmake",
"cmake",
f"-DCMAKE_CXX_FLAGS=-I {sys.prefix}/lib/python3.10/site-packages/numpy/core/include/",
f"-DCMAKE_CXX_FLAGS=-I {sys.prefix}/lib/python3.11/site-packages/numpy/core/include/",
"-DAPI_SOURCE_DIR=./src/api",
"-P",
"./cmake/generate-cpp.cmake",
Expand Down Expand Up @@ -151,7 +151,7 @@ def run(self):
"./src/algs/isres",
"./src/algs/esch",
"./src/algs/slsqp",
f"{sys.prefix}/lib/python3.10/site-packages/numpy/core/include/"
f"{sys.prefix}/lib/python3.11/site-packages/numpy/core/include/"
],
swig_opts=["-c++", "-interface", "_nlopt", "-outdir", "./nlopt"],
)
Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/picomamba/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake ${CMAKE_ARGS} .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DPYTHON_MODULE_INSTALL_DIR="$PREFIX/lib/python3.10/site-packages" \
-DPYTHON_MODULE_INSTALL_DIR="$PREFIX/lib/python3.11/site-packages" \
-DLIBSOLV_LIBRARY="$PREFIX/lib/libsolv.a"\
-DLIBSOLV_EXT_LIBRARY="$PREFIX/lib/libsolvext.a"\
-DLibSolv_INCLUDE_DIRS="$PREFIX/include"\
Expand Down
4 changes: 2 additions & 2 deletions recipes/recipes_emscripten/pyb2d/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cmake ${CMAKE_ARGS} .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DPYTHON_NUMPY_INCLUDE_DIR="$PREFIX/lib/python3.10/site-packages/numpy/core/include" \
-DPYTHON_MODULE_INSTALL_DIR="$PREFIX/lib/python3.10/site-packages" \
-DPYTHON_NUMPY_INCLUDE_DIR="$PREFIX/lib/python3.11/site-packages/numpy/core/include" \
-DPYTHON_MODULE_INSTALL_DIR="$PREFIX/lib/python3.11/site-packages" \
-DPYB2D_LIQUID_FUN=ON
# Build step
ninja
Expand Down
6 changes: 3 additions & 3 deletions recipes/recipes_emscripten/pybind11/FindPythonLibsNew.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# Thanks to talljimbo for the patch adding the 'LDVERSION' config
# variable usage.

set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.10")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.10.a")
set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.11")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.11.a")
set(PYTHON_MODULE_EXTENSION ".so")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.10/site-packages")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.11/site-packages")
set(PYTHON_IS_DEBUG "FALSE")
mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# Thanks to talljimbo for the patch adding the 'LDVERSION' config
# variable usage.

set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.10")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.10.a")
set(PYTHON_INCLUDE_DIR "$ENV{PREFIX}/include/python3.11")
set(PYTHON_LIBRARY "$ENV{PREFIX}/lib/libpython3.11.a")
set(PYTHON_MODULE_EXTENSION ".so")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.10/site-packages")
set(PYTHON_SITE_PACKAGES "$ENV{PREFIX}/lib/python3.11/site-packages")
set(PYTHON_IS_DEBUG "FALSE")
mark_as_advanced(PYTHON_LIBRARY PYTHON_INCLUDE_DIR)

Expand Down
28 changes: 14 additions & 14 deletions recipes/recipes_emscripten/python/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

cp $RECIPE_DIR/patches/configure .

PYTHON=${BUILD_PREFIX}/bin/python3.10
Copy link
Contributor

Choose a reason for hiding this comment

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

I would revert the hard-coded changes and only change it in the python recipe but not all the other recipes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright, is it because this should be tackled in #308 instead?

PYTHON=${BUILD_PREFIX}/bin/python3.11

export DBGFLAGS=-g0
export OPTFLAGS=-O2
Expand All @@ -20,7 +20,7 @@ echo "EMSCRIPTEN_VERSION" $EMSCRIPTEN_VERSION
echo "PLATFORM_TRIPLET" $PLATFORM_TRIPLET


LIB=libpython3.10.a
LIB=libpython3.11.a



Expand Down Expand Up @@ -54,8 +54,8 @@ if [[ $target_platform == "emscripten-32" ]]; then

sed -i -e 's/libinstall:.*/libinstall:/' Makefile;

# emmake make PYTHON_FOR_BUILD=${BUILD_PREFIX}/bin/python3.10 CROSS_COMPILE=yes inclinstall libinstall ${LIB}
emmake make PYTHON_FOR_BUILD=${BUILD_PREFIX}/bin/python3.10 CROSS_COMPILE=yes inclinstall libinstall bininstall ${LIB}
# emmake make PYTHON_FOR_BUILD=${BUILD_PREFIX}/bin/python3.11 CROSS_COMPILE=yes inclinstall libinstall ${LIB}
emmake make PYTHON_FOR_BUILD=${BUILD_PREFIX}/bin/python3.11 CROSS_COMPILE=yes inclinstall libinstall bininstall ${LIB}
cp ${LIB} ${PREFIX}/lib/

emmake make CROSS_COMPILE=yes -j8
Expand All @@ -70,15 +70,15 @@ if [[ $target_platform == "emscripten-32" ]]; then
--fname-in $FNAME_IN \
--fname-out $FNAME_OUT \

cp build/lib.emscripten-3.10/$SYSCONFIG_NAME.py ${PREFIX}/lib/python3.10/
cp build/lib.emscripten-3.10/$SYSCONFIG_NAME.py ${PREFIX}/lib/python3.11/

# CHANGE PLATTFORM TRIPLET IN SYSCONFIG
sed -i "s/-lffi -lz/ /g" ${PREFIX}/lib/python3.10/$SYSCONFIG_NAME.py
# sed -i "s/'SHLIB_SUFFIX': '.so',/'SHLIB_SUFFIX': '.cpython-310-wasm32-emscripten.so',/g" ${PREFIX}/lib/python3.10/_sysconfigdata__emscripten_.py
sed -i "s/-lffi -lz/ /g" ${PREFIX}/lib/python3.11/$SYSCONFIG_NAME.py
# sed -i "s/'SHLIB_SUFFIX': '.so',/'SHLIB_SUFFIX': '.cpython-310-wasm32-emscripten.so',/g" ${PREFIX}/lib/python3.11/_sysconfigdata__emscripten_.py

# install/copy sysconfig to a place where cross-python expects the sysconfig
mkdir -p ${PREFIX}/etc/conda
cp ${PREFIX}/lib/python3.10/$SYSCONFIG_NAME.py ${PREFIX}/etc/conda/
cp ${PREFIX}/lib/python3.11/$SYSCONFIG_NAME.py ${PREFIX}/etc/conda/

# cleanup
pushd ${PREFIX}
Expand All @@ -91,17 +91,17 @@ if [[ $target_platform == "emscripten-32" ]]; then
popd

# remove the removal modules
pushd ${PREFIX}/lib/python3.10/
pushd ${PREFIX}/lib/python3.11/
rm -rf `cat ${RECIPE_DIR}/config/remove_modules.txt`
popd

# unwanted test dirs
rm -rf ${PREFIX}/lib/python3.10/ctypes/test
rm -rf ${PREFIX}/lib/python3.10/distutils/test
rm -rf ${PREFIX}/lib/python3.10/sqlite3/test
rm -rf ${PREFIX}/lib/python3.10/unittest/tests
rm -rf ${PREFIX}/lib/python3.11/ctypes/test
rm -rf ${PREFIX}/lib/python3.11/distutils/test
rm -rf ${PREFIX}/lib/python3.11/sqlite3/test
rm -rf ${PREFIX}/lib/python3.11/unittest/tests

# remove broken links but keep python3.10 binary
# remove broken links but keep python3.11 binary
# and the non-broken link to it
rm ${PREFIX}/bin/2to3
rm ${PREFIX}/bin/idle3
Expand Down