wiki:Packages/rpm/rpm-python

Version 5 (modified by yasumichi, 10 years ago) (diff)

--

rpm-python の使用例

 RPM Guide (Fedora Draft Documentation) Chapter 16. Programming RPM with Pythonにある例が、いくつかそのままでは動かなくなっているので修正例を提示します。

Tips

クラスがどのようなメンバーを持っているか調べる

$ python 
Python 2.6.6 (r266:84292, Apr 17 2011, 03:36:41) 
[GCC 4.4.5 20101001 (Vine Linux 4.4.5-3vl6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpm
>>> print rpm.ds.__dict__
{'DNEVR': <method 'DNEVR' of 'rpm.ds' objects>, '__getattribute__': <slot wrapper '__getattribute__' of 'rpm.ds' objects>, 'BT': <method 
'BT' of 'rpm.ds' objects>, 'SetNoPromote': <method 'SetNoPromote' of 'rpm.ds' objects>, 'EVR': <method 'EVR' of 'rpm.ds' objects>, 'TagN'
: <method 'TagN' of 'rpm.ds' objects>, '__init__': <slot wrapper '__init__' of 'rpm.ds' objects>, 'Sort': <method 'Sort' of 'rpm.ds' obje
cts>, '__setattr__': <slot wrapper '__setattr__' of 'rpm.ds' objects>, '__new__': <built-in method __new__ of type object at 0x7f164cd8c2
e0>, 'next': <slot wrapper 'next' of 'rpm.ds' objects>, '__doc__': '', '__len__': <slot wrapper '__len__' of 'rpm.ds' objects>, 'Count': 
<method 'Count' of 'rpm.ds' objects>, 'Search': <method 'Search' of 'rpm.ds' objects>, '__getitem__': <slot wrapper '__getitem__' of 'rpm
.ds' objects>, 'N': <method 'N' of 'rpm.ds' objects>, 'Merge': <method 'Merge' of 'rpm.ds' objects>, '__iter__': <slot wrapper '__iter__'
 of 'rpm.ds' objects>, 'Flags': <method 'Flags' of 'rpm.ds' objects>, 'Ix': <method 'Ix' of 'rpm.ds' objects>, 'Compare': <method 'Compar
e' of 'rpm.ds' objects>, 'Rpmlib': <staticmethod object at 0x7f164e8b59f0>, 'Color': <method 'Color' of 'rpm.ds' objects>, 'Refs': <metho
d 'Refs' of 'rpm.ds' objects>, '__delattr__': <slot wrapper '__delattr__' of 'rpm.ds' objects>, 'Notify': <method 'Notify' of 'rpm.ds' ob
jects>, 'Find': <method 'Find' of 'rpm.ds' objects>}
>>> 

参考