[Python-modules-commits] r20225 - in packages/numpy/branches/sid/debian (9 files)

morph at users.alioth.debian.org morph at users.alioth.debian.org
Tue Jan 31 21:42:50 UTC 2012


    Date: Tuesday, January 31, 2012 @ 21:42:48
  Author: morph
Revision: 20225

Enhancement to dh_numpy

Added:
  packages/numpy/branches/sid/debian/versions
  packages/numpy/branches/sid/debian/versions.helper
Modified:
  packages/numpy/branches/sid/debian/README.DebianMaints
  packages/numpy/branches/sid/debian/changelog
  packages/numpy/branches/sid/debian/control
  packages/numpy/branches/sid/debian/dh_numpy
  packages/numpy/branches/sid/debian/dh_numpy.1
  packages/numpy/branches/sid/debian/python-numpy.install
  packages/numpy/branches/sid/debian/rules

Modified: packages/numpy/branches/sid/debian/README.DebianMaints
===================================================================
--- packages/numpy/branches/sid/debian/README.DebianMaints	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/README.DebianMaints	2012-01-31 21:42:48 UTC (rev 20225)
@@ -3,26 +3,32 @@
 
 With Numpy 1.4.1 upload in unstable, we had several packages failing
 to execute due to a change in 'dtype' format (some fields were added
-at the end of the data strucutre).
+at the end of the data structure).
 
 After that, we decided to provide a reliable way to specify strict
 versioned depends on python-numpy by the packages depending on it, in
 order to avoid similar failures in future uploads.
 
-Currently you have two ways to do that:
+python-numpy provides a debhelper tool, dh_numpy, that will add Numpy
+dependencies to python:Depends substvar; what dh_numpy does is:
 
-* dh_numpy, that will add python-numpy versioned depends (using pydist
-  file information, see below) to python:Depends substvar
+* if the package is arch:all, a simple dependency on 'python-numpy' is
+  added;
+* if the package is arch:any, two dependencies are added:
+  * python-numpy-abi$N, where N is the value for the current Numpy
+    ABI, as defined by upstream C_ABI_VERSION value;
+  * python-numpy (>= $VER), where VER is the minimum python-numpy
+    package version implementing the current Numpy API, as defined by
+    upstream C_API_VERSION value.
+* if the package is arch:any and the '--strict' command-line option is
+  passed to dh_numpy, a dependency against python-numpy-api$M is
+  added, where M is the value for the current Numpy API, as defined by
+  upstream C_API_VERSION value.
 
-* dh_python2 and the pydist file shipped by python-numpy,
-  /usr/share/python/di st/python-numpy; you can read more out pydist
-  files at [1].
+The current values for API, ABI and version are available in the file
+/usr/share/numpy/versions .
 
-[1] http://alioth.debian.org/scm/loggerhead/pkg-python/python-defaults-debian/annotate/head:/README.PyDist
+You should call dh_numpy regardless of the python helper you are using
+in the package.
 
-python-support will receive the same support for pydist as of
-dh_python2, but it's not already implemented at the time or
-writing. So, in case you don't want to use dh_python2, use dh_numpy
-helper script.
-
- -- Sandro Tosi <morph at debian.org>  Tue, 27 Jul 2010 23:28:11 +0200
\ No newline at end of file
+ -- Sandro Tosi <morph at debian.org>  Sun, 29 Jan 2012 11:01:45 +0100

Modified: packages/numpy/branches/sid/debian/changelog
===================================================================
--- packages/numpy/branches/sid/debian/changelog	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/changelog	2012-01-31 21:42:48 UTC (rev 20225)
@@ -1,3 +1,15 @@
+python-numpy (1:1.5.1-4) UNRELEASED; urgency=low
+
+  [ Jakub Wilk ]
+  * Enhancement to dh_numpy: now it is able to generate dependencies also on
+    virtual packages matching Numpy API and ABI versions; this allows the
+    packages to declare less strict relationships with python-numpy, improving
+    the ability to handle Numpy newer versions transitions. A detailed
+    description of the dependencies generation is available in
+    README.DebianMaints file. Closes: #643873
+
+ -- Sandro Tosi <morph at debian.org>  Sun, 29 Jan 2012 11:32:09 +0100
+
 python-numpy (1:1.5.1-3) unstable; urgency=low
 
   * debian/rules

Modified: packages/numpy/branches/sid/debian/control
===================================================================
--- packages/numpy/branches/sid/debian/control	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/control	2012-01-31 21:42:48 UTC (rev 20225)
@@ -16,7 +16,7 @@
 Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}
 Suggests: python-numpy-doc, python-numpy-dbg, python-nose (>= 0.10.1), python-dev, gfortran
 XB-Python-Version: ${python:Versions}
-Provides: ${python:Provides}, python-numpy-dev, python-f2py
+Provides: ${python:Provides}, ${numpy:Provides}, python-numpy-dev, python-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

Modified: packages/numpy/branches/sid/debian/dh_numpy
===================================================================
--- packages/numpy/branches/sid/debian/dh_numpy	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/dh_numpy	2012-01-31 21:42:48 UTC (rev 20225)
@@ -1,6 +1,7 @@
 #!/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
@@ -23,24 +24,34 @@
 use strict;
 use Debian::Debhelper::Dh_Lib;
 
-init();
+init(options => {
+        "strict" => \$dh{STRICT},
+});
 
-my $numpy_dep;
+my %data;
 
-open(PYDIST, '/usr/share/python/dist/python-numpy') || error("cannot read python-numpy pydist file: $!\n");
-while (<PYDIST>) {
-	my($line) = $_;
-	chomp($line);
-	if ($line =~ /[^\s]*\s([^;]*).*/ ) {
-		$numpy_dep = $1;
-	}
+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;
 
-if($numpy_dep eq "") {
-	error ("cannot parse pydist 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 = 'python-numpy';
+	} elsif ($dh{STRICT}) {
+		$numpy_dep = "python-numpy-api$data{'api'}";
+	} else {
+		$numpy_dep = "python-numpy (>= $data{'api-min-version'}), python-numpy-abi$data{'abi'}";
+	}
 	addsubstvar($package, "python:Depends", $numpy_dep);
 }
 

Modified: packages/numpy/branches/sid/debian/dh_numpy.1
===================================================================
--- packages/numpy/branches/sid/debian/dh_numpy.1	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/dh_numpy.1	2012-01-31 21:42:48 UTC (rev 20225)
@@ -1,14 +1,14 @@
-.TH DH_NUMPY 1 "2010-07-27" "Numpy"
+.TH DH_NUMPY 1 "2012-01-29" "Numpy"
 .SH NAME
-dh_numpy \- adds to python:Depends the Numpy versioned depends
+dh_numpy \- adds Numpy depends to python:Depends substvar
 .SH SYNOPSYS
 \fBdh_numpy\fR [\fIdebhelper\ options\fR]
 .SH DESCRIPTION
 dh_numpy adds information about the correct versioned depends on python-numpy to python:Depends substvar.
 .PP
-This is needed because some Python extensions require strict versioned depends on python-numpy, and using this helper script is the easiest way to get them.
+This is needed because some Python extensions require strict versioned depends on python-numpy, and using this helper script is the easiest and most consistent way to get them.
 .PP
-The helper script uses the information stored in /usr/share/python/dist/python-numpy to generate the Depends information; that file is also used by dh_python2 (and from dh_pysupport when implemented) to generate the same set of Depends. This script allows you to not use dh_python2 if you don't want to.
+The helper script uses the information stored in /usr/share/numpy/versions, and the architecture type of the package, to generate the Depends information; for a detailed description of how the dependencies are generate, please refer to /usr/share/doc/python-numpy/README.DebianMaints .
 .SH "SEE ALSO"
 \fIdebhelper\fR(7)
 .PP

Modified: packages/numpy/branches/sid/debian/python-numpy.install
===================================================================
--- packages/numpy/branches/sid/debian/python-numpy.install	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/python-numpy.install	2012-01-31 21:42:48 UTC (rev 20225)
@@ -1,4 +1,5 @@
 debian/dh_numpy usr/bin
+debian/versions usr/share/numpy/
 usr/lib/python*/*-packages/*/*/*[!_][!_].so
 usr/lib/python*/*-packages/*/*/*/libnpymath.a
 usr/lib/python*/*-packages/*/*.py

Modified: packages/numpy/branches/sid/debian/rules
===================================================================
--- packages/numpy/branches/sid/debian/rules	2012-01-31 21:34:18 UTC (rev 20224)
+++ packages/numpy/branches/sid/debian/rules	2012-01-31 21:42:48 UTC (rev 20225)
@@ -71,9 +71,9 @@
 	rm -f debian/python-numpy-doc/usr/share/doc/python-numpy-doc/html/_static/jquery.js
 	dh_link -ppython-numpy-doc /usr/share/javascript/jquery/jquery.js /usr/share/doc/python-numpy-doc/html/_static/jquery.js
 
-	# create the pydist file
-	mkdir -p debian/python-numpy/usr/share/python/dist/
-	echo "numpy python-numpy (>= 1:1.5.1), python-numpy (<< 1:1.6)" > debian/python-numpy/usr/share/python/dist/python-numpy
+override_dh_gencontrol:
+	python debian/versions.helper >> debian/python-numpy.substvars
+	dh_gencontrol
 
 override_dh_compress:
 	dh_compress -X.js -Xobjects.inv

Added: packages/numpy/branches/sid/debian/versions
===================================================================
--- packages/numpy/branches/sid/debian/versions	                        (rev 0)
+++ packages/numpy/branches/sid/debian/versions	2012-01-31 21:42:48 UTC (rev 20225)
@@ -0,0 +1,13 @@
+# ABI version.
+# This number must be changed every time C_ABI_VERSION changes.
+# It's should be normally equal to C_ABI_VERSION - 0x1000000.
+abi 9
+
+# Minor API version.
+# This number must be changed every time C_API_VERSION changes.
+# It's should be normally equal to C_API_VERSION.
+api 4
+
+# Minimum version of Numpy that shares this minor API version.
+# This version must be updated every time C_API_VERSION changes.
+api-min-version 1:1.4.1

Added: packages/numpy/branches/sid/debian/versions.helper
===================================================================
--- packages/numpy/branches/sid/debian/versions.helper	                        (rev 0)
+++ packages/numpy/branches/sid/debian/versions.helper	2012-01-31 21:42:48 UTC (rev 20225)
@@ -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 'numpy:Provides=python-numpy-abi%s, python-numpy-api%s' % (data['abi'], data['api'])
+
+if __name__ == '__main__':
+    main()




More information about the Python-modules-commits mailing list