Skip to content

Commit

Permalink
update python and style improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
KGB99 committed Jul 31, 2024
1 parent cbb55a5 commit f843ca4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions recipes/recipes_emscripten/python/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

export PYTHON_TOP_VERSION=3.12

set -euxo pipefail

mkdir -p $PREFIX/include
Expand All @@ -10,7 +12,7 @@ mkdir -p $PREFIX/etc/conda
# Move all python package files to the build folder
export BUILD=build/${PKG_VERSION}/Python-${PKG_VERSION}
mkdir -p ${BUILD}
mv Makefile.pre.in README.rst aclocal.m4 config.guess config.sub setup.py pyconfig.h.in install-sh configure.ac ${BUILD}
mv Makefile.pre.in README.rst aclocal.m4 config.guess config.sub pyconfig.h.in install-sh configure.ac ${BUILD}
mv Doc Grammar Include LICENSE Lib Mac Misc Modules Objects PC PCbuild Parser Programs Python Tools configure ${BUILD}

# copy the LICENSE file back for the recipe
Expand All @@ -20,7 +22,7 @@ cp ${BUILD}/LICENSE .
# since the python build script overwrites the env variable PYTHON to python.js
# as it assumes this is the correct name for the python binary when building for emscripten.
# But emscripten itself (emcc/emar/...) relies on the env variable PYTHON to be set to python3.11
ln -s $BUILD_PREFIX/bin/python3.11 $BUILD_PREFIX/bin/python.js
ln -s $BUILD_PREFIX/bin/python${PYTHON_TOP_VERSION} $BUILD_PREFIX/bin/python.js

# create an empty emsdk_env.sh in CONDA_EMSDK_DIR
echo "" > $EMSCRIPTEN_FORGE_EMSDK_DIR/emsdk_env.sh
Expand Down Expand Up @@ -54,14 +56,14 @@ echo "echo \"pip is not a supported on this platform.\"" >> $PREFIX/bin/pip
chmod +x $PREFIX/bin/pip

# a fake python3 command
touch $PREFIX/bin/python3.11
echo "#!/bin/bash" >> $PREFIX/bin/python3.11
echo "echo \"python3 is not a supported on this platform.\"" >> $PREFIX/bin/python3.11
chmod +x $PREFIX/bin/python3.11
touch $PREFIX/bin/python${PYTHON_TOP_VERSION}
echo "#!/bin/bash" >> $PREFIX/bin/python${PYTHON_TOP_VERSION}
echo "echo \"python3 is not a supported on this platform.\"" >> $PREFIX/bin/python${PYTHON_TOP_VERSION}
chmod +x $PREFIX/bin/python${PYTHON_TOP_VERSION}

# create symlink st. all possible python3.11 commands are available
ln -s $PREFIX/bin/python3.11 $PREFIX/bin/python
ln -s $PREFIX/bin/python3.11 $PREFIX/bin/python3
ln -s $PREFIX/bin/python${PYTHON_TOP_VERSION} $PREFIX/bin/python
ln -s $PREFIX/bin/python${PYTHON_TOP_VERSION} $PREFIX/bin/python3

# copy sysconfigdata
cp $PREFIX/sysconfigdata/_sysconfigdata__emscripten_wasm32-emscripten.py $PREFIX/etc/conda/
cp $PREFIX/sysconfigdata/_sysconfigdata__emscripten_wasm32-emscripten.py $PREFIX/etc/conda/

0 comments on commit f843ca4

Please sign in to comment.