From 4584db66226dfa3b4a7b38dd06019ee4b3797c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Tue, 15 Jun 2010 00:12:25 +0200 Subject: [PATCH] if pycompile is needed, add "python (>= 2.6.5-1~)" to Depends (rather than replacing python2.6) --- Makefile | 2 +- debpython/pydist.py | 9 +++++---- dh_python2 | 6 +----- runtime.d/public_modules.rtremove | 6 +----- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 06fdad0..54b77da 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PREFIX ?= /usr clean: make -C tests clean - find . -name '*\.py[co]' -delete + find . -name '*.py[co]' -delete rm -f .coverage install-dev: diff --git a/debpython/pydist.py b/debpython/pydist.py index 2d83c81..7ba290f 100644 --- a/debpython/pydist.py +++ b/debpython/pydist.py @@ -46,7 +46,7 @@ PYDIST_RE = re.compile(r""" """, re.VERBOSE) -def validate(fpath, exit=False): +def validate(fpath, exit_on_error=False): """Check if pydist file looks good.""" with open(fpath) as fp: for line in fp: @@ -56,8 +56,8 @@ def validate(fpath, exit=False): if not PYDIST_RE.match(line): log.error('invalid pydist data in file %s: %s', \ fpath.rsplit('/', 1)[-1], line) - if exit: - sys.exit(3) + if exit_on_error: + exit(3) return False return True @@ -134,7 +134,8 @@ def guess_dependency(req, version): process = Popen("/usr/bin/dpkg -S %s" % query,\ shell=True, stdout=PIPE, stderr=PIPE) if process.wait() != 0: - log.error('Cannot find package that provides %s.', name) + log.error('Cannot find package that provides %s. ' + 'Please add it to debian/pydist-overrides', name) log.info("hint: `apt-file search -x '(packages|pyshared)/" +\ "%s' -l` might help", name) exit(8) diff --git a/dh_python2 b/dh_python2 index 2f08303..c6a430b 100755 --- a/dh_python2 +++ b/dh_python2 @@ -395,11 +395,7 @@ def dependencies(package, stats, options): # make sure pycompile binary is available if stats['compile']: - dep = "python2.6 (>= 2.6.5-1~)" # python-minimal uses the same version - if depends == ['python2.6']: - depends = [dep] - else: - depends.append(dep) + depends.append("python (>= 2.6.5-1~)") for interpreter, version in stats['shebangs']: if interpreter not in depends: diff --git a/runtime.d/public_modules.rtremove b/runtime.d/public_modules.rtremove index 57918c7..fac5c75 100644 --- a/runtime.d/public_modules.rtremove +++ b/runtime.d/public_modules.rtremove @@ -3,9 +3,5 @@ if which python >/dev/null 2>&1 && which pyclean >/dev/null 2>&1; then pyclean -V $2 /usr/lib/python$2/ else - find /usr/lib/python$2/ -name '*\.py[co]' -delete - # PEP 3147 mode - #TAG=`python$2 -c "import imp; print(imp.magic_tags[imp.get_magic()])"` \ - #find /usr/lib/python3/ -name "*\.$TAG\.py[co]" -delete - #find /usr/lib/python3/ -depth -empty -name '__pycache__' -delete + find /usr/lib/python$2/ -name '*.py[co]' -delete fi -- GitLab