From 7b97ade9b927a54b5c07b5c626b9875c4fc1dfde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Fri, 29 Jul 2011 22:42:26 +0200 Subject: [PATCH] add --no-dbg-cleaning option (to disable removing files from debug packages) --- debian/changelog | 2 ++ dh_python2 | 13 ++++++++----- dh_python2.rst | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4fab911..4780ed8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,8 @@ python-defaults (2.7.2-5) UNRELEASED; urgency=low from given package only, add --compile-all to dh_python2's call if you want the old behaviour (i.e. compile also files (plugins?) provided by other packages, which do not use a helper/bytecompile them) + - add --no-dbg-cleaning option (to disable removing files from debug + packages) * pyclean now accepts --package and private dir argument at the same time -- Piotr Ożarowski <piotr@debian.org> Thu, 28 Jul 2011 00:23:50 +0200 diff --git a/dh_python2 b/dh_python2 index 1973941..fb5d24a 100755 --- a/dh_python2 +++ b/dh_python2 @@ -299,7 +299,7 @@ def share_2x(dir1, dir2, dc=None): ### PACKAGE DETAILS ############################################ -def scan(package, dname=None): +def scan(package, dname=None, clean_dbg_pkg=True): """Gather statistics about Python files in given package.""" r = {'requires.txt': set(), 'nsp.txt': set(), @@ -359,7 +359,7 @@ def scan(package, dname=None): # handle some EGG related data (.egg-info dirs) for name in dirs: if name.endswith('.egg-info'): - if dbg_package: + if dbg_package and clean_dbg_pkg: rmtree(join(root, name)) dirs.remove(name) continue @@ -396,7 +396,7 @@ def scan(package, dname=None): os.remove(lpath) log.info('renaming %s to %s', dstfpath, fn) os.rename(dstfpath, fpath) - if dbg_package and fext not in ('so', 'h'): + if dbg_package and clean_dbg_pkg and fext not in ('so', 'h'): os.remove(join(root, fn)) continue @@ -449,7 +449,7 @@ def scan(package, dname=None): if res: r['shebangs'].add(res) - if dbg_package: + if dbg_package and clean_dbg_pkg: # remove empty directories in -dbg packages proot = proot + '/usr/lib' for root, dirs, file_names in os.walk(proot, topdown=False): @@ -516,6 +516,9 @@ def main(): help='do not translate shebangs into Debian dependencies') parser.add_option('--ignore-namespace', action='store_true', default=False, help="ignore Egg's namespace_packages.txt file and --namespace option") + parser.add_option('--no-dbg-cleaning', action='store_false', + dest='clean_dbg_pkg', default=True, + help='do not remove files from debug packages') # ignore some debhelper options: parser.add_option('-O', help=SUPPRESS_HELP) @@ -577,7 +580,7 @@ def main(): if not pyremove(package, options.vrange): exit(5) fix_locations(package) - stats = scan(package, private_dir) + stats = scan(package, private_dir, options.clean_dbg_pkg) if not private_dir: share(package, stats, options) pyshared_dir = "debian/%s/usr/share/pyshared/" % package diff --git a/dh_python2.rst b/dh_python2.rst index 6b5a398..c749576 100644 --- a/dh_python2.rst +++ b/dh_python2.rst @@ -110,6 +110,8 @@ OPTIONS --no-guessing-deps disable guessing dependencies +--no-dbg-cleaning do not remove any files from debug packages + --skip-private don't check private directories -v, --verbose turn verbose mode on -- GitLab