[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#658311: lintian: missing dependency on python-numpy-abiN



Package: lintian
Version: 2.5.4
Severity: wishlist
Tags: patch

The attached patch makes lintian detect packages which use Numpy ABI without declaring dependency on python-numpy-abiN.

Some background information can be found in bug #643873.

--
Jakub Wilk
diff --git a/checks/binaries b/checks/binaries
--- a/checks/binaries
+++ b/checks/binaries
@@ -136,6 +136,7 @@
 my $needs_depends_line = 0;
 my $has_perl_lib = 0;
 my $has_php_ext = 0;
+my $uses_numpy_c_abi = 0;
 
 my %SONAME;
 
@@ -353,6 +354,13 @@
         $has_php_ext = 1;
     }
 
+    # Python extension using Numpy C ABI?
+    if ($file =~ m,usr/lib/(?:pyshared/)?python2\.\d+/.*(?<!_d)\.so$,) {
+        if ($strings =~ m,module compiled against ABI version %x but this version of numpy is %x,) {
+            $uses_numpy_c_abi = 1;
+        }
+    }
+
     # Something other than detached debugging symbols in /usr/lib/debug paths.
     if ($file =~ m,^usr/lib/debug/(?:lib\d*|s?bin|usr|opt|dev|emul)/,) {
         if (exists($objdump->{NEEDED})) {
@@ -457,6 +465,17 @@
     }
 }
 
+# Check for dependency on python-numpy-abiN dependency (or strict versioned
+# dependency on python-numpy)
+if ($uses_numpy_c_abi and $pkg ) {
+    tag 'missing-dependency-on-numpy-abi'
+        unless
+            $depends =~ m/(?:^|,)\s*python-numpy-abi\d+\s*(?:,|\z)/ or (
+            $depends =~ m/(?:^|,)\s*python-numpy\s+\(>[>=]/ and
+            $depends =~ m/(?:^|,)\s*python-numpy\s+\(<[<=]/) or
+            $pkg eq 'python-numpy';
+}
+
 }
 
 1;
diff --git a/checks/binaries.desc b/checks/binaries.desc
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -206,6 +206,16 @@
  .
  echo "php:Depends=phpapi-$(php-config5 --phpapi)" &gt; debian/substvars
 
+Tag: missing-dependency-on-numpy-abi
+Severity: serious
+Certainty: possible
+Info: This package includes a Python extension module, which uses Numpy via its
+ binary interface. Such packages must depend on python-numpy-abi<i>N</i>.
+ .
+ If the package is using debhelper, this problem is usually due to a
+ missing dh_numpy call in <tt>debian/rules</tt>.
+Ref: /usr/share/doc/python-numpy/README.DebianMaints
+
 Tag: debug-file-should-use-detached-symbols
 Severity: normal
 Certainty: certain

Reply to: