[Reproducible-builds] [dh-python] 14/183: sync handling Egg files between dh_python{2, 3}

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Sep 19 15:30:14 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 046f75abe680146a95983cc68c490022b1606e90
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Sat Jun 29 16:29:46 2013 +0200

    sync handling Egg files between dh_python{2,3}
---
 dh_python2 | 28 +++++++++++++++++++++-------
 dh_python3 |  5 ++++-
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/dh_python2 b/dh_python2
index 25ab2cc..6516d4b 100755
--- a/dh_python2
+++ b/dh_python2
@@ -347,8 +347,12 @@ def scan(package, dname=None, options=None):
                     # /(s)bin or /usr/(s)bin or /usr/games
                     bin_dir = root
 
-        # handle some EGG related data (.egg-info dirs)
         for name in dirs:
+            if name == '__pycache__':
+                rmtree(join(root, name))
+                dirs.remove(name)
+                continue
+            # handle EGG related data (.egg-info dirs)
             if name.endswith('.egg-info'):
                 if dbg_package and options.clean_dbg_pkg:
                     rmtree(join(root, name))
@@ -356,9 +360,14 @@ def scan(package, dname=None, options=None):
                     continue
                 clean_name = clean_egg_name(name)
                 if clean_name != name:
-                    log.info('renaming %s to %s', name, clean_name)
-                    os.rename(join(root, name), join(root, clean_name))
-                    dirs[dirs.index(name)] = clean_name
+                    if exists(join(root, clean_name)):
+                        log.info('removing %s (%s is already available)', name, clean_name)
+                        rmtree(join(root, name))
+                        dirs[dirs.index(name)] = clean_name
+                    else:
+                        log.info('renaming %s to %s', name, clean_name)
+                        os.rename(join(root, name), join(root, clean_name))
+                        dirs[dirs.index(name)] = clean_name
         if root.endswith('.egg-info'):
             if 'requires.txt' in file_names:
                 r['requires.txt'].add(join(root, 'requires.txt'))
@@ -449,8 +458,13 @@ def scan(package, dname=None, options=None):
             if fn.endswith('.egg-info'):
                 clean_name = clean_egg_name(fn)
                 if clean_name != fn:
-                    log.info('renaming %s to %s', fn, clean_name)
-                    os.rename(join(root, fn), join(root, clean_name))
+                    if exists(join(root, clean_name)):
+                        log.info('removing %s (%s is already available)',
+                                 fn, clean_name)
+                        os.remove(join(root, fn))
+                    else:
+                        log.info('renaming %s to %s', fn, clean_name)
+                        os.rename(join(root, fn), join(root, clean_name))
                 continue
             # search for scripts in bin dirs
             if bin_dir:
@@ -641,7 +655,7 @@ def main():
             ps = package.split('-', 1)
             if len(ps) > 1 and ps[0] == 'python':
                 dh.addsubstvar(package, 'python:Provides',
-                               ', '.join("python%s-%s" % (str(i), ps[1])
+                               ', '.join("python%s-%s" % (i, ps[1])
                                for i in sorted(stats['public_vers'])))
 
         pyclean_added = False  # invoke pyclean only once in maintainer script
diff --git a/dh_python3 b/dh_python3
index 0d86a26..6298695 100755
--- a/dh_python3
+++ b/dh_python3
@@ -189,6 +189,9 @@ def scan(package, dname=None, options=None):
         if root.endswith('.egg-info'):
             if 'requires.txt' in file_names:
                 r['requires.txt'].add(join(root, 'requires.txt'))
+            if 'SOURCES.txt' in file_names:
+                file_names.remove('SOURCES.txt')
+                os.remove(join(root, 'SOURCES.txt'))
             continue
 
         # check files
@@ -441,7 +444,7 @@ def main():
         pyclean_added = False  # invoke pyclean only once in maintainer script
         if stats['compile']:
             args = ''
-            if options.vrange and options.vrange != (None, None):
+            if options.vrange:
                 args += "-V %s" % options.vrange
             dh.autoscript(package, 'postinst', 'postinst-py3compile', args)
             dh.autoscript(package, 'prerm', 'prerm-py3clean', '')

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