Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 198 lines (150 sloc) 5.58 KB
#!/bin/bash
# ------------------------------------------------------------------- Debug
COOKIE=$(mcookie|cut -c-8); grep -v V_GREP_ME $0 > /dev/shm/runme-$COOKIE.sh ; sleep 0.3; exec bash /dev/shm/runme-$COOKIE.sh
# TESTING=1
# ---------------------------------------------------------------- Preamble
PKG=pypy
VERSION=3.10-v7.3.13
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/scratch/local2/$PKG-$VERSION-$BUILD ; fi
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin
set -e
umask 022
BUILD_TMPDIR=/scratch/local2/$PKG-$VERSION-$BUILD.$USER.build.tmp
# keep pip's download cache when testing
test -z "$TESTING" && test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home/.cache/pip
mkdir -p $BUILD_TMPDIR/home/.local
# copy script to an accessible location
cp $0 $BUILD_TMPDIR; ME="$BUILD_TMPDIR/$(basename $0)"
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home
exec </dev/null
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
export LD_LIBRARY_PATH=$PREFIX/lib\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH
PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\$PKG_CONFIG_PATH
export PKG_CONFIG_PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH ; fi
EOF
. $PREFIX/profile
NPROC=$(( $(nproc) * 4 / 5 + 1 ))
export MAKEFLAGS="-j $NPROC"
BUILDDIR=$PREFIX/build
mkdir -p $BUILDDIR
cd $BUILDDIR
# -------------------------------------- Use git to track package evolution
test -d .git && rm -rf .git
git init -q; echo -e '[user]\n name = none\n email = of_your_business...' >> .git/config
echo '*' > .gitignore
function piplist() {
pip list | awk '{ printf("%-36s %s\n", $1,$2) }' | grep -v '\----' > GameOfVersions
}
function track() {
if [ -d .git ]; then
if git add -f GameOfVersions; then
git commit -q -n -m "Package: '$*'" || /bin/true
fi
fi
}
function install() {
echo "# ::INST:: # '${@+$@}'"
# no-color is nice, but doesn't work when dependencies are installed, so (mis-)use a pipe
pip install --no-color --compile --cache-dir=$HOME/.cache/pip --prefix=$PREFIX "${@+$@}" | cat
piplist
track $*
}
# -------------------------------------------------------------- Build PyPy
(
# orig: https://downloads.python.org/pypy/pypy3.10-v7.3.14-src.tar.bz2
BEEHIVE=https://beehive.molgen.mpg.de/5e4d55b173d67e5d287add014b36b918/pypy3.10-v7.3.13-src.tar.bz2
test -e pypy$VERSION-src.tar.bz2 || wget -nv $BEEHIVE
test -d pypy$VERSION-src || tar -xf pypy$VERSION-src.tar.bz2
cd pypy$VERSION-src
# mind, the doc for building is here: pypy3.10-v7.3.13-src/pypy/doc/build.rst
sed -i -e '/^RUNINTERP/ s/python.*/python2/' Makefile
make 2>&1 | cat # avoid the fractal painter :/
python2 pypy/tool/release/package.py --archive-name=pypy-$VERSION-x86_64
# Results in: Ready in /scratch/local2/pypy-3.10-v7.3.13-0.kreitler.build.tmp/usession-release-pypy3.10-v7.3.13-1/build
(
cd $PREFIX
TAR=$(ls -rt $TMPDIR/usession-release-pypy*[0-9]/build/pypy-3.10-v7.3.13-x86_64.tar.bz2 | tail -1)
tar -xf $TAR --strip-components=1
)
# it might come to happen that something down the line may just call 'python', defuse ...
test -e $PREFIX/bin/python || ln -s pypy $PREFIX/bin/python
python -m ensurepip
pip3 install --upgrade --prefix=$PREFIX -I pip
( # fix 'please update' noise from pip
cd $PREFIX/lib/pypy*/site-packages
sed -ne '/^#Epatch:pip/ s/^#Epatch:\S* // p' $ME | patch -p1 --verbose
)
)
install setuptools
piplist; track START
# -------------------------------------------------------- Install packages
PACKAGES=$(sed -e s/#.*$// <<- __PKGLIST__
numpy
keras
seaborn
pytest==6.2.5
pytest-asyncio==0.19.0 # to get rid of a deprecation warning in 0.20.3, -> 0.19.0
Pillow
SciPy
pandas
SymPy
nose
statsmodels
pysam
seaborn
scikit-learn
hvplot
pyarrow
fastcluster
snakemake
virtualenv
Dumper
plotly
svgwrite
biopython
filetype
pyperformance # this is _not_ the pypy optimized suite, by intention ...
__PKGLIST__
)
for PKG in $PACKAGES; do
install $PKG
done
# ------------------------------------------------------------ Sanity check
# load all packages, see warnings and spot installation errors
echo "# START load test."
python -c 'help("modules")' > /dev/null
echo "# END load test (passed)."
echo "# running pip check"
pip check
# I guess it makes sense that files can be read by all users ...
echo "# check for unreadable files"
cd $PREFIX
for D in bin etc include lib share; do
find $D \! -perm -004 -exec chmod -c a+r {} +
done
echo "For Deeper checks:"
echo "cd ${BUILDDIR} ; git log --patch "
exit
# -------------------------------------------------------- Included patches
#Epatch:pip # Operation 'Forever young', disable version-check per default.
#Epatch:pip # The option needs to be kept, because some tools make use of
#Epatch:pip # it and would cause pip to fail.
#Epatch:pip --- a/pip/_internal/cli/cmdoptions.py 2022-08-09 17:29:15.853442948 +0200
#Epatch:pip +++ b/pip/_internal/cli/cmdoptions.py 2022-08-10 10:31:35.124945154 +0200
#Epatch:pip @@ -892,7 +892,6 @@
#Epatch:pip dest="disable_pip_version_check",
#Epatch:pip action="store_true",
#Epatch:pip - default=False,
#Epatch:pip - help="Don't periodically check PyPI to determine whether a new version "
#Epatch:pip - "of pip is available for download. Implied with --no-index.",
#Epatch:pip + default=True,
#Epatch:pip + help="Ignore this option, the version check IS disabled.",
#Epatch:pip )
# -------------------------------------------------------- This is the end.