Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 303885

Summary: portageq should be importable by python
Product: Portage Development Reporter: michael <michael>
Component: Core - External InteractionAssignee: Portage team <dev-portage>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description michael@smith-li.com 2010-02-07 17:52:46 UTC
It should be possible to import portageq and use its functions to enhance other python code that interacts with portage. Currently this is difficult because portageq executes main() without checking if it's being imported, and then quits because no options were given directly.

Reproducible: Always

Steps to Reproduce:




In addition to adding:
if __name__ == '__main__':
  main()

to the bottom of portageq, it would be very helpful if the core portageq (as opposed to its various symlinks) filename ended with the .py extension.
Comment 1 Zac Medico gentoo-dev 2010-02-07 20:08:28 UTC
Most of the functions in portageq are very simple wrappers around the existing public portage API. Which functions are you interested in using? If they are small functions that use the public API then you may just want to copy the code from portageq and use the public API directly.
Comment 2 michael@smith-li.com 2010-02-08 00:13:01 UTC
(In reply to comment #1)
> Most of the functions in portageq are very simple wrappers around the existing
> public portage API.

True, and now that I've read through what I thought was a medium-sized function, it turns out most of what it's doing is validating inputs. I can do that myself, I guess.

Thanks!

(To answer your question, I'm not entirely sure which features I would've ended up using, but I'm looking for a way to compare names from pypi to those in portage. My goal is to write a g-cpan workalike for pypi.)
Comment 3 Arfrever Frehtes Taifersar Arahesis (RETIRED) gentoo-dev 2010-02-08 12:53:06 UTC
(In reply to comment #2)
> My goal is to write a g-cpan workalike for pypi.

You might check g-pypi: http://code.google.com/p/g-pypi/
Comment 4 michael@smith-li.com 2010-02-08 13:40:48 UTC
(In reply to comment #3)
> You might check g-pypi: http://code.google.com/p/g-pypi/

Heehee. Opening a bug always finds me the answer I'm looking for. Thanks!