[Python-modules-commits] r21291 - in packages/numpy/trunk/debian (6 files)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Thu Apr 19 21:27:13 UTC 2012


    Date: Thursday, April 19, 2012 @ 21:27:11
  Author: morph
Revision: 21291

Add dh_numpy3, to generate dependencies for Python 3 packages using numpy

Added:
  packages/numpy/trunk/debian/dh_numpy3
  packages/numpy/trunk/debian/versions3.helper
Modified:
  packages/numpy/trunk/debian/changelog
  packages/numpy/trunk/debian/control
  packages/numpy/trunk/debian/python3-numpy.install
  packages/numpy/trunk/debian/rules

Modified: packages/numpy/trunk/debian/changelog
===================================================================
--- packages/numpy/trunk/debian/changelog	2012-04-19 20:33:59 UTC (rev 21290)
+++ packages/numpy/trunk/debian/changelog	2012-04-19 21:27:11 UTC (rev 21291)
@@ -1,3 +1,9 @@
+python-numpy (1:1.6.1-9) UNRELEASED; urgency=low
+
+  * Add dh_numpy3, to generate dependencies for Python 3 packages using numpy
+
+ -- Sandro Tosi <morph at debian.org>  Thu, 19 Apr 2012 23:25:43 +0200
+
 python-numpy (1:1.6.1-8) unstable; urgency=low
 
   * debian/control

Modified: packages/numpy/trunk/debian/control
===================================================================
--- packages/numpy/trunk/debian/control	2012-04-19 20:33:59 UTC (rev 21290)
+++ packages/numpy/trunk/debian/control	2012-04-19 21:27:11 UTC (rev 21291)
@@ -47,7 +47,7 @@
 Architecture: any
 Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-numpy-doc, python3-numpy-dbg, python3-nose (>= 0.10.1), python3-dev, gfortran, gcc (>= 4:4.6.1-5)
-Provides: ${python3:Provides}, ${numpy:Provides}, python3-numpy-dev, python3-f2py
+Provides: ${python3:Provides}, ${numpy3:Provides}, python3-numpy-dev, python3-f2py
 Description: Numerical Python adds a fast array facility to the Python language
  Numpy contains a powerful N-dimensional array object, sophisticated
  (broadcasting) functions, tools for integrating C/C++ and Fortran

Added: packages/numpy/trunk/debian/dh_numpy3
===================================================================
--- packages/numpy/trunk/debian/dh_numpy3	                        (rev 0)
+++ packages/numpy/trunk/debian/dh_numpy3	2012-04-19 21:27:11 UTC (rev 21291)
@@ -0,0 +1,58 @@
+#!/usr/bin/perl -w
+
+# Copyright © 2010 Piotr Ożarowski <piotr at debian.org>
+# Copyright © 2012 Jakub Wilk <jwilk at debian.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+init(options => {
+        "strict" => \$dh{STRICT},
+});
+
+my %data;
+
+open(FILE, '<', '/usr/share/numpy/versions') or error("cannot read version data: $!\n");
+while (<FILE>) {
+	chomp;
+	next unless /^[^#]/;
+	my ($key, $value) = split;
+	$data{$key} = $value;
+}
+close FILE;
+
+unless ($data{'abi'} and $data{'api'} and $data{'api-min-version'}) {
+	error("cannot parse version data file");
+}
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	my $numpy_dep;
+	if (package_arch($package) eq 'all') {
+		$numpy_dep = 'python3-numpy';
+	} elsif ($dh{STRICT}) {
+		$numpy_dep = "python3-numpy-api$data{'api'}";
+	} else {
+		$numpy_dep = "python3-numpy (>= $data{'api-min-version'}), python3-numpy-abi$data{'abi'}";
+	}
+	addsubstvar($package, "python3:Depends", $numpy_dep);
+}
+
+exit 0

Modified: packages/numpy/trunk/debian/python3-numpy.install
===================================================================
--- packages/numpy/trunk/debian/python3-numpy.install	2012-04-19 20:33:59 UTC (rev 21290)
+++ packages/numpy/trunk/debian/python3-numpy.install	2012-04-19 21:27:11 UTC (rev 21291)
@@ -1,3 +1,4 @@
+debian/dh_numpy3 usr/bin
 usr/lib/python3*/*-packages/*/*/*.cpython-3?[!d]*.so
 usr/lib/python3*/*-packages/*/*/*/libnpymath.a
 usr/lib/python3*/*-packages/*/*.py

Modified: packages/numpy/trunk/debian/rules
===================================================================
--- packages/numpy/trunk/debian/rules	2012-04-19 20:33:59 UTC (rev 21290)
+++ packages/numpy/trunk/debian/rules	2012-04-19 21:27:11 UTC (rev 21291)
@@ -93,6 +93,7 @@
 
 override_dh_gencontrol:
 	python debian/versions.helper >> debian/python-numpy.substvars
+	python debian/versions3.helper >> debian/python3-numpy.substvars
 	dh_gencontrol
 
 override_dh_compress:

Added: packages/numpy/trunk/debian/versions3.helper
===================================================================
--- packages/numpy/trunk/debian/versions3.helper	                        (rev 0)
+++ packages/numpy/trunk/debian/versions3.helper	2012-04-19 21:27:11 UTC (rev 21291)
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+'''
+Check if debian/versions is sane and generate substvars for numpy:Provides.
+'''
+
+import os
+
+def main():
+    os.chdir(os.path.join(os.path.dirname(__file__), '..'))
+    data = {}
+    file = open('numpy/core/setup_common.py', 'r')
+    try:
+        exec(file.read(), data)
+    finally:
+        file.close()
+    file = open('debian/versions', 'r')
+    try:
+        for line in file:
+            line = line.strip()
+            if not line or line.startswith('#'):
+                continue
+            key, value = line.split(None, 1)
+            data[key] = value
+    finally:
+        file.close()
+    assert data['abi'] == str(data['C_ABI_VERSION'] - 0x1000000), 'Is debian/versions up-to-date?'
+    assert data['api'] == str(data['C_API_VERSION']), 'Is debian/versions up-to-date?'
+    print 'numpy3:Provides=python3-numpy-abi%s, python3-numpy-api%s' % (data['abi'], data['api'])
+
+if __name__ == '__main__':
+    main()




More information about the Python-modules-commits mailing list