Skip to content

Rebuild python3 #104

Merged
merged 2 commits into from
Feb 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
224 changes: 224 additions & 0 deletions python-3.7.4-2.build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
#! /bin/bash

PKG=python
VERSION=3.7.4
BUILD=2
PYTHONVER=${VERSION%.*}

PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi

PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin

set -xe
umask 022

BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp
test -d $BUILD_TMPDIR && ( chmod -R u+rwx $BUILD_TMPDIR || true ; rm -rf $BUILD_TMPDIR )
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home

exec </dev/null

mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$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

export MAKEFLAGS="-j $(nproc)"

BUILDDIR=$PREFIX/build

mkdir -p $BUILDDIR
cd $BUILDDIR

test -e Python-$VERSION.tar.xz || wget https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tar.xz
test -d Python-$VERSION || tar xvf Python-$VERSION.tar.xz
cd Python-$VERSION

LDFLAGS="-Wl,-rpath=$PREFIX/lib" \
./configure \
--prefix=$PREFIX \
--enable-shared

make -j $(nproc)
# make test || true # 'test_socket' seems to run for ever
make install

( # sip: tool to create Python bindings for C and C++ libraries.
cd $PREFIX/build
SIP_VERSION=4.19.18
SIP_SRC=https://www.riverbankcomputing.com/static/Downloads/sip/$SIP_VERSION/sip-$SIP_VERSION.tar.gz
test -e sip-$SIP_VERSION.tar.gz || wget $SIP_SRC
test -d sip-$SIP_VERSION || tar -xf sip-$SIP_VERSION.tar.gz

cd sip-$SIP_VERSION

python3 configure.py \
-b $PREFIX/bin \
-d $PREFIX/lib/python$PYTHONVER/site-packages \
-e $PREFIX/include/python${PYTHONVER}m \
-v $PREFIX/share/sip \
--sip-module=sip

# well, right here share/sip is spoilage, but maybe some packages will use the decent sip later on ...
mkdir -p $PREFIX/share/sip
make -j $(nproc);
make install
)


( # now for the private (sic!) version required by newer PyQt
cd $PREFIX/build
mkdir -p private_sip
cd private_sip
SIP_VERSION=4.19.18
SIP_SRC=https://www.riverbankcomputing.com/static/Downloads/sip/$SIP_VERSION/sip-$SIP_VERSION.tar.gz
test -e sip-$SIP_VERSION.tar.gz || wget $SIP_SRC
test -d sip-$SIP_VERSION || tar -xf sip-$SIP_VERSION.tar.gz

cd sip-$SIP_VERSION

# note $PREFIX/share/sip/PyQt5 is mandatory
python3 configure.py \
-d $PREFIX/lib/python$PYTHONVER/site-packages \
-v $PREFIX/share/sip/PyQt5 \
--no-tools \
--sip-module=PyQt5.sip

mkdir -p $PREFIX/share/sip/PyQt5
make -j $(nproc)
# The resulting sip.so in site-packages/PyQt5 differs indeed a bit (grep for PyQt5)
make install
)

(
PYQT_VERSION=5.13.0
PYQT_SRC=https://www.riverbankcomputing.com/static/Downloads/PyQt5/$PYQT_VERSION/PyQt5_gpl-$PYQT_VERSION.tar.gz

cd $BUILDDIR
test -e PyQt5_gpl-$PYQT_VERSION.tar.gz || wget $PYQT_SRC
test -d PyQt5_gpl-$PYQT_VERSION || tar -xf PyQt5_gpl-$PYQT_VERSION.tar.gz

cd PyQt5_gpl-$PYQT_VERSION

# export QTDIR=/usr/local/qt5
python3 configure.py \
-b $PREFIX/bin \
-d $PREFIX/lib/python$PYTHONVER/site-packages \
-n $PREFIX/share/qsci \
-q /usr/local/qt5/bin/qmake \
-v $PREFIX/share/sip/PyQt5 \
--sip-incdir=$PREFIX/include/python${PYTHONVER}m \
--confirm-license \
--no-qml-plugin \
--no-designer-plugin \
--no-dist-info \
--verbose

make -j $(nproc)

# Did I miss something in the docs ???
# w/o the *.so files inplace a clean 'make install' fails with file not found ...
# -> FileNotFoundError: [Errno 2] No such file or directory:
# '/dev/shm/python-3.7.4-0/lib/python3.7/site-packages/PyQt5/QtCore.so'
mkdir -p $PREFIX/lib/python$PYTHONVER/site-packages/PyQt5
for F in `find | grep '\.so$' | grep -v '/lib'` ; do
cp -vp $F $PREFIX/lib/python$PYTHONVER/site-packages/PyQt5/
done
make install
)

(
QSCINTILLA_VERSION=2.11.2
QSCINTILLA_SRC=https://www.riverbankcomputing.com/static/Downloads/QScintilla/$QSCINTILLA_VERSION/QScintilla_gpl-$QSCINTILLA_VERSION.tar.gz

cd $BUILDDIR
test -e QScintilla_gpl-$QSCINTILLA_VERSION.tar.gz || wget $QSCINTILLA_SRC
test -d QScintilla_gpl-$QSCINTILLA_VERSION || tar -xf QScintilla_gpl-$QSCINTILLA_VERSION.tar.gz
cd QScintilla_gpl-$QSCINTILLA_VERSION

cd Python

# apidir follows PyQt, not Qt (default is: QT_INSTALL_DATA/qsci)
# creation of PEP 376 .dist-info fails in $PREFIX/share
python3 configure.py \
--pyqt=PyQt5 \
--qmake=/usr/local/qt5/bin/qmake \
--apidir=$PREFIX/share/qsci \
--no-dist-info

make -j $(nproc)

# Call it a deja-vu, nerve ...
# -> FileNotFoundError: [Errno 2] No such file or directory: '/dev/shm/python-3.7.4-0/lib/python3.7/site-packages/PyQt5/Qsci.so'
mkdir -p $PREFIX/lib/python$PYTHONVER/site-packages/PyQt5
for F in `find | grep '\.so$' | grep -v '/lib'` ; do
cp -vp $F $PREFIX/lib/python$PYTHONVER/site-packages/PyQt5
done
make install
)

python3 -m ensurepip
pip3 install -I pip

pip3 install ipython[all]

pip3 install SciPy NumPy Matplotlib pandas SymPy nose statsmodels
# clean up some dirt that statsmodels placed also into $PREFIX
rm -vf $PREFIX/LICENSE.txt
rm -vf $PREFIX/setup.cfg

pip3 install Cython

pip3 install pysam
pip3 install seaborn
pip3 install scikit-learn
# pip3 install metaseq # fails (Latest commit fa875d1 on Jan 10, 2017)
pip3 install Mako
pip3 install meson # required in mariux

pip3 install cutadapt # Helpdesk 01/24/18 16:19, Sabrina Krakau
pip3 install pygobject # Helpdesk 03/26/18 14:19, Virginie Stanisla
pip3 install blink1 # Blink1-lib 07/04/18 12:00, Niclas Hofmann

pip3 install umi-tools
pip3 install sphinx
pip3 install recommonmark
pip3 install fastcluster
pip3 install pydot
pip3 install pygraphviz
pip3 install deeptools
pip3 install HTSeq
pip3 install keras
pip3 install MotifScan # Alena 30.8.2018
pip3 install MAmotif
pip3 install hic2cool # Helpdesk Robert Schoepflin 17.09.2018
# pip3 install hifive # only python 2.7+
pip3 install snakemake
pip3 install virtualenv # Donald
pip3 install odfpy # Donald
pip3 install Dumper # Thomas
pip3 install igraph
pip3 install louvain # monocle3 prep for Helene
pip3 install selenium # 19.7.19 Kreitler -> https://webxray.org/
pip3 install cooltools # Maria Valieva 17.7.2019
pip3 install gmpy # From viper context (Helpdesk Laura Glaser 9.8.2019)

# pip3 install HiCExplorer # Would be a nice to have, but it likes to downgrade too much, pick some cherries
pip3 install HiCMatrix
pip3 install pyGenomeTracks

pip3 install python-bioformats

pip3 install jupyterlab # request Peter Arndt
pip3 install libxml2-python3 # required by several bee packages after swich to python3
pip3 install scour # https://github.molgen.mpg.de/mariux64/pkg-scripts/issues/98
pip3 install jupyterlab-git # https://github.molgen.mpg.de/mariux64/pkg-scripts/issues/96

exit