vse*_*har 5 python ubuntu debian apt
我需要使用python脚本向远程服务器添加一个ppa.bash相当于我想要做的是:
$ add-apt-repository ppa:user/ppa-name
Run Code Online (Sandbox Code Playgroud)
我假设它看起来像这样:
import apt
cache = apt.Cache()
# ?? add the ppa here ??
cache.update()
cache.open(None)
cache['package_from_ppa'].mark_install()
cache.upgrade()
cache.commit()
Run Code Online (Sandbox Code Playgroud)
但我在apt模块源中找不到与添加存储库相关的内容.
取自当前(在11.04 natty中)add-apt-repository代码:
from softwareproperties.SoftwareProperties import SoftwareProperties
sp = SoftwareProperties()
sp.add_source_from_line(ppa_name)
sp.sourceslist.save()
Run Code Online (Sandbox Code Playgroud)
您应该因为添加错误检查等原因...查看当前安装的版本,如下所示:
less `which add-apt-repository`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
881 次 |
| 最近记录: |