141 lines
3 KiB
Groff
141 lines
3 KiB
Groff
|
#!/bin/sh
|
||
|
# sit class file
|
||
|
#
|
||
|
# Christoph Niethammer <niethammer@hlrs.de> (C) 2018
|
||
|
#
|
||
|
|
||
|
CATEGORY="development"
|
||
|
PACKAGE="python/vanilla_python"
|
||
|
VERSION="3.10.4"
|
||
|
SHORT_VERSION="3.10"
|
||
|
URL="https://www.python.org/"
|
||
|
INSTALLER="Jose Gracia <gracia@hlrs.de>"
|
||
|
|
||
|
|
||
|
|
||
|
# Archive A and package name P
|
||
|
A="Python-${VERSION}.tgz"
|
||
|
P="Python-${VERSION}"
|
||
|
|
||
|
|
||
|
# Other interesting configure options:
|
||
|
#--enable-sampling \
|
||
|
CONFIGURE_OPTS=" \
|
||
|
--enable-shared
|
||
|
--enable-unicode=ucs4
|
||
|
--enable-optimizations
|
||
|
--with-ensurepip
|
||
|
"
|
||
|
|
||
|
|
||
|
case $PLATFORM in
|
||
|
rocky|vulcan|laki|slc)
|
||
|
;;
|
||
|
hazelhen)
|
||
|
;;
|
||
|
*)
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
src_postinst() {
|
||
|
|
||
|
set_symlinks
|
||
|
|
||
|
install_vanilla_packages
|
||
|
|
||
|
install_share_directory
|
||
|
|
||
|
enable_pip_site
|
||
|
|
||
|
install_site_packages
|
||
|
|
||
|
echo "Stage postinst done."
|
||
|
}
|
||
|
|
||
|
install_vanilla_packages() {
|
||
|
# install numpy, mpi4py
|
||
|
|
||
|
export LD_LIBRARY_PATH=$PREFIX/lib/:$LD_LIBRARY_PATH
|
||
|
export PYTHONPATH=$PREFIX/lib/python${SHORT_VERSION}/site-packages
|
||
|
|
||
|
_PIP_SITE_INDEX_URL="http://localhost:3141/root/pypi/+simple/"
|
||
|
export PIP_DEFAULT_TIMEOUT=2
|
||
|
export PIP_DISABLE_PIP_VERSION_CHECK=1
|
||
|
export PIP_INDEX_URL=$_PIP_SITE_INDEX_URL
|
||
|
|
||
|
$PREFIX/bin/pip install numpy scipy dask
|
||
|
$PREFIX/bin/pip list
|
||
|
|
||
|
# freeze site-packages directory
|
||
|
chmod -R a-w $PREFIX/lib/python${SHORT_VERSION}/site-packages
|
||
|
}
|
||
|
|
||
|
install_site_packages() {
|
||
|
export PYTHON_SITE_HOME=$PREFIX/../../$SHORT_VERSION
|
||
|
echo "########### $PYTHON_SITE_HOME"
|
||
|
PATH=$PATH:$PYTHON_SITE_HOME/bin:$PREFIX/bin
|
||
|
PIP_SITE=$PYTHON_SITE_HOME/bin/pip-site
|
||
|
PACKAGES=$PYTHON_SITE_HOME/../share/artifacts/default_requirements.txt
|
||
|
[ -f "$PIP_SITE" ] && $PIP_SITE install --user -r $PACKAGES
|
||
|
}
|
||
|
|
||
|
install_share_directory() {
|
||
|
# create link if shared directory does not exist
|
||
|
GENERAL_PYTHON=/sw/general/x86_64/development/python
|
||
|
PYTHON_PREFIX=$PREFIX/../../ # all python stuff is here
|
||
|
SHARED=$PYTHON_PREFIX/share
|
||
|
[ ! -d "$SHARED" ] && ln -s $GENERAL_PYTHON/share $SHARED
|
||
|
|
||
|
# report
|
||
|
[ -d "$SHARED" ] && echo "Share directory is present."
|
||
|
}
|
||
|
|
||
|
enable_pip_site() {
|
||
|
# create link from share/bin/pip-site into $SHORT_VERSION/bin
|
||
|
PYTHON_SITE_HOME=$PREFIX/../../$SHORT_VERSION
|
||
|
PIP_SITE=$PYTHON_SITE_HOME/bin/pip-site
|
||
|
mkdir -p $PYTHON_SITE_HOME/bin
|
||
|
[ ! -f "$PIP_SITE" ] && ln -s $PYTHON_SITE_HOME/../share/bin/pip-site $PIP_SITE
|
||
|
# create directory for logs
|
||
|
mkdir -p $PYTHON_SITE_HOME/logs
|
||
|
|
||
|
# report
|
||
|
[ -f "$PIP_SITE" ] && echo "pip-site is present."
|
||
|
[ ! -f "$PIP_SITE" ] && echo "pip-site is NOT present."
|
||
|
}
|
||
|
|
||
|
src_setperms() {
|
||
|
chmod -R g=u $PREFIX
|
||
|
chmod -R o=u-w $PREFIX
|
||
|
}
|
||
|
|
||
|
|
||
|
set_symlinks() {
|
||
|
# Adding some symlinks
|
||
|
# Actually PEP 394 recomments against this, but we will do it anyway
|
||
|
|
||
|
cd $PREFIX/bin
|
||
|
FILES="python pip pydoc"
|
||
|
for FILE in $FILES; do
|
||
|
if [ ! -f $FILE ]; then
|
||
|
if [ -f ${FILE}3 ]; then
|
||
|
ln -s ${FILE}3 ${FILE}
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
FILE="python3-config"
|
||
|
if [ ! -f $FILE ]; then
|
||
|
ln -s ${FILE} python-config
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
|
||
|
# src_build() {
|
||
|
# make shared add_binutils_objs
|
||
|
# }
|
||
|
#
|
||
|
# src_install() {
|
||
|
# ln -s ../$PACKAGE-$VERSION/doc .
|
||
|
# make install || sit_fail "Installation failed"
|
||
|
# }
|