[Catalog-sig] Graphical Package Manager

Andrew Kuchling akuchlin@mems-exchange.org
Thu, 23 Jan 2003 13:43:19 -0500


On Thu, Jan 23, 2003 at 06:42:13PM +0100, Yannick Loiseau wrote:
>I've just learned about PyPI, and I've a (may be silly) question :
> is it possible to have the PyPI listing in a (hierarchical) xml format ? ...
>Is it done, planned, useless ? Does such a gui already exist ?

It's very easy to turn the plain text listing into a tree, simpler
than parsing an XML format would be.

import sys, pprint

root = {}

for line in sys.stdin:
    d = root
    for arc in line.split('::'):
        arc = arc.strip()
        d = d.setdefault(arc, {})

pprint.pprint(root)

Pipe the output of --list-classifiers to the above, 
and you get a tree of nested dictionaries:

{'': {},
 'Development Status': {'1 - Planning': {},
                        '2 - Pre-Alpha': {},
                        '3 - Alpha': {},
                        '4 - Beta': {},
                        '5 - Production/Stable': {},
                        '6 - Mature': {},
                        '7 - Inactive': {}},
 'Environment': {'Console': {'Curses': {},
                             'Framebuffer': {},
                             'Newt': {},
                             'svgalib': {}},
                 "Handhelds/PDA's": {},
                 'MacOS X': {'Cocoa': {}, 'Carbon': {}, 'Aqua': {}},
 ...

--amk                                                    (www.amk.ca)
Theory and reality rarely are kissing cousins.
      -- Christopher Petrilli, 1 Sep 1999