我正尝试通过带有Python的Yum API安装/下载RPM包。但我无法提供--downloadonly
选项,它似乎被install
方法忽略。使用Python Yum API安装RPM包--downloadonly
这是到目前为止我的代码:
import yum
yb = yum.YumBase()
args = {"name":"git", "downloadonly": True}
yb.install(**args)
yb.processDeps()
yb.buildTransaction()
yb.processTransaction()
这将在系统上安装的软件包,但不能兑现downloadonly
选项。
告诉Yum只通过Python Yum API下载包的正确方法是什么?
这绝对有趣。您可以通过查看文档来了解这些选项。 http://yum.baseurl.org/api/yum/yum/__init__.html。您还可以查看Python代码:'/usr/lib/python2.7/site-packages/yum/__ init __。py' – iamauser