public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: bdharring <bdharring@wisc.edu>
To: lafou@wanadoo.fr
Cc: gentoo-dev@gentoo.org
Subject: Re: [gentoo-dev] Shell script help - emerge frontend.
Date: Fri, 20 Jun 2003 16:33:02 -0500	[thread overview]
Message-ID: <C558DEB3-A366-11D7-98BE-00306580AC5C@wisc.edu> (raw)
In-Reply-To: <1056141060.32685.211.camel@biproc>


On Friday, June 20, 2003, at 03:31 PM, Philippe Lafoucrière wrote:

> Already seen pydoc portage. but many functions aren't documented, and 
> there's a lot on
> info at a time.
>
> How can I get all the categories (without subpackages)? I mean, I want
>
> app-emacs
> app-emulation
> ...
>
> and not app-emacs/analog app-emacs/apache-mode etc.
I'd start pulling apart the various sections of emerge to figure out 
how it accomplishes everything, but this code (while not guaranteed to 
be the best way) ought to be what you're after.
`
#!/usr/bin/python
import portage
global pdict; pdict = {}
global ptree
ptree = portage.portagetree()
temp = ptree.getallnodes()
for entry in temp:
     base = ''; package = ''
     (base, package) = string.split(entry, '/')
     if pdict.has_key(base):
         pdict[base].append(package)
     else:
         pdict[base] = [package]
for entry in pdict:
	print entry
`
While this is a bit more then you were after (you seemed after just 
categories), you can isolate out what you need by just grabbing the 
keys of pdict.  This leaves you w/ a hash, w/ lists of each package 
w/in each key.
~Brian


--
gentoo-dev@gentoo.org mailing list


  parent reply	other threads:[~2003-06-20 21:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-20 13:47 [gentoo-dev] Shell script help - emerge frontend Philippe Lafoucrière
2003-06-20 15:20 ` Michael Kohl
2003-06-20 16:06   ` Philippe Lafoucrière
2003-06-20 16:16     ` Philippe Lafoucrière
2003-06-20 16:56       ` Philippe Lafoucrière
2003-06-20 19:15     ` Svyatogor
2003-06-20 18:08       ` Philippe Lafoucrière
2003-06-20 20:24         ` bdharring
2003-06-20 20:31           ` Philippe Lafoucrière
     [not found]             ` <20030620231603.1aba32dd.genone@genone.homeip.net>
2003-06-20 21:32               ` Philippe Lafoucrière
2003-06-20 21:38                 ` bdharring
2003-06-20 21:50                   ` Thomas de Grenier de Latour
2003-06-20 22:38                   ` Marius Mauch
2003-06-20 21:33             ` bdharring [this message]
2003-06-21  3:52           ` Michael Kohl
2003-06-21 10:56     ` Michael Kohl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C558DEB3-A366-11D7-98BE-00306580AC5C@wisc.edu \
    --to=bdharring@wisc.edu \
    --cc=gentoo-dev@gentoo.org \
    --cc=lafou@wanadoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox