[Bug 1253208] Re: python-distro-info hard to use for some cases

Scott Moser smoser at ubuntu.com
Fri Dec 13 13:38:04 UTC 2013


For information, some conversation occurred on this in ubuntu-devel at [1] continuing into [2].
  [1] http://irclogs.ubuntu.com/2013/11/20/%23ubuntu-devel.html#t22:21
  [2] http://irclogs.ubuntu.com/2013/11/21/%23ubuntu-devel.html

[19:20] <smoser> bdrung, thoughts? https://bugs.launchpad.net/ubuntu/+source/distro-info/+bug/1253208
[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/version/etc
[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.


** Changed in: distro-info (Ubuntu)
       Status: New => Confirmed

** Changed in: distro-info (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to distro-info in Ubuntu.
https://bugs.launchpad.net/bugs/1253208

Title:
  python-distro-info hard to use for some cases

Status in “distro-info” package in Ubuntu:
  Confirmed

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://gist.github.com/smoser/6784120#file-distro_info_dict
  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_info.DebianDistroInfo().supported(result="fullname")
    >>> ['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
  ProcVersionSignature: User Name 3.2.0-56.86-virtual 3.2.51
  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
  Ec2AvailabilityZone: nova
  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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/distro-info/+bug/1253208/+subscriptions



More information about the foundations-bugs mailing list