Skip to content

Commit

Permalink
Start adding support for Ubuntu 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Feb 11, 2024
1 parent cfaebb5 commit cf8a65c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 35 deletions.
7 changes: 0 additions & 7 deletions tools/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,3 @@ Architecture: any
Depends: imp (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: The Integrative Modeling Platform
IMP MPI module and dependents, for openmpi.

Package: imp-python2
Section: libs
Architecture: any
Depends: imp (= ${binary:Version}), python-numpy, python-protobuf
Description: The Integrative Modeling Platform
Wrappers for Python 2 (the base IMP package contains Python 3 wrappers).
8 changes: 8 additions & 0 deletions tools/debian/make-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ cp -r tools/debian/ . || exit 1

rm debian/make-package.sh debian/make-imp-install.py || exit 1
perl -pi -e "s/\@VERSION\@/$VERSION/; s/\@DATE\@/$DATE/; s/\@CODENAME\@/$CODENAME/;" debian/changelog || exit 1

# Newer distributions don't have Python 2
if [ "${CODENAME}" = "noble" ]; then
patch -p2 < debian/no-python2.patch || exit 1
rm debian/no-python2.patch debian/imp-python2.* || exit 1
perl -pi -e "s/python2-dev, //" debian/control || exit 1
fi

# Newer distributions don't have Python 2 modules, and renamed libgsl0
if [ "${CODENAME}" = "jammy" ]; then
perl -pi -e "s/, python-numpy, python-protobuf//" debian/control || exit 1
Expand Down
60 changes: 60 additions & 0 deletions tools/debian/no-python2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/tools/debian/control b/tools/debian/control
index da30e5782c..5f47eb6548 100644
--- a/tools/debian/control
+++ b/tools/debian/control
@@ -53,10 +53,3 @@ Architecture: any
Depends: imp (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: The Integrative Modeling Platform
IMP MPI module and dependents, for openmpi.
-
-Package: imp-python2
-Section: libs
-Architecture: any
-Depends: imp (= ${binary:Version}), python-numpy, python-protobuf
-Description: The Integrative Modeling Platform
- Wrappers for Python 2 (the base IMP package contains Python 3 wrappers).
diff --git a/tools/debian/rules b/tools/debian/rules
index 72e0d7009c..8a7a440813 100755
--- a/tools/debian/rules
+++ b/tools/debian/rules
@@ -39,39 +39,12 @@ override_dh_auto_build:

override_dh_install:
$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install
- # Install Python 2 extension modules
- cd build \
- && py2_ver=`python2 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \
- && unamem=`uname -m` \
- && py2_lib=`echo /usr/lib/$${unamem}-*/libpython2*.so` \
- && py2_inc=/usr/include/python$${py2_ver} \
- && cmake .. \
- -DCMAKE_INSTALL_PYTHONDIR=/usr/lib/python2.7/dist-packages \
- -DSWIG_PYTHON_LIBRARIES=$${py2_lib} \
- -DPYTHON_INCLUDE_DIRS=$${py2_inc} \
- -DPYTHON_INCLUDE_PATH=$${py2_inc} -DPYTHON_LIBRARIES=$${py2_lib} \
- -DUSE_PYTHON2=on \
- && $(MAKE) -j4 DESTDIR=$(CURDIR)/debian/tmp install
# Bundle libTAU so users don't have to get it separately
cp build/libTAU-1.0.1/lib/debian/libTAU.so.1 debian/tmp/usr/lib/*linux*/
(cd debian/tmp/usr/lib/*linux*/ && ln -sf libTAU.so.1 libTAU.so)
- # Don't package MPI for Python2 or -dev
- rm -rf debian/tmp/usr/lib/python2*/dist-packages/IMP/mpi
- rm -rf debian/tmp/usr/lib/python2*/dist-packages/IMP/spb
- rm -f debian/tmp/usr/lib/python2*/dist-packages/_IMP_mpi*
- rm -f debian/tmp/usr/lib/python2*/dist-packages/_IMP_spb*
+ # Don't package MPI for -dev
rm -f debian/tmp/usr/lib/*/libimp_mpi*.so
rm -f debian/tmp/usr/lib/*/libimp_spb*.so
- # Replace Python 2 .py files with symlinks to Python 3 files
- # (since they are the same) but not the SWIG-generated __init__.py
- # files (since these contain config information which might be
- # different; e.g. in Ubuntu 22.04 the Python 3 wrappers include numpy
- # support but the Python 2 wrappers do not)
- (cd debian/tmp/usr/lib/python2* \
- && py3_ver=`python3 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \
- && find dist-packages -name '*.py' -a ! -name __init__.py \
- -exec ln -sf $(CURDIR)/debian/tmp/usr/lib/python$${py3_ver}/\{\} \{\} \; \
- && symlinks -rc .)
# Make sure all Python applications use the system Python in /usr/bin
perl -pi -e 's@^#!.*python.*$$@#!/usr/bin/python3@' debian/tmp/usr/bin/*
# Don't distribute example application or dependency
29 changes: 1 addition & 28 deletions tools/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -39,39 +39,12 @@ override_dh_auto_build:

override_dh_install:
$(MAKE) -C build DESTDIR=$(CURDIR)/debian/tmp install
# Install Python 2 extension modules
cd build \
&& py2_ver=`python2 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \
&& unamem=`uname -m` \
&& py2_lib=`echo /usr/lib/$${unamem}-*/libpython2*.so` \
&& py2_inc=/usr/include/python$${py2_ver} \
&& cmake .. \
-DCMAKE_INSTALL_PYTHONDIR=/usr/lib/python2.7/dist-packages \
-DSWIG_PYTHON_LIBRARIES=$${py2_lib} \
-DPYTHON_INCLUDE_DIRS=$${py2_inc} \
-DPYTHON_INCLUDE_PATH=$${py2_inc} -DPYTHON_LIBRARIES=$${py2_lib} \
-DUSE_PYTHON2=on \
&& $(MAKE) -j4 DESTDIR=$(CURDIR)/debian/tmp install
# Bundle libTAU so users don't have to get it separately
cp build/libTAU-1.0.1/lib/debian/libTAU.so.1 debian/tmp/usr/lib/*linux*/
(cd debian/tmp/usr/lib/*linux*/ && ln -sf libTAU.so.1 libTAU.so)
# Don't package MPI for Python2 or -dev
rm -rf debian/tmp/usr/lib/python2*/dist-packages/IMP/mpi
rm -rf debian/tmp/usr/lib/python2*/dist-packages/IMP/spb
rm -f debian/tmp/usr/lib/python2*/dist-packages/_IMP_mpi*
rm -f debian/tmp/usr/lib/python2*/dist-packages/_IMP_spb*
# Don't package MPI for -dev
rm -f debian/tmp/usr/lib/*/libimp_mpi*.so
rm -f debian/tmp/usr/lib/*/libimp_spb*.so
# Replace Python 2 .py files with symlinks to Python 3 files
# (since they are the same) but not the SWIG-generated __init__.py
# files (since these contain config information which might be
# different; e.g. in Ubuntu 22.04 the Python 3 wrappers include numpy
# support but the Python 2 wrappers do not)
(cd debian/tmp/usr/lib/python2* \
&& py3_ver=`python3 -c "import sys; print('%d.%d' % sys.version_info[:2])"` \
&& find dist-packages -name '*.py' -a ! -name __init__.py \
-exec ln -sf $(CURDIR)/debian/tmp/usr/lib/python$${py3_ver}/\{\} \{\} \; \
&& symlinks -rc .)
# Make sure all Python applications use the system Python in /usr/bin
perl -pi -e 's@^#!.*python.*$$@#!/usr/bin/python3@' debian/tmp/usr/bin/*
# Don't distribute example application or dependency
Expand Down

0 comments on commit cf8a65c

Please sign in to comment.