[Reproducible-builds] [dh-python] 117/183: dh_py*: add --no-ext-rename option

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Sep 19 15:30:27 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 29a976db5279bdcd03aa3ce5fbdb8e5dc1a6a5bf
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Tue Sep 3 20:55:58 2013 +0200

    dh_py*: add --no-ext-rename option
---
 debian/changelog |  8 +++++---
 dh_pypy          |  5 ++++-
 dh_pypy.rst      |  2 ++
 dh_python2       |  5 ++++-
 dh_python2.rst   |  2 ++
 dh_python3       |  5 ++++-
 dh_python3.rst   |  2 ++
 dhpython/fs.py   | 15 ++++++++-------
 8 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d8e9f42..b69f077 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,9 @@
-dh-python (1.20130902-2) unstable; urgency=low
+dh-python (1.20130902-1) unstable; urgency=low
 
-  * Do not rename extensions in directories that include architecture triplet
-    as part of the path (closes: 721696)
+  * dh_python2, dh_python3, dh_pypy:
+    - do not rename extensions in directories that include architecture triplet
+      as part of the path (closes: 721696)
+    - add --no-ext-rename option
 
  -- Piotr Ożarowski <piotr at debian.org>  Tue, 03 Sep 2013 20:20:43 +0200
 
diff --git a/dh_pypy b/dh_pypy
index 962cc28..7509e9e 100755
--- a/dh_pypy
+++ b/dh_pypy
@@ -109,6 +109,9 @@ def main():
     parser.add_option('--no-dbg-cleaning', action='store_false',
                       dest='clean_dbg_pkg', default=True,
                       help='do not remove files from debug packages')
+    parser.add_option('--no-ext-rename', action='store_true',
+                      default=False, help='do not add magic tags nor multiarch'
+                                          ' tuples to extension file names)')
     parser.add_option('--no-shebang-rewrite', action='store_true',
                       default=False, help='do not rewrite shebangs')
     # ignore some debhelper options:
@@ -164,7 +167,7 @@ def main():
             interpreter.debug = True
 
         if not private_dir:
-            fix_locations(package, interpreter, SUPPORTED)
+            fix_locations(package, interpreter, SUPPORTED, options)
         stats = Scanner(interpreter, package, private_dir, options).result
 
         dependencies = Dependencies(package, 'pypy')
diff --git a/dh_pypy.rst b/dh_pypy.rst
index bc665cb..0e5250d 100644
--- a/dh_pypy.rst
+++ b/dh_pypy.rst
@@ -75,6 +75,8 @@ OPTIONS
 --no-guessing-deps	disable guessing dependencies
 
 --no-dbg-cleaning	do not remove any files from debug packages
+    
+--no-ext-rename	do not add magic tags nor multiarch tuples to extension file names
 
 --no-shebang-rewrite	do not rewrite shebangs
 
diff --git a/dh_python2 b/dh_python2
index 582405f..f63f14a 100755
--- a/dh_python2
+++ b/dh_python2
@@ -319,6 +319,9 @@ def main():
     parser.add_option('--no-dbg-cleaning', action='store_false',
                       dest='clean_dbg_pkg', default=True,
                       help='do not remove files from debug packages')
+    parser.add_option('--no-ext-rename', action='store_true',
+                      default=False, help='do not add magic tags nor multiarch'
+                                          ' tuples to extension file names)')
     parser.add_option('--no-shebang-rewrite', action='store_true',
                       default=False, help='do not rewrite shebangs')
     # ignore some debhelper options:
@@ -405,7 +408,7 @@ def main():
             except Exception as err:
                 log.error("%s.pyremove: %s", package, err)
                 exit(5)
-            fix_locations(package, interpreter, SUPPORTED)
+            fix_locations(package, interpreter, SUPPORTED, options)
         stats = Scanner(interpreter, package, private_dir, options).result
         if not private_dir:
             share(package, stats, options)
diff --git a/dh_python2.rst b/dh_python2.rst
index 331bc12..60c679d 100644
--- a/dh_python2.rst
+++ b/dh_python2.rst
@@ -136,6 +136,8 @@ OPTIONS
 
 --no-dbg-cleaning	do not remove any files from debug packages
 
+--no-ext-rename	do not add magic tags nor multiarch tuples to extension file names
+
 --no-shebang-rewrite	do not rewrite shebangs
 
 --skip-private	don't check private directories
diff --git a/dh_python3 b/dh_python3
index 68cdc6c..1383438 100755
--- a/dh_python3
+++ b/dh_python3
@@ -110,6 +110,9 @@ def main():
     parser.add_option('--no-dbg-cleaning', action='store_false',
                       dest='clean_dbg_pkg', default=True,
                       help='do not remove files from debug packages')
+    parser.add_option('--no-ext-rename', action='store_true',
+                      default=False, help='do not add magic tags nor multiarch'
+                                          ' tuples to extension file names)')
     parser.add_option('--no-shebang-rewrite', action='store_true',
                       default=False, help='do not rewrite shebangs')
     # ignore some debhelper options:
@@ -165,7 +168,7 @@ def main():
         interpreter.debug = package.endswith('-dbg')
 
         if not private_dir:
-            fix_locations(package, interpreter, SUPPORTED)
+            fix_locations(package, interpreter, SUPPORTED, options)
         stats = Scanner(interpreter, package, private_dir, options).result
 
         dependencies = Dependencies(package, 'cpython3')
diff --git a/dh_python3.rst b/dh_python3.rst
index e64d378..2d2b053 100644
--- a/dh_python3.rst
+++ b/dh_python3.rst
@@ -87,6 +87,8 @@ OPTIONS
 
 --no-dbg-cleaning	do not remove any files from debug packages
 
+--no-ext-rename	do not add magic tags nor multiarch tuples to extension file names
+
 --no-shebang-rewrite	do not rewrite shebangs
 
 --skip-private	don't check private directories
diff --git a/dhpython/fs.py b/dhpython/fs.py
index 0f07aca..7276333 100644
--- a/dhpython/fs.py
+++ b/dhpython/fs.py
@@ -32,7 +32,7 @@ from dhpython.interpreter import Interpreter
 log = logging.getLogger('dhpython')
 
 
-def fix_locations(package, interpreter, versions):
+def fix_locations(package, interpreter, versions, options):
     """Move files to the right location."""
     for version in versions:
         interpreter.version = version
@@ -42,7 +42,7 @@ def fix_locations(package, interpreter, versions):
             if isdir(srcdir):
                 # TODO: what about relative symlinks?
                 log.debug('moving files from %s to %s', srcdir, dstdir)
-                share_files(srcdir, dstdir, interpreter)
+                share_files(srcdir, dstdir, interpreter, options)
                 parent_dir = '/'.join(srcdir.split('/')[:-1])
                 if exists(parent_dir) and not os.listdir(parent_dir):
                     os.rmdir(parent_dir)
@@ -52,17 +52,17 @@ def fix_locations(package, interpreter, versions):
         for srcdir in interpreter.old_sitedirs(package, gdb=True):
             if isdir(srcdir):
                 log.debug('moving files from %s to %s', srcdir, dstdir)
-                share_files(srcdir, dstdir, interpreter)
+                share_files(srcdir, dstdir, interpreter, options)
                 parent_dir = '/'.join(srcdir.split('/')[:-1])
                 if exists(parent_dir) and not os.listdir(parent_dir):
                     os.rmdir(parent_dir)
 
 
-def share_files(srcdir, dstdir, interpreter):
+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 i.rsplit('.', 1)[-1] == 'so':
+        if not options.no_ext_rename and i.rsplit('.', 1)[-1] == 'so':
             # try to rename extension here as well (in :meth:`scan` info about
             # Python version is gone)
             version = interpreter.parse_public_version(srcdir)
@@ -85,7 +85,7 @@ def share_files(srcdir, dstdir, interpreter):
             os.renames(fpath1, fpath2)
             continue
         if isdir(fpath1):
-            share_files(fpath1, fpath2, interpreter)
+            share_files(fpath1, fpath2, interpreter, options)
         elif cmpfile(fpath1, fpath2, shallow=False):
             os.remove(fpath1)
         # XXX: check symlinks
@@ -179,7 +179,8 @@ class Scan:
 
                 fext = fn.rsplit('.', 1)[-1]
                 if fext == 'so':
-                    fpath = self.rename_ext(fpath)
+                    if not self.options.no_ext_rename:
+                        fpath = self.rename_ext(fpath)
                     ver = self.handle_ext(fpath)
                     if ver:
                         self.current_result.setdefault('ext_vers', set()).add(ver)

-- 
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