From fb006748556b3af44cde01d13216d24680fa2528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Mon, 28 Feb 2011 20:33:02 +0100 Subject: [PATCH] default Python version and a list of supported Python versions - make egg-info files/dirs searches case insensitive (closes: #614910) --- debian/changelog | 7 ++++--- debpython/pydist.py | 8 +++++++- tests/t4/Makefile | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5545591..1e5c117 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,7 @@ -python-defaults (2.6.6-11) UNRELEASED; urgency=low +python-defaults (2.6.6-11) experimental; urgency=low * dh_python2 and pycompile: read /usr/share/python/debian_defaults to get - default Python version and a List of supported Python versions + default Python version and a list of supported Python versions * dh_python2: - fix parsing .pyinstall files (a space between file name and module name is now required) @@ -11,6 +11,7 @@ python-defaults (2.6.6-11) UNRELEASED; urgency=low - fix checking shebangs in private directories (executable bit wasn't checked correctly) - add test4 to test handling private directories + - make egg-info files/dirs searches case insensitive (closes: #614910) * pycompile: - --exclude now works with private dirs - use /usr/bin/pythonX.Y rather than pythonX.Y (to avoid /usr/local @@ -18,7 +19,7 @@ python-defaults (2.6.6-11) UNRELEASED; urgency=low * rewrite dh_python2.1, pycompile.1 and pyclean.1 manpages in ReStructured Text, add quick guide for maintainers to dh_python2 manpage - -- Piotr Ożarowski <piotr@debian.org> Sat, 15 Jan 2011 21:14:38 +0100 + -- Piotr Ożarowski <piotr@debian.org> Mon, 28 Feb 2011 20:28:05 +0100 python-defaults (2.6.6-10) experimental; urgency=low diff --git a/debpython/pydist.py b/debpython/pydist.py index 8d8bf9f..3b62ec8 100644 --- a/debpython/pydist.py +++ b/debpython/pydist.py @@ -147,12 +147,13 @@ def guess_dependency(req, version=None): return item['dependency'] # try dpkg -S - query = "'%s-?*\.egg-info'" % safe_name(name) # TODO: .dist-info + query = "'*/%s-?*\.egg-info'" % ci_regexp(safe_name(name)) # TODO: .dist-info if version: query = "%s | grep '/python%s/\|/pyshared/'" % \ (query, vrepr(version)) else: query = "%s | grep '/python2\../\|/pyshared/'" % query + print query log.debug("invoking dpkg -S %s", query) process = Popen("/usr/bin/dpkg -S %s" % query, \ @@ -210,3 +211,8 @@ def sensible_pname(egg_name): if egg_name.startswith('python-'): egg_name = egg_name[7:] return "python-%s" % egg_name.lower() + + +def ci_regexp(name): + """Return case insensitive dpkg -S regexp.""" + return ''.join("[%s%s]" % (i.upper(), i) if i.isalpha() else i for i in name.lower()) diff --git a/tests/t4/Makefile b/tests/t4/Makefile index 5400f5d..b54b521 100644 --- a/tests/t4/Makefile +++ b/tests/t4/Makefile @@ -13,7 +13,7 @@ check: grep -q Depends:.*python2.5 debian/foo/DEBIAN/control grep -q python2.4 debian/foo/usr/share/foo/baz.py test ! -x debian/foo/usr/share/foo/baz.py - grep -q Depends:.*python2.5 debian/foo/DEBIAN/control && false || true + grep -q Depends:.*python2.4 debian/foo/DEBIAN/control && false || true clean: ./debian/rules clean -- GitLab