diff -Nru python-central-0.6.11ubuntu2/debian/changelog python-central-0.6.11ubuntu3/debian/changelog --- python-central-0.6.11ubuntu2/debian/changelog 2009-02-24 19:16:11.000000000 +0100 +++ python-central-0.6.11ubuntu3/debian/changelog 2009-03-11 11:47:32.000000000 +0100 @@ -1,3 +1,10 @@ +python-central (0.6.11ubuntu3) jaunty; urgency=low + + * re-add check for "Python-Version" in preinst + * allow removal of package with no python-version + + -- Michael Vogt Wed, 11 Mar 2009 11:42:34 +0100 + python-central (0.6.11ubuntu2) jaunty; urgency=low * dh_pycentral: Autodetect more stuff in /usr/local. diff -Nru python-central-0.6.11ubuntu2/debian/control python-central-0.6.11ubuntu3/debian/control --- python-central-0.6.11ubuntu2/debian/control 2009-02-21 15:29:58.000000000 +0100 +++ python-central-0.6.11ubuntu3/debian/control 2009-03-11 11:48:01.000000000 +0100 @@ -1,7 +1,8 @@ Source: python-central Section: python Priority: standard -Maintainer: Matthias Klose +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Matthias Klose Uploaders: Bastian Kleineidam Build-Depends: debhelper (>= 5) Build-Depends-Indep: po4a (>= 0.24), perl diff -Nru python-central-0.6.11ubuntu2/pycentral.py python-central-0.6.11ubuntu3/pycentral.py --- python-central-0.6.11ubuntu2/pycentral.py 2009-02-24 20:04:21.000000000 +0100 +++ python-central-0.6.11ubuntu3/pycentral.py 2009-03-11 11:47:14.000000000 +0100 @@ -814,10 +814,11 @@ if self.parse_versions: self.version_info = pyversions.parse_versions(version_field) - def read_version_info(self): + def read_version_info(self, use_default_if_missing=False): """Read the Python-Version information field""" if self.version_field: return + status=None if self.pkgconfig and self.pkgconfig.has_option('python-package', 'python-version'): self.version_field = self.pkgconfig.get('python-package', 'python-version') logging.debug("Using python-version from pkgconfig: %s" % self.version_field) @@ -829,7 +830,8 @@ for line in block.split("\n"): if line.startswith('Python-Version:'): self.version_field = line.split(':', 1)[1].strip() - break + if line.startswith("Status:"): + status=line.split(':', 1)[1].strip() else: logging.debug("dpkg-query -s %s" % self.name) cmd = ['/usr/bin/dpkg-query', '-s', self.name] @@ -844,10 +846,15 @@ for line in fd: if line.startswith('Python-Version:'): self.version_field = line.split(':', 1)[1].strip() - break + if line.startswith("Status:"): + status=line.split(':', 1)[1].strip() fd.close() # now verify/parse it + if not self.version_field and use_default_if_missing: + logging.warn("%s: is in a bad state, probably from a previous install without proper Python-Version field, assuming default runtime" % self.name) + self.version_field = get_default_runtime().version if not self.version_field: + raise PyCentralError, "package has no field Python-Version" if self.parse_versions: self.version_info = pyversions.parse_versions(self.version_field) @@ -1483,6 +1490,10 @@ return self.errors_occured def run(self, global_options): + # run check if the package has a python version so that we can + # fail early + pkg = DebPackage('package', self.args[0], oldstyle=False) + pkg.read_version_info() # functionality disabled starting with 0.6.9 return @@ -1594,7 +1605,7 @@ def run(self, global_options): runtimes = get_installed_runtimes(with_unsupported=True) pkg = DebPackage('package', self.args[0], oldstyle=False) - pkg.read_version_info() + pkg.read_version_info(use_default_if_missing=True) try: pkg.set_default_runtime_from_version_info() except ValueError: