Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 303885 - portageq should be importable by python
Summary: portageq should be importable by python
Status: RESOLVED WORKSFORME
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - External Interaction (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-07 17:52 UTC by michael@smith-li.com
Modified: 2019-10-01 11:45 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!