Source: mpi4py
Severity: wishlist
Tags: patch

Dear Maintainer,

Attached you'll find a short patch series, which:
* Changes the build system to dh_python2
* Adds Python 3 support

-- System Information:
Debian Release: wheezy/sid
  APT prefers precise-security
  APT policy: (990, 'precise-security'), (900, 'precise-updates'), (500, 
'precise'), (400, 'precise-proposed')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-24-generic (SMP w/16 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From ba056d82b4e2d9c359dbbd9893a92929571934bf Mon Sep 17 00:00:00 2001
From: "Bradley M. Froehle" <brad.froe...@gmail.com>
Date: Mon, 21 May 2012 17:02:32 -0700
Subject: [PATCH 1/2] Build using dh_python2

---
 debian/changelog             |    6 ++++++
 debian/control               |    6 ++----
 debian/python-mpi4py.install |    4 ++++
 debian/rules                 |   27 ++++++++++++++++++---------
 4 files changed, 30 insertions(+), 13 deletions(-)
 create mode 100644 debian/python-mpi4py.install

diff --git a/debian/changelog b/debian/changelog
index 43445ff..20b231e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mpi4py (1.2.2-4) unstable; urgency=low
+
+  * Build using dh_python2
+
+ -- Bradley M. Froehle <brad.froe...@gmail.com>  Mon, 21 May 2012 16:59:06 -0700
+
 mpi4py (1.2.2-3) unstable; urgency=low
 
   [ Bradley M. Froehle ]
diff --git a/debian/control b/debian/control
index 44fb7b5..cfe1e37 100644
--- a/debian/control
+++ b/debian/control
@@ -6,11 +6,10 @@ Uploaders: Yaroslav Halchenko <deb...@onerussian.com>, Michael Hanke <michael.ha
 Build-Depends: debhelper (>= 7.0.50~),
                mpi-default-dev, mpi-default-bin,
                rsh-client | openssh-client,
-               python-all-dev,
+               python-all-dev (>= 2.6.6-3~),
                python-numpy,
                python-sphinx,
                python-nose,
-               python-support,
 Standards-Version: 3.9.2
 Homepage: http://code.google.com/p/mpi4py/
 Vcs-Git: git://git.debian.org/git/pkg-exppsy/mpi4py.git
@@ -37,8 +36,7 @@ Description: bindings of the Message Passing Interface (MPI) standard
 Package: python-mpi4py-dbg
 Section: debug
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends},
-         python-mpi4py (= ${binary:Version})
+Depends: ${misc:Depends}, python-mpi4py (= ${binary:Version})
 Description: bindings of the MPI standard -- debug symbols
  MPI for Python (mpi4py) provides bindings of the Message Passing
  Interface (MPI) standard for the Python programming language,
diff --git a/debian/python-mpi4py.install b/debian/python-mpi4py.install
new file mode 100644
index 0000000..3cebe92
--- /dev/null
+++ b/debian/python-mpi4py.install
@@ -0,0 +1,4 @@
+usr/lib/python2*/*-packages/*/*[!_][!_].so
+usr/lib/python2*/*-packages/*/*.py
+usr/lib/python2*/*-packages/*.egg-info
+usr/lib/python2*/*-packages/mpi4py/include/
diff --git a/debian/rules b/debian/rules
index 84eb3fe..ee11234 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,14 +2,14 @@
 # -*- makefile -*-
 
 PYVER = $(shell pyversions -d -v)
-PYVERS = $(shell pyversions -r -v)
+PY2VERS = $(shell pyversions -vr)
 
 # Enforce use of openmpi only for now,
 # could be overriden from commandline as necessary
 MPI=.openmpi
 
 %:
-	dh --buildsystem=python_distutils $@
+	dh $@ --with python2 --buildsystem=python_distutils
 
 # Enforce distutils build system to build for all supported versions
 # then build documentation
@@ -23,12 +23,23 @@ override_dh_auto_build:
 	: # objects inventory is of no use for the package
 	-rm docs/source/usrman/build/html/objects.inv
 
-override_dh_auto_install:
-	dh_auto_install --destdir=debian/python-mpi4py $@
+override_dh_install:
+	dh_install
+
+	: # create symlinks for .h files
+	for i in $(PY2VERS); do \
+	[ -d $(CURDIR)/debian/python-mpi4py/usr/include/python$$i ] || \
+		mkdir -p $(CURDIR)/debian/python-mpi4py/usr/include/python$$i; \
+		dh_link usr/lib/python$$i/dist-packages/mpi4py/include/mpi4py usr/include/python$$i/mpi4py; \
+	done
+
+	: # share -dbg and normal package doc dirs
+	rm -rf debian/python-mpi4py-dbg/usr/share/doc/python-mpi4py-dbg
+	dh_link -ppython-mpi4py-dbg usr/share/doc/python-mpi4py usr/share/doc/python-mpi4py-dbg
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	for P in $(PYVERS); do \
+	for P in $(PY2VERS); do \
 	 PYTHONPATH=`/bin/ls -d $(CURDIR)/build/lib.*-$$P` \
 	  /usr/bin/python$$P /usr/bin/nosetests -v -w test --exclude='test(PackUnpackExternal|FreePredefined)'; \
 	done
@@ -37,9 +48,7 @@ else
 endif
 
 override_dh_strip:
-	dh_strip --dbg-package=python-mpi4py-dbg
-	mv debian/python-mpi4py-dbg/usr/lib/debug/usr/lib/pyshared \
-	   debian/python-mpi4py-dbg/usr/lib/debug/usr/lib/pymodules
+	dh_strip -ppython-mpi4py --dbg-package=python-mpi4py-dbg
 
 override_dh_installchangelogs:
 	dh_installchangelogs HISTORY.txt
@@ -50,4 +59,4 @@ override_dh_compress:
 
 override_dh_auto_clean:
 	dh_auto_clean $@
-	rm -rf docs/source/usrman/build
+	rm -rf `find -name build -type d`
-- 
1.7.10

>From 48133c82d97f79622294997c7851487d394b0cab Mon Sep 17 00:00:00 2001
From: "Bradley M. Froehle" <brad.froe...@gmail.com>
Date: Mon, 21 May 2012 17:08:21 -0700
Subject: [PATCH 2/2] Add package for Python 3

---
 debian/changelog              |    3 ++-
 debian/control                |   40 ++++++++++++++++++++++++++++++++++++++++
 debian/python3-mpi4py.install |    3 +++
 debian/rules                  |   28 +++++++++++++++++++++++++++-
 4 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 debian/python3-mpi4py.install

diff --git a/debian/changelog b/debian/changelog
index 20b231e..4a274dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
 mpi4py (1.2.2-4) unstable; urgency=low
 
   * Build using dh_python2
+  * Add package for Python 3
 
- -- Bradley M. Froehle <brad.froe...@gmail.com>  Mon, 21 May 2012 16:59:06 -0700
+ -- Bradley M. Froehle <brad.froe...@gmail.com>  Mon, 21 May 2012 17:04:38 -0700
 
 mpi4py (1.2.2-3) unstable; urgency=low
 
diff --git a/debian/control b/debian/control
index cfe1e37..6a4f376 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,9 @@ Build-Depends: debhelper (>= 7.0.50~),
                python-numpy,
                python-sphinx,
                python-nose,
+               python3-all-dev,
+               python3-numpy,
+               python3-nose,
 Standards-Version: 3.9.2
 Homepage: http://code.google.com/p/mpi4py/
 Vcs-Git: git://git.debian.org/git/pkg-exppsy/mpi4py.git
@@ -52,6 +55,43 @@ Description: bindings of the MPI standard -- debug symbols
  .
  This package provides debug symbols.
 
+Package: python3-mpi4py
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}
+Recommends: mpi-default-bin
+Suggests: python3-numpy
+Description: bindings of the Message Passing Interface (MPI) standard
+ MPI for Python (mpi4py) provides bindings of the Message Passing
+ Interface (MPI) standard for the Python programming language,
+ allowing any Python program to exploit multiple processors.
+ .
+ mpi4py is constructed on top of the MPI-1/MPI-2 specification
+ and provides an object oriented interface which closely follows MPI-2
+ C++ bindings.  It supports point-to-point (sends, receives) and
+ collective (broadcasts, scatters, gathers) communications of any
+ picklable Python object as well as optimized communications of Python
+ object exposing the single-segment buffer interface (NumPy arrays,
+ builtin bytes/string/array objects).
+
+Package: python3-mpi4py-dbg
+Section: debug
+Architecture: any
+Depends: ${misc:Depends}, python3-mpi4py (= ${binary:Version})
+Description: bindings of the MPI standard -- debug symbols
+ MPI for Python (mpi4py) provides bindings of the Message Passing
+ Interface (MPI) standard for the Python programming language,
+ allowing any Python program to exploit multiple processors.
+ .
+ mpi4py is constructed on top of the MPI-1/MPI-2 specification
+ and provides an object oriented interface which closely follows MPI-2
+ C++ bindings.  It supports point-to-point (sends, receives) and
+ collective (broadcasts, scatters, gathers) communications of any
+ picklable Python object as well as optimized communications of Python
+ object exposing the single-segment buffer interface (NumPy arrays,
+ builtin bytes/string/array objects).
+ .
+ This package provides debug symbols.
+
 Package: python-mpi4py-doc
 Section: doc
 Architecture: all
diff --git a/debian/python3-mpi4py.install b/debian/python3-mpi4py.install
new file mode 100644
index 0000000..c177ff5
--- /dev/null
+++ b/debian/python3-mpi4py.install
@@ -0,0 +1,3 @@
+usr/lib/python3*/*-packages/*/*.cpython-3?[!d]*.so
+usr/lib/python3*/*-packages/mpi4py/*.py
+usr/lib/python3*/*-packages/mpi4py/include/
diff --git a/debian/rules b/debian/rules
index ee11234..9468568 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,19 +3,27 @@
 
 PYVER = $(shell pyversions -d -v)
 PY2VERS = $(shell pyversions -vr)
+PY3VERS = $(shell py3versions -vr)
 
 # Enforce use of openmpi only for now,
 # could be overriden from commandline as necessary
 MPI=.openmpi
 
 %:
-	dh $@ --with python2 --buildsystem=python_distutils
+	dh $@ --with python2,python3 --buildsystem python_distutils
 
 # Enforce distutils build system to build for all supported versions
 # then build documentation
 override_dh_auto_build:
 	dh_auto_build $@ -- \
 		--mpicc=/usr/bin/mpicc$(MPI) --mpicxx=/usr/bin/mpicxx$(MPI)
+
+	: # Build for Python 3
+	for v in $(PY3VERS); do \
+		python$$v setup.py build \
+			--mpicc=/usr/bin/mpicc$(MPI) --mpicxx=/usr/bin/mpicxx$(MPI); \
+	done
+
 	: # Build documentation now
 	PYTHONPATH=`/bin/ls -d $(CURDIR)/build/lib.*$(PYVER)` \
 	 make -C docs/source/usrman/ html
@@ -23,6 +31,14 @@ override_dh_auto_build:
 	: # objects inventory is of no use for the package
 	-rm docs/source/usrman/build/html/objects.inv
 
+override_dh_auto_install:
+	dh_auto_install
+
+	: # Install for Python 3
+	for v in $(PY3VERS); do \
+		python$$v setup.py install  --root=$(CURDIR)/debian/tmp --install-layout=deb; \
+	done
+
 override_dh_install:
 	dh_install
 
@@ -33,9 +49,18 @@ override_dh_install:
 		dh_link usr/lib/python$$i/dist-packages/mpi4py/include/mpi4py usr/include/python$$i/mpi4py; \
 	done
 
+	: # Python 3
+	for i in $(PY3VERS); do \
+	[ -d $(CURDIR)/debian/python3-mpi4py/usr/include/python$$i ] || \
+		mkdir -p $(CURDIR)/debian/python3-mpi4py/usr/include/python$$i; \
+		dh_link -ppython3-mpi4py usr/lib/python$$i/dist-packages/mpi4py/include/mpi4py usr/include/python$$i/mpi4py; \
+	done
+
 	: # share -dbg and normal package doc dirs
 	rm -rf debian/python-mpi4py-dbg/usr/share/doc/python-mpi4py-dbg
 	dh_link -ppython-mpi4py-dbg usr/share/doc/python-mpi4py usr/share/doc/python-mpi4py-dbg
+	rm -rf debian/python3-mpi4py-dbg/usr/share/doc/python3-mpi4py-dbg
+	dh_link -ppython3-mpi4py-dbg usr/share/doc/python3-mpi4py usr/share/doc/python3-mpi4py-dbg
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
@@ -49,6 +74,7 @@ endif
 
 override_dh_strip:
 	dh_strip -ppython-mpi4py --dbg-package=python-mpi4py-dbg
+	dh_strip -ppython3-mpi4py --dbg-package=python3-mpi4py-dbg
 
 override_dh_installchangelogs:
 	dh_installchangelogs HISTORY.txt
-- 
1.7.10

Reply via email to