Update python_vanilla for /sw/general
This commit is contained in:
parent
b56b4a3291
commit
d38d6c2998
1 changed files with 56 additions and 56 deletions
|
@ -5,7 +5,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
CATEGORY="development"
|
CATEGORY="development"
|
||||||
PACKAGE="python/vanilla_python"
|
#PACKAGE="python/vanilla_python"
|
||||||
|
PACKAGE="python"
|
||||||
VERSION="3.10.4"
|
VERSION="3.10.4"
|
||||||
SHORT_VERSION="3.10"
|
SHORT_VERSION="3.10"
|
||||||
URL="https://www.python.org/"
|
URL="https://www.python.org/"
|
||||||
|
@ -16,20 +17,19 @@ INSTALLER="Jose Gracia <gracia@hlrs.de>"
|
||||||
# Archive A and package name P
|
# Archive A and package name P
|
||||||
A="Python-${VERSION}.tgz"
|
A="Python-${VERSION}.tgz"
|
||||||
P="Python-${VERSION}"
|
P="Python-${VERSION}"
|
||||||
|
PYSOCKS_A="PySocks-1.7.0.tar.gz"
|
||||||
|
|
||||||
# Other interesting configure options:
|
# Other interesting configure options:
|
||||||
#--enable-sampling \
|
#--enable-sampling \
|
||||||
CONFIGURE_OPTS=" \
|
CONFIGURE_OPTS=" \
|
||||||
--enable-shared
|
--enable-shared
|
||||||
--enable-unicode=ucs4
|
|
||||||
--enable-optimizations
|
--enable-optimizations
|
||||||
--with-ensurepip
|
--with-ensurepip
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
case $PLATFORM in
|
case $PLATFORM in
|
||||||
rocky|vulcan|laki|slc)
|
rocky|hawk|vulcan|laki|slc)
|
||||||
;;
|
;;
|
||||||
hazelhen)
|
hazelhen)
|
||||||
;;
|
;;
|
||||||
|
@ -39,69 +39,76 @@ esac
|
||||||
|
|
||||||
src_postinst() {
|
src_postinst() {
|
||||||
|
|
||||||
|
echo "Setting symlinks ..."
|
||||||
set_symlinks
|
set_symlinks
|
||||||
|
echo "... Done setting symlinks"
|
||||||
|
|
||||||
|
echo "Setting up environment variables ..."
|
||||||
|
export LD_LIBRARY_PATH=$PREFIX/lib/:$LD_LIBRARY_PATH
|
||||||
|
export PYTHONPATH=$PREFIX/lib/python${SHORT_VERSION}/site-packages
|
||||||
|
echo "... Done setting up environment"
|
||||||
|
|
||||||
|
echo "Bootstrapping pysocks ..."
|
||||||
|
bootstrap_pysocks
|
||||||
|
echo "... Done bootstrapping pysocks"
|
||||||
|
|
||||||
|
echo "Installing vanilla packages ..."
|
||||||
install_vanilla_packages
|
install_vanilla_packages
|
||||||
|
echo "... Done installing vanilla packages"
|
||||||
|
# freeze vanilla packages directory
|
||||||
|
chmod -R a-w $PREFIX/lib/python${SHORT_VERSION}/site-packages
|
||||||
|
|
||||||
install_share_directory
|
echo "Preparing modulefile ..."
|
||||||
|
prepare_modulefile
|
||||||
enable_pip_site
|
echo "... Done preparing modulefile"
|
||||||
|
|
||||||
install_site_packages
|
|
||||||
|
|
||||||
echo "Stage postinst done."
|
echo "Stage postinst done."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bootstrap_pysocks() {
|
||||||
|
# pysocks enables using socks5 proxys in pip;
|
||||||
|
# install pysocks without pip (sigh!)
|
||||||
|
atmp=$(mktemp -d -p $WORKDIR)
|
||||||
|
echo "##### $atmp"
|
||||||
|
pushd $atmp
|
||||||
|
|
||||||
|
tar xvf $SRC_POOL/$PYSOCKS_A --strip=1
|
||||||
|
$PREFIX/bin/python3 setup.py install
|
||||||
|
|
||||||
|
popd
|
||||||
|
}
|
||||||
|
|
||||||
install_vanilla_packages() {
|
install_vanilla_packages() {
|
||||||
# install numpy, mpi4py
|
# install numpy, mpi4py
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=$PREFIX/lib/:$LD_LIBRARY_PATH
|
SITE_PROXY="socks5://localhost:4131"
|
||||||
export PYTHONPATH=$PREFIX/lib/python${SHORT_VERSION}/site-packages
|
PIP=$PREFIX/bin/pip3
|
||||||
|
|
||||||
_PIP_SITE_INDEX_URL="http://localhost:3141/root/pypi/+simple/"
|
|
||||||
export PIP_DEFAULT_TIMEOUT=2
|
export PIP_DEFAULT_TIMEOUT=2
|
||||||
export PIP_DISABLE_PIP_VERSION_CHECK=1
|
export PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||||
export PIP_INDEX_URL=$_PIP_SITE_INDEX_URL
|
export https_proxy=$SITE_PROXY; export http_proxy=$https_proxy
|
||||||
|
|
||||||
$PREFIX/bin/pip install numpy scipy dask
|
$PIP install numpy scipy dask
|
||||||
$PREFIX/bin/pip list
|
$PIP list
|
||||||
|
|
||||||
# freeze site-packages directory
|
|
||||||
chmod -R a-w $PREFIX/lib/python${SHORT_VERSION}/site-packages
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_site_packages() {
|
prepare_modulefile() {
|
||||||
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() {
|
MODFILE=$PREFIX/../modulefiles/$VERSION.lua
|
||||||
# create link if shared directory does not exist
|
MODFILE_DIR=$(dirname $MODFILE)
|
||||||
GENERAL_PYTHON=/sw/general/x86_64/development/python
|
TEMPLATE="/sw/general/x86_64/development/python/share/template_modulefile.lua"
|
||||||
PYTHON_PREFIX=$PREFIX/../../ # all python stuff is here
|
|
||||||
SHARED=$PYTHON_PREFIX/share
|
|
||||||
[ ! -d "$SHARED" ] && ln -s $GENERAL_PYTHON/share $SHARED
|
|
||||||
|
|
||||||
# report
|
test -r $TEMPLATE || (echo "No template for modulefile, skipping"; return)
|
||||||
[ -d "$SHARED" ] && echo "Share directory is present."
|
|
||||||
}
|
|
||||||
|
|
||||||
enable_pip_site() {
|
# further variables for the template
|
||||||
# create link from share/bin/pip-site into $SHORT_VERSION/bin
|
INSTALL_DATE=$(date +"%Y-%m-%d")
|
||||||
PYTHON_SITE_HOME=$PREFIX/../../$SHORT_VERSION
|
mkdir -p $MODFILE_DIR
|
||||||
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
|
# this is a dirty hack: envsubst only substitutes exported/environment variables,
|
||||||
[ -f "$PIP_SITE" ] && echo "pip-site is present."
|
# thus use compgen to export all shell variables
|
||||||
[ ! -f "$PIP_SITE" ] && echo "pip-site is NOT present."
|
export $(compgen -v)
|
||||||
|
cat $TEMPLATE | envsubst > $MODFILE
|
||||||
}
|
}
|
||||||
|
|
||||||
src_setperms() {
|
src_setperms() {
|
||||||
|
@ -112,9 +119,9 @@ src_setperms() {
|
||||||
|
|
||||||
set_symlinks() {
|
set_symlinks() {
|
||||||
# Adding some symlinks
|
# Adding some symlinks
|
||||||
# Actually PEP 394 recomments against this, but we will do it anyway
|
# Actually PEP 394 recommends against this, but we will do it anyway
|
||||||
|
|
||||||
cd $PREFIX/bin
|
pushd $PREFIX/bin
|
||||||
FILES="python pip pydoc"
|
FILES="python pip pydoc"
|
||||||
for FILE in $FILES; do
|
for FILE in $FILES; do
|
||||||
if [ ! -f $FILE ]; then
|
if [ ! -f $FILE ]; then
|
||||||
|
@ -127,14 +134,7 @@ set_symlinks() {
|
||||||
if [ ! -f $FILE ]; then
|
if [ ! -f $FILE ]; then
|
||||||
ln -s ${FILE} python-config
|
ln -s ${FILE} python-config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# src_build() {
|
|
||||||
# make shared add_binutils_objs
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# src_install() {
|
|
||||||
# ln -s ../$PACKAGE-$VERSION/doc .
|
|
||||||
# make install || sit_fail "Installation failed"
|
|
||||||
# }
|
|
||||||
|
|
Loading…
Reference in a new issue