[Reproducible-builds] [dh-python] 138/183: dh_py*: "so" files no longer detected as extensions

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Sep 19 15:30:30 UTC 2014


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository dh-python.

commit 3274702eee54582b8584afdc911dff4c9e0b50b4
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Thu Oct 17 19:58:24 2013 +0200

    dh_py*: "so" files no longer detected as extensions
---
 debian/changelog |  1 +
 dh_python2       | 12 +++++++-----
 dhpython/fs.py   |  8 ++++----
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a1df418..5d4ab52 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ dh-python (1.20131003-2) UNRELEASED; urgency=low
 
   [ Piotr Ożarowski ]
   * dh_python2: searching for packages with egg-info fixed
+  * dh_py*: "so" files no longer detected as extensions (closes: 726616)
 
  -- Stefano Rivera <stefanor at debian.org>  Sun, 06 Oct 2013 18:14:31 +0200
 
diff --git a/dh_python2 b/dh_python2
index 8279047..5c37dcc 100755
--- a/dh_python2
+++ b/dh_python2
@@ -27,7 +27,8 @@ import re
 import sys
 from filecmp import dircmp, cmpfiles, cmp as fcmp
 from optparse import OptionParser, SUPPRESS_HELP
-from os.path import isabs, isdir, islink, exists, join, normpath, realpath
+from os.path import isabs, isdir, islink, exists, join, normpath, splitext,\
+    realpath
 from shutil import copy as fcopy
 from dhpython.debhelper import DebHelper
 from dhpython.depends import Dependencies
@@ -48,6 +49,8 @@ os.umask(0o22)
 DEFAULT = default('cpython2')
 SUPPORTED = supported('cpython2')
 
+fext = lambda fname: splitext(fname)[-1][1:]
+
 
 class Scanner(Scan):
     def handle_ext(self, fpath):
@@ -118,8 +121,6 @@ def move_to_pyshared(dir1):
     dstdir = join(debian, package, 'usr/share/pyshared/',
                   '/'.join(dir1.split('/')[6:]))
 
-    fext = lambda fname: fname.rsplit('.', 1)[-1]
-
     for i in os.listdir(dir1):
         fpath1 = join(dir1, i)
         if isdir(fpath1) and not islink(fpath1):
@@ -161,7 +162,7 @@ def create_ext_links(dir1):
         fpath1 = join(dir1, i)
         if isdir(fpath1):
             create_ext_links(fpath1)
-        elif i.rsplit('.', 1)[-1] == 'so':
+        elif fext(i) == 'so':
             fpath2 = join(dstdir, i)
             if exists(fpath2):
                 continue
@@ -222,7 +223,8 @@ def share_2x(dir1, dir2, dc=None):
         common_files = cmpfiles(dir1, dir2, common_files, shallow=False)[0]
 
     for fn in common_files:
-        if 'so' in fn.split('.'):  # foo.so, bar.so.0.1.2, etc.
+        if 'so' in fn.split('.') and not fn.startswith('so'):
+            # foo.so, bar.so.0.1.2, etc.
             # in unlikely case where extensions are exactly the same
             continue
         fpath1 = join(dir1, fn)
diff --git a/dhpython/fs.py b/dhpython/fs.py
index 7276333..cfe5cc6 100644
--- a/dhpython/fs.py
+++ b/dhpython/fs.py
@@ -22,7 +22,7 @@ import logging
 import os
 import re
 from filecmp import cmp as cmpfile
-from os.path import exists, isdir, islink, join, split
+from os.path import exists, isdir, islink, join, split, splitext
 from shutil import rmtree
 from stat import ST_MODE, S_IXUSR, S_IXGRP, S_IXOTH
 from dhpython import MULTIARCH_DIR_TPL
@@ -62,7 +62,7 @@ def share_files(srcdir, dstdir, interpreter, options):
     """Try to move as many files from srcdir to dstdir as possible."""
     for i in os.listdir(srcdir):
         fpath1 = join(srcdir, i)
-        if not options.no_ext_rename and i.rsplit('.', 1)[-1] == 'so':
+        if not options.no_ext_rename and splitext(i)[-1] == '.so':
             # try to rename extension here as well (in :meth:`scan` info about
             # Python version is gone)
             version = interpreter.parse_public_version(srcdir)
@@ -177,7 +177,7 @@ class Scan:
                         os.remove(fpath)
                     continue
 
-                fext = fn.rsplit('.', 1)[-1]
+                fext = splitext(fn)[-1][1:]
                 if fext == 'so':
                     if not self.options.no_ext_rename:
                         fpath = self.rename_ext(fpath)
@@ -220,7 +220,7 @@ class Scan:
             return True
         if self.current_pub_version and self.is_dbg_package\
                 and self.options.clean_dbg_pkg\
-                and fpath.rsplit('.', 1)[1] not in ('so', 'h'):
+                and splitext(fpath)[-1][1:] not in ('so', 'h'):
             return True
 
     @property

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dh-python.git



More information about the Reproducible-builds mailing list