[Python-modules-team] Bug#664785: new patch

Julian Taylor jtaylor.debian at googlemail.com
Tue Mar 27 19:09:35 UTC 2012


attached a bit more invasive patch refactoring the rules file a bit to
reduce duplication and split the build and install steps.

note that the explicit depend on python3-numpy may only be required
until bug 665998 is fixed.
If you like the other patch better, note that this is missing and it has
a typo, replace $(BASE)/debian with $(BASE) and one python -> python3
when removing the LICENSE.txt
-------------- next part --------------
diff -Nru python-scipy-0.9.0+dfsg1/debian/changelog python-scipy-0.9.0+dfsg1/debian/changelog
--- python-scipy-0.9.0+dfsg1/debian/changelog	2011-04-07 03:32:21.000000000 +0200
+++ python-scipy-0.9.0+dfsg1/debian/changelog	2012-03-27 21:04:13.000000000 +0200
@@ -1,3 +1,13 @@
+python-scipy (0.9.0+dfsg1-2) UNRELEASED; urgency=low
+
+  * Team upload
+  * add python3 packages
+  * debian/rules:
+    - split the build into build and install step
+    - use .install files instead of direct setup.py install
+
+ -- Julian Taylor <jtaylor.debian at googlemail.com>  Tue, 27 Mar 2012 20:56:17 +0200
+
 python-scipy (0.9.0+dfsg1-1) unstable; urgency=low
 
   * New upstream release (Closes: #614407, #579041, #569008)
diff -Nru python-scipy-0.9.0+dfsg1/debian/control python-scipy-0.9.0+dfsg1/debian/control
--- python-scipy-0.9.0+dfsg1/debian/control	2011-04-07 03:32:21.000000000 +0200
+++ python-scipy-0.9.0+dfsg1/debian/control	2012-03-27 21:04:35.000000000 +0200
@@ -6,8 +6,9 @@
 Build-Depends: debhelper (>= 7.0.50~), python-all-dev (>= 2.6.6-3~),
  python-all-dbg (>= 2.5.4-1~), python-numpy (>= 1:1.5.1), python-numpy-dbg (>= 1:1.5.1),
  gfortran, sharutils, swig, libsuitesparse-dev (>= 3.1.0-3),
- libblas-dev | libatlas-base-dev, liblapack-dev | libatlas-base-dev
+ libblas-dev | libatlas-base-dev, liblapack-dev | libatlas-base-dev, python3-all-dev, python3-all-dbg, python3-numpy, python3-numpy-dbg
 X-Python-Version: >= 2.4
+X-Python3-Version: >= 3.1
 Standards-Version: 3.9.1
 Homepage: http://www.scipy.org/
 Vcs-Svn: svn://svn.debian.org/python-modules/packages/scipy/trunk
@@ -31,6 +32,23 @@
  programming tools, an expression-to-C++ compiler for fast execution, and
  others.
 
+Package: python3-scipy
+Architecture: any
+Depends: python3-numpy, ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
+Recommends: g++ | c++-compiler
+Description: scientific tools for Python3
+ SciPy supplements the popular NumPy module (python-numpy package), gathering a
+ variety of high level science and engineering modules together as a single
+ package.
+ .
+ SciPy is a set of Open Source scientific and numeric tools for Python. It
+ currently supports special functions, integration, ordinary differential
+ equation (ODE) solvers, gradient optimization, genetic algorithms, parallel
+ programming tools, an expression-to-C++ compiler for fast execution, and
+ others.
+ .
+ This package provides the Python3 version.
+
 Package: python-scipy-dbg
 Section: debug
 Architecture: any
@@ -47,3 +65,20 @@
  others.
  .
  This package provides debugging symbols for python-scipy.
+
+Package: python3-scipy-dbg
+Section: debug
+Architecture: any
+Depends: ${python3:Depends}, python3-dbg, ${shlibs:Depends}, ${misc:Depends}, python3-scipy (= ${binary:Version}), python3-numpy-dbg
+Description: scientific tools for Python3 - debugging symbols
+ SciPy supplements the popular NumPy module (python-numpy package), gathering a
+ variety of high level science and engineering modules together as a single
+ package.
+ .
+ SciPy is a set of Open Source scientific and numeric tools for Python. It
+ currently supports special functions, integration, ordinary differential
+ equation (ODE) solvers, gradient optimization, genetic algorithms, parallel
+ programming tools, an expression-to-C++ compiler for fast execution, and
+ others.
+ .
+ This package provides debugging symbols for python3-scipy.
diff -Nru python-scipy-0.9.0+dfsg1/debian/python3-scipy-dbg.install python-scipy-0.9.0+dfsg1/debian/python3-scipy-dbg.install
--- python-scipy-0.9.0+dfsg1/debian/python3-scipy-dbg.install	1970-01-01 01:00:00.000000000 +0100
+++ python-scipy-0.9.0+dfsg1/debian/python3-scipy-dbg.install	2012-03-27 21:02:41.000000000 +0200
@@ -0,0 +1,2 @@
+# extra stuff deleted in rules
+usr/lib/python3*/*-packages/
diff -Nru python-scipy-0.9.0+dfsg1/debian/python3-scipy.install python-scipy-0.9.0+dfsg1/debian/python3-scipy.install
--- python-scipy-0.9.0+dfsg1/debian/python3-scipy.install	1970-01-01 01:00:00.000000000 +0100
+++ python-scipy-0.9.0+dfsg1/debian/python3-scipy.install	2012-03-27 21:02:41.000000000 +0200
@@ -0,0 +1 @@
+usr/lib/python3*/dist-packages
diff -Nru python-scipy-0.9.0+dfsg1/debian/python-scipy-dbg.install python-scipy-0.9.0+dfsg1/debian/python-scipy-dbg.install
--- python-scipy-0.9.0+dfsg1/debian/python-scipy-dbg.install	1970-01-01 01:00:00.000000000 +0100
+++ python-scipy-0.9.0+dfsg1/debian/python-scipy-dbg.install	2012-03-27 21:02:41.000000000 +0200
@@ -0,0 +1,2 @@
+# extra stuff deleted in rules
+usr/lib/python2*/*-packages/
diff -Nru python-scipy-0.9.0+dfsg1/debian/python-scipy.install python-scipy-0.9.0+dfsg1/debian/python-scipy.install
--- python-scipy-0.9.0+dfsg1/debian/python-scipy.install	1970-01-01 01:00:00.000000000 +0100
+++ python-scipy-0.9.0+dfsg1/debian/python-scipy.install	2012-03-27 21:02:41.000000000 +0200
@@ -0,0 +1 @@
+usr/lib/python2*/dist-packages
diff -Nru python-scipy-0.9.0+dfsg1/debian/rules python-scipy-0.9.0+dfsg1/debian/rules
--- python-scipy-0.9.0+dfsg1/debian/rules	2011-04-07 03:32:21.000000000 +0200
+++ python-scipy-0.9.0+dfsg1/debian/rules	2012-03-27 21:02:41.000000000 +0200
@@ -4,42 +4,46 @@
 export FFLAGS="-fPIC"
 export ATLAS=None
 
-PYVERS:= $(shell pyversions -v -r debian/control)
+PY2VERS:= $(shell pyversions -v -r debian/control)
+PY3VERS:= $(shell py3versions -v -r debian/control)
 BASE=$(shell pwd)/debian
 DVER=$(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | sed 's/-[^-]*$$//')
 UVER=$(shell echo $(DVER) | sed "s/+dfsg.*//g")
 
 %:
-	dh --with python2 $@
+	dh $@ --with python2,python3
 
 override_dh_auto_clean:
 	rm -rf build
 	find . -name "*.pyc" -exec rm {} \;
 
-override_dh_auto_install:
-	set -e; for v in $(PYVERS); do                                   \
-		d=$(BASE)/python-scipy;                                  \
-		mkdir -m 755 -p $$d/usr/share/doc/python-scipy;          \
-		python$$v setup.py config_fc --noarch build;             \
-		python$$v setup.py install --prefix $$d/usr              \
-			--no-compile --install-layout=deb;               \
-		rm -f $$d/usr/lib/python$$v/*-packages/scipy/LICENSE.txt;\
-		python$$v setup.py clean --all;                          \
-	done
-	set -e; for v in $(PYVERS); do                                   \
-		d=$(BASE)/python-scipy-dbg;                              \
-		mkdir -m 755 -p $$d/usr/share/doc/python-scipy-dbg;      \
-		CFLAGS="-g -ggdb" python$$v-dbg setup.py config_fc       \
-					--noarch build;                  \
-		python$$v-dbg setup.py install --prefix $$d/usr          \
-			--no-compile --install-layout=deb;               \
-		rm -f $$d/usr/lib/python$$v/*-packages/scipy/LICENSE.txt;\
-		python$$v-dbg setup.py clean --all;                      \
-	done
-	find debian/python-scipy-dbg ! -type d ! -name '*_d.so' | xargs rm -f
+build-python%:
+	python$* setup.py config_fc --noarch build;
+	CFLAGS="-g -ggdb" python$*-dbg setup.py config_fc \
+				--noarch build;
+
+override_dh_auto_build: $(PY3VERS:%=build-python%) $(PY2VERS:%=build-python%)
+
+install-python%:
+	python$* setup.py install --root $(BASE)/tmp \
+		--force --no-compile --install-layout=deb;
+
+	python$*-dbg setup.py install --root $(BASE)/tmp \
+		--force --no-compile --install-layout=deb;
+
+override_dh_install: $(PY3VERS:%=install-python%) $(PY2VERS:%=install-python%)
+	dh_install
+	find debian/python-scipy -type f -name '*_d.so' -delete
+	find debian/python3-scipy -type f -name '*.cpython-*d*.so' -delete
+	find debian/python-scipy-dbg ! -type d ! -name '*_d.so' -delete
+	find debian/python3-scipy-dbg ! -type d ! -name '*.cpython-*d*.so' -delete
 	find debian/python-scipy-dbg -depth -empty -exec rmdir {} \;
+	find debian/python3-scipy-dbg -depth -empty -exec rmdir {} \;
+	rm -f $(BASE)/python-scipy*/usr/lib/python*/*-packages/scipy/LICENSE.txt;
 	rm -fr $(BASE)/python-scipy*/usr/lib/python*/*-packages/scipy/weave/examples/
 
+	# not ported to py3 in 0.9.0
+	rm -rf $(BASE)/python3-scipy/usr/lib/python3/dist-packages/scipy/weave
         #call dh_numpy
 	dh_numpy
 
@@ -50,11 +54,16 @@
 	    		chmod +x $$i;                                      \
 		fi ;                                                       \
 	done
-	sed -i '1s|.|#!/usr/bin/python\n&|' $(BASE)/python-scipy//usr/share/pyshared/scipy/cluster/tests/vq_test.py
-	sed -i '1s|.|#!/usr/bin/python\n&|' $(BASE)/python-scipy//usr/share/pyshared/scipy/stats/tests/test_stats.py
+	sed -i '1s|.|#!/usr/bin/python\n&|' $(BASE)/python-scipy/usr/share/pyshared/scipy/cluster/tests/vq_test.py
+	sed -i '1s|.|#!/usr/bin/python\n&|' $(BASE)/python-scipy/usr/share/pyshared/scipy/stats/tests/test_stats.py
+	sed -i '1s|.|#!/usr/bin/python3\n&|' $(BASE)/python3-scipy/usr/lib/python3/dist-packages/scipy/cluster/tests/vq_test.py
+	sed -i '1s|.|#!/usr/bin/python3\n&|' $(BASE)/python3-scipy/usr/lib/python3/dist-packages/scipy/stats/tests/test_stats.py
+	#replace all the usr/bin/env python
+	find $(BASE)/python3-scipy/usr/lib/python3/ -name "*.py" -type f | xargs sed -i -e "1s#usr/bin/env\s\+python\s*\$$#usr/bin/env python3#"
 
 override_dh_strip:
-	dh_strip --dbg-package=python-scipy-dbg
+	dh_strip -ppython-scipy --dbg-package=python-scipy-dbg
+	dh_strip -ppython3-scipy --dbg-package=python3-scipy-dbg
 
 get-orig-source:
 	-uscan --force-download --download-version $(UVER) --rename
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20120327/fe418325/attachment-0001.pgp>


More information about the Python-modules-team mailing list