On Sun, Jan 22, 2012 at 22:51, Jakub Wilk <jw...@debian.org> wrote: > * Jakub Wilk <jw...@debian.org>, 2012-01-15, 22:19: > >>> I think we are set with the requirements for the "new" dh_numpy? Jakub, >>> do you still have time to implement it? >> >> >> I plan to work on it on the next weekend. > > > Here's the patch, to be applied to the sid version.
thank you SO much! > Beware, it has been only > lightly tested. > > The remaining things to be done: > - Do more testing. I'll try to rebuild some packages and see how they behave; I've already tested with pytables and the dependecies are generated just fine. > - Update dh_numpy manpage. > - Update README.DebianMaints. > - Write a nice changelog entry. i'm attaching a new diff: it contains both your and the points above: what do you think? > - File a bug against pytables, asking to start using --strict. (This can be > implement even before dh_numpy starts supporting the option, because in > compat<8 debhelper commands ignore unknown options.) This has just been handled. Cheers, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi
Index: debian/control =================================================================== --- debian/control (revision 20091) +++ debian/control (working copy) @@ -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 Index: debian/dh_numpy.1 =================================================================== --- debian/dh_numpy.1 (revision 20091) +++ debian/dh_numpy.1 (working copy) @@ -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 Index: debian/dh_numpy =================================================================== --- debian/dh_numpy (revision 20091) +++ debian/dh_numpy (working copy) @@ -1,6 +1,7 @@ #!/usr/bin/perl -w # Copyright © 2010 Piotr Ożarowski <pi...@debian.org> +# Copyright © 2012 Jakub Wilk <jw...@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); } Index: debian/versions.helper =================================================================== --- debian/versions.helper (revision 0) +++ debian/versions.helper (revision 0) @@ -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() Index: debian/changelog =================================================================== --- debian/changelog (revision 20091) +++ debian/changelog (working copy) @@ -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 stricter 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 <mo...@debian.org> Sun, 29 Jan 2012 11:32:09 +0100 + python-numpy (1:1.5.1-3) unstable; urgency=low * debian/rules Index: debian/rules =================================================================== --- debian/rules (revision 20091) +++ debian/rules (working copy) @@ -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 Index: debian/README.DebianMaints =================================================================== --- debian/README.DebianMaints (revision 20091) +++ debian/README.DebianMaints (working copy) @@ -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 whatever python helper you're already 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 <mo...@debian.org> Tue, 27 Jul 2010 23:28:11 +0200 \ No newline at end of file + -- Sandro Tosi <mo...@debian.org> Sun, 29 Jan 2012 11:01:45 +0100 Index: debian/python-numpy.install =================================================================== --- debian/python-numpy.install (revision 20091) +++ debian/python-numpy.install (working copy) @@ -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 Index: debian/versions =================================================================== --- debian/versions (revision 0) +++ debian/versions (revision 0) @@ -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