python-distro-info hard to use for some cases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
distro-info (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Getting information out of distro_info for some common things such as getting fullname or version for a known codename is very difficult.
There is no easy way to get a full list of all the data to filter through.
I've written a 'get_ubuntu_info' method at https:/
that gives me a list of dicts with info for each release for a given date. I called it 'get_ubuntu_info', but it works for debian.
It results in a list of dicts like:
[{'codename': 'trusty', 'devel': True,
'full_codename': 'Trusty Tahr', 'fullname': 'Ubuntu 14.04 LTS "Trusty Tahr"',
'lts': True, 'supported': True, 'version': '14.04'}]
Perhaps we could add a helper like this in the library?
It also seems there is a smll bug in output formatting if a release does not have a version (Sid and Experimental):
>>> distro_
>>> ['Debian 6.0 "Squeeze"', 'Debian 7.0 "Wheezy"', 'Debian 8.0 "Jessie"', 'Debian "Sid"', 'Debian "Experimental"']
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: distro-info 0.8.2
ProcVersionSign
Uname: Linux 3.2.0-56-virtual x86_64
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Wed Nov 20 17:12:42 2013
Ec2AMI: ami-000005ec
Ec2AMIManifest: FIXME
Ec2Availability
Ec2InstanceType: m1.tiny
Ec2Kernel: aki-00000548
Ec2Ramdisk: ari-00000548
MarkForUpload: True
ProcEnviron:
TERM=screen
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: distro-info
UpgradeStatus: No upgrade log present (probably fresh install)
For information, some conversation occurred on this in ubuntu-devel at [1] continuing into [2]. irclogs. ubuntu. com/2013/ 11/20/% 23ubuntu- devel.html# t22:21 irclogs. ubuntu. com/2013/ 11/21/% 23ubuntu- devel.html
[1] http://
[2] http://
[19:20] <smoser> bdrung, thoughts? https:/ /bugs.launchpad .net/ubuntu/ +source/ distro- info/+bug/ 1253208 version/ etc
[22:21] <bdrung> smoser: hi, i am happy to accept patches.
[22:22] <bdrung> smoser: returning a dict has the drawback that it could be hard to support if we want to change the internal
[22:22] <bdrung> smoser: we could add functions instead that take a series and return the fullname/
[01:07] <smoser> bdrung, i think its generally more functional to give me straightforward access to all data.
[01:08] <bdrung> smoser: i would prefer to keep a simple, supportable API.
[01:08] <smoser> how is returning a dict of data not supportable?
[01:10] <smoser> many times i've wanted data in the form that my function gets it.
[01:11] <smoser> its very common to want a release adjective, its version, and whether or not its an lts.
[01:29] <smoser> oh, i see. you're thinking about api other than python.
[01:29] <smoser> :-(.
[01:39] <bdrung> smoser: in case we want to change the file format, the content of the dict could change. the question is: which attributes would we guarantee to be present?
[01:41] <smoser> which of the ones i have there would you imply would not be present?
[01:41] <smoser> i didn't expose anything not already exposed
[01:41] <smoser> other than more conveniently
[01:42] <bdrung> we export codename, fullname, and release
[01:43] <bdrung> and codename
[01:43] <bdrung> how about accepting "all" as result to return a dict with these values?
[01:44] <bdrung> smoser: and you probably want a function that can map a codename to this kind of dict
[01:44] <bdrung> i'll go to bed now. good night.