summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-04-12 19:07:25 +0200
committerJulian Andres Klode <jak@debian.org>2009-04-12 19:07:25 +0200
commit8e4f00f1b6349b55eebce3c9cccbcab7ab438a85 (patch)
tree5f05ce0e1ab5155e54d851f24be2a0576c8e998c
parentd7e542cd8973684d110c0512a49981e672df23e1 (diff)
downloadpython-apt-8e4f00f1b6349b55eebce3c9cccbcab7ab438a85.tar.gz
apt/package.py: Handle cases where no candidate is available and
one of the deprecated properties (e.g. candidateVersion) is requested. (Closes: #523801)
-rw-r--r--apt/package.py28
-rw-r--r--debian/changelog8
-rw-r--r--po/python-apt.pot30
3 files changed, 38 insertions, 28 deletions
diff --git a/apt/package.py b/apt/package.py
index 00f563e4..0e13957f 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -529,12 +529,12 @@ class Package(object):
@DeprecatedProperty
def candidateVersion(self):
"""Return the candidate version as string."""
- return self.candidate.version
+ return getattr(self.candidate, "version", None)
@DeprecatedProperty
def candidateDependencies(self):
"""Return a list of candidate dependencies."""
- return self.candidate.dependencies
+ return getattr(self.candidate, "dependencies", None)
@DeprecatedProperty
def installedDependencies(self):
@@ -544,12 +544,12 @@ class Package(object):
@DeprecatedProperty
def architecture(self):
"""Return the Architecture of the package"""
- return self.candidate.architecture
+ return getattr(self.candidate, "architecture", None)
@DeprecatedProperty
def candidateDownloadable(self):
"""Return True if the candidate is downloadable."""
- return self.candidate.downloadable
+ return getattr(self.candidate, "downloadable", None)
@DeprecatedProperty
def installedDownloadable(self):
@@ -570,7 +570,7 @@ class Package(object):
@DeprecatedProperty
def homepage(self):
"""Return the homepage field as string."""
- return self.candidate.homepage
+ return getattr(self.candidate, "homepage", None)
@property
def section(self):
@@ -580,7 +580,7 @@ class Package(object):
@DeprecatedProperty
def priority(self):
"""Return the priority (of the candidate version)."""
- return self.candidate.priority
+ return getattr(self.candidate, "priority", None)
@DeprecatedProperty
def installedPriority(self):
@@ -590,7 +590,7 @@ class Package(object):
@DeprecatedProperty
def summary(self):
"""Return the short description (one line summary)."""
- return self.candidate.summary
+ return getattr(self.candidate, "summary", None)
@DeprecatedProperty
def description(self):
@@ -601,17 +601,17 @@ class Package(object):
See http://www.debian.org/doc/debian-policy/ch-controlfields.html
for more information.
"""
- return self.candidate.description
+ return getattr(self.candidate, "description", None)
@DeprecatedProperty
def rawDescription(self):
"""return the long description (raw)."""
- return self.candidate.raw_description
+ return getattr(self.candidate, "raw_description", None)
@DeprecatedProperty
def candidateRecord(self):
"""Return the Record of the candidate version of the package."""
- return self.candidate.record
+ return getattr(self.candidate, "record", None)
@DeprecatedProperty
def installedRecord(self):
@@ -676,7 +676,7 @@ class Package(object):
@DeprecatedProperty
def packageSize(self):
"""Return the size of the candidate deb package."""
- return self.candidate.size
+ return getattr(self.candidate, "size", None)
@DeprecatedProperty
def installedPackageSize(self):
@@ -686,7 +686,7 @@ class Package(object):
@DeprecatedProperty
def candidateInstalledSize(self):
"""Return the size of the candidate installed package."""
- return self.candidate.installed_size
+ return getattr(self.candidate, "installed_size", None)
@DeprecatedProperty
def installedSize(self):
@@ -731,6 +731,8 @@ class Package(object):
return self._changelog
if uri is None:
+ if not self.candidate:
+ pass
if self.candidate.origins[0].origin == "Debian":
uri = "http://packages.debian.org/changelogs/pool" \
"/%(src_section)s/%(prefix)s/%(src_pkg)s" \
@@ -863,7 +865,7 @@ class Package(object):
@DeprecatedProperty
def candidateOrigin(self):
"""Return a list of Origin() objects for the candidate version."""
- return self.candidate.origins
+ return getattr(self.candidate, "origins", None)
@property
def versions(self):
diff --git a/debian/changelog b/debian/changelog
index eb2a6a30..20d2167a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+python-apt (0.7.10.2) unstable; urgency=low
+
+ * apt/package.py: Handle cases where no candidate is available and
+ one of the deprecated properties (e.g. candidateVersion) is
+ requested. (Closes: #523801)
+
+ -- Julian Andres Klode <jak@debian.org> Sun, 12 Apr 2009 19:00:07 +0200
+
python-apt (0.7.10.1) unstable; urgency=low
* Fix FTBFS with python-debian (>= 0.1.13) on Python 2.4 by not using it to
diff --git a/po/python-apt.pot b/po/python-apt.pot
index 0de7caab..9c23c579 100644
--- a/po/python-apt.pot
+++ b/po/python-apt.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-03-08 19:15+0100\n"
+"POT-Creation-Date: 2009-04-12 19:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -354,16 +354,16 @@ msgstr ""
msgid "Complete"
msgstr ""
-#: ../apt/package.py:266
+#: ../apt/package.py:278
#, python-format
msgid "Invalid unicode in description for '%s' (%s). Please report."
msgstr ""
-#: ../apt/package.py:644 ../apt/package.py:748
+#: ../apt/package.py:745 ../apt/package.py:849
msgid "The list of changes is not available"
msgstr ""
-#: ../apt/package.py:752
+#: ../apt/package.py:853
#, python-format
msgid ""
"The list of changes is not available yet.\n"
@@ -372,56 +372,56 @@ msgid ""
"until the changes become available or try again later."
msgstr ""
-#: ../apt/package.py:758
+#: ../apt/package.py:859
msgid ""
"Failed to download the list of changes. \n"
"Please check your Internet connection."
msgstr ""
-#: ../apt/debfile.py:59
+#: ../apt/debfile.py:56
#, python-format
msgid "This is not a valid DEB archive, missing '%s' member"
msgstr ""
-#: ../apt/debfile.py:84
+#: ../apt/debfile.py:81
#, python-format
msgid "List of files for '%s'could not be read"
msgstr ""
-#: ../apt/debfile.py:152
+#: ../apt/debfile.py:149
#, python-format
msgid "Dependency is not satisfiable: %s\n"
msgstr ""
-#: ../apt/debfile.py:176
+#: ../apt/debfile.py:173
#, python-format
msgid "Conflicts with the installed package '%s'"
msgstr ""
-#: ../apt/debfile.py:322
+#: ../apt/debfile.py:319
#, python-format
msgid "Wrong architecture '%s'"
msgstr ""
#. the deb is older than the installed
-#: ../apt/debfile.py:328
+#: ../apt/debfile.py:325
msgid "A later version is already installed"
msgstr ""
-#: ../apt/debfile.py:348
+#: ../apt/debfile.py:345
msgid "Failed to satisfy all dependencies (broken cache)"
msgstr ""
-#: ../apt/debfile.py:379
+#: ../apt/debfile.py:376
#, python-format
msgid "Cannot install '%s'"
msgstr ""
-#: ../apt/debfile.py:487
+#: ../apt/debfile.py:484
#, python-format
msgid "Install Build-Dependencies for source package '%s' that builds %s\n"
msgstr ""
-#: ../apt/debfile.py:497
+#: ../apt/debfile.py:494
msgid "An essential package would be removed"
msgstr ""