Hi, I backported some changes in python-defaults, the pycompile one should fix Lenny → Squeeze upgrades where administrator installed local version of Python (without my py_compile.py changes backported from Python 3.2 in Debian) Can I upload it? -- Piotr Ożarowski Debian GNU/Linux Developer www.ozarowski.pl www.griffith.cc www.debian.org GPG Fingerprint: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645
diff -Nru python-defaults-2.6.6/debian/changelog python-defaults-2.6.6/debian/changelog --- python-defaults-2.6.6/debian/changelog 2011-01-11 23:07:28.000000000 +0100 +++ python-defaults-2.6.6/debian/changelog 2011-02-16 23:08:55.000000000 +0100 @@ -1,3 +1,15 @@ +python-defaults (2.6.6-3+squeeze6) stable; urgency=low + + * pycompile: + - use /usr/bin/pythonX.Y rather than pythonX.Y (to avoid /usr/local + interpreters and thus fix some Lenny → Squeeze upgrades) + * dh_python2: + - add support for DH_OPTIONS env. variable + - replace a file with a symlink also if there's a matching one in + pyshared directory already + + -- Piotr Ożarowski <piotr@debian.org> Wed, 16 Feb 2011 20:33:27 +0100 + python-defaults (2.6.6-3+squeeze5) unstable; urgency=low * dh_python2: fix moving files from old debug locations diff -Nru python-defaults-2.6.6/dh_python2 python-defaults-2.6.6/dh_python2 --- python-defaults-2.6.6/dh_python2 2011-01-11 22:16:07.000000000 +0100 +++ python-defaults-2.6.6/dh_python2 2011-02-16 22:48:12.000000000 +0100 @@ -26,7 +26,7 @@ import os import re import sys -from filecmp import dircmp, cmpfiles +from filecmp import dircmp, cmpfiles, cmp as fcmp from optparse import OptionParser, SUPPRESS_HELP from os.path import isdir, islink, exists, join from shutil import rmtree, copy as fcopy @@ -236,8 +236,12 @@ # do not touch symlinks created by previous loop or other tools if dc and not islink(fpath1): # replace with a link to pyshared - os.rename(fpath1, fpath3) - relative_symlink(fpath3, fpath1) + if not exists(fpath3): + os.rename(fpath1, fpath3) + relative_symlink(fpath3, fpath1) + elif fcmp(fpath3, fpath1, shallow=False): + os.remove(fpath1) + relative_symlink(fpath3, fpath1) if dc is None: # guess/copy mode if islink(fpath1): # ralative links will work as well, it's always the same level @@ -251,7 +255,8 @@ os.rename(fpath1, fpath3) relative_symlink(fpath3, fpath1) relative_symlink(fpath3, fpath2) - else: + elif exists(fpath2) and exists(fpath3) and \ + fcmp(fpath2, fpath3, shallow=False): os.remove(fpath2) relative_symlink(fpath3, fpath2) for dn, dc in common_dirs: @@ -432,7 +437,8 @@ # ignore some debhelper options: parser.add_option('-O', help=SUPPRESS_HELP) - (options, args) = parser.parse_args() + (options, args) = parser.parse_args(sys.argv[1:] + \ + os.environ.get('DH_OPTIONS', '').split()) # regexpr option type is not used so lets check patterns here for pattern in options.regexpr or []: # fail now rather than at runtime @@ -518,7 +524,7 @@ ext_for = details.get('public_ext') if ext_for is None: # no extension - if options.vrange: + if options.vrange and options.vrange != (None, None): args += " -V %s" % vrange_str(options.vrange) elif False in ext_for: # extension's version not detected if options.vrange and '-' not in vrange_str(options.vrange): diff -Nru python-defaults-2.6.6/pycompile python-defaults-2.6.6/pycompile --- python-defaults-2.6.6/pycompile 2011-01-11 22:54:09.000000000 +0100 +++ python-defaults-2.6.6/pycompile 2011-02-16 20:39:26.000000000 +0100 @@ -125,6 +125,9 @@ def get_exclude_patterns(directory='/', patterns=None, versions=None): """Return patterns for files that shouldn't be compiled in given dir.""" + if versions is not None: + # make sure it's a set (debsorted returns a list) + versions = set(versions) if patterns: if versions is None: versions = set(SUPPORTED) @@ -169,7 +172,7 @@ def py_compile(version, optimize, workers): if not isinstance(version, basestring): version = vrepr(version) - cmd = "python%s%s -m py_compile -" \ + cmd = "/usr/bin/python%s%s -m py_compile -" \ % (version, '' if (__debug__ or not optimize) else ' -O') process = Popen(cmd, bufsize=1, shell=True, stdin=PIPE, close_fds=True)
Attachment:
signature.asc
Description: Digital signature