[PATCH 7/8] Use Debian ‘distro_info’ API for Debian versions and release names.
Ben Finney
bignose at debian.org
Sat Jan 14 16:26:45 UTC 2017
---
debian/changelog | 2 ++
debian/control | 2 ++
lib/debian/debian_support.py | 25 ++++++++-----------------
3 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ff49a030..aae87cf1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ python-debian (0.1.30) UNRELEASED; urgency=medium
[ Ben Finney ]
* Include the data for Debian releases in the Python distribution build.
+ * Use Debian ‘distro_info’ API for Debian versions and release names.
+ Closes: bug#849058. Thanks to Paul Gevers for the report.
--
diff --git a/debian/control b/debian/control
index 3fe99556..c6afc6c6 100644
--- a/debian/control
+++ b/debian/control
@@ -36,6 +36,7 @@ X-Python-Version: >= 2.6
Package: python-debian
Architecture: all
Depends:
+ python-distro-info,
python-chardet,
python-six (>> 1.4~),
${misc:Depends},
@@ -65,6 +66,7 @@ Description: Python modules to work with Debian-related data formats
Package: python3-debian
Architecture: all
Depends:
+ python3-distro-info,
python3-chardet,
python3-six (>> 1.4~),
${misc:Depends},
diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
index 793111b4..200fbfd1 100644
--- a/lib/debian/debian_support.py
+++ b/lib/debian/debian_support.py
@@ -29,6 +29,7 @@ import re
import types
from debian.deprecation import function_deprecated_by
+import distro_info
try:
import apt_pkg
@@ -416,24 +417,14 @@ class PseudoEnum:
class Release(PseudoEnum): pass
+
+debian_distro_info = distro_info.DebianDistroInfo()
+
def list_releases():
- releases = {}
- rels = ("buzz",
- "rez",
- "bo",
- "hamm",
- "slink",
- "potato",
- "woody",
- "sarge",
- "etch",
- "lenny",
- "squeeze",
- "wheezy",
- "jessie",
- "sid")
- for r in range(len(rels)):
- releases[rels[r]] = Release(rels[r], r)
+ releases = {
+ name: Release(name, index)
+ for (index, name) in enumerate(debian_distro_info.all)
+ }
Release.releases = releases
return releases
--
2.11.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-python-debian-maint/attachments/20170115/1cb40f72/attachment.sig>
More information about the pkg-python-debian-maint
mailing list