如何使用 yum python API 列出、添加和删除存储库?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12988993/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to list, add and remove repositories with yum python API?
提问by Wojciech Danilo
How can I search for installed repostiries, add and delete them with yum python API (under fedora 17). I've searched tons of websites and I have found how to manage packages (like here: http://phacker.org/2008/06/20/yum-python-api/), but I have not found anywhere how to handle repositories).
如何使用 yum python API(在 fedora 17 下)搜索已安装的 repostiries,添加和删除它们。我搜索了大量网站,并找到了如何管理包的方法(例如:http: //phacker.org/2008/06/20/yum-python-api/),但我没有在任何地方找到如何处理存储库)。
I want for example to be able to get with python yum API the same result as:
例如,我希望能够使用 python yum API 获得与以下相同的结果:
yum repolist
yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm`
(the last is simmilar to yum-config-manager --add-repo; yum-config-manager --enable)
(最后一个类似于yum-config-manager --add-repo; yum-config-manager --enable)
etc.
等等。
回答by abzcoding
you can use eulfedora
你可以使用eulfedora
eulfedora.api provides complete access to the Fedora API, primarily making use of Fedora's REST API. This low-level interface is wrapped by eulfedora.server.Repository and eulfedora.models.DigitalObject, which provide a more abstract, object-oriented, and Pythonic way of interacting with a Fedora Repository or with individual objects and datastreams.
eulfedora.api 提供对 Fedora API 的完整访问,主要利用 Fedora 的 REST API。这个低级接口由 eulfedora.server.Repository 和 eulfedora.models.DigitalObject 包装,它们提供了一种更抽象、面向对象和 Pythonic 的方式来与 Fedora 存储库或单个对象和数据流进行交互。

