GNOME Bugzilla – Bug 318225
program is unusable for Gentoo users
Last modified: 2005-10-07 23:38:05 UTC
Please describe the problem: The distro.py script doesn't have an implementation of packageDb for gentoo users. Since emerge/portage is python based it shouldn't be too hard to cook up a patch to get the version number of a currently installed application. I'll look into it. Steps to reproduce: 1. install dogtail on gentoo and try to run one of example scripts Actual results: Stacktrace that says "Gentoo is not supported. Send patches to bugzilla" Expected results: Does this happen every time? yes Other information:
Created attachment 53190 [details] [review] hack to let it work for gentoo users This is just a hack to let the examples run anyway without support for gentoo
It seems that importing the portage module and using the following syntax will get you the distribution specific version number for a package in gentoo. smitten@home /usr/lib/portage/pym $ python Python 2.4.1 (#1, Jul 13 2005, 18:58:56) [GCC 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7. on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append ('/usr/lib/portage/pym') >>> sys.path ['', '/usr/lib/portage/pym', '/opt/gnome2/lib/python24.zip', '/opt/gnome2/lib/python2.4', '/opt/gnome2/lib/python2.4/plat-linux2', '/opt/gnome2/lib/python2.4/lib-tk', '/opt/gnome2/lib/python2.4/lib-dynload', '/opt/gnome2/lib/python2.4/site-packages', '/opt/gnome2/lib/python2.4/site-packages/dbus', '/opt/gnome2/lib/python2.4/site-packages/gtk-2.0', '/usr/lib/portage/pym'] >>> import portage >>> portage.db["/"]["vartree"].dbapi.match("mail-client/mozilla-thunderbird") ['mail-client/mozilla-thunderbird-1.0.6-r4'] >>>
Created attachment 53212 [details] [review] patch to get version numbers from portage This uses the portage module to get the version number for a packageName. The only caveat here is that in the case of slotted packages (i.e. autoconf), it gets the version of the first package returned in the list. Not sure how to make this better.
Created attachment 53213 [details] [review] changed the erroneous import sys.path to import sys
Committed.