简体   繁体   English

从库包中获取或检索操作系统版本和架构,并使用启动板 API 下载

[英]Get or Retrieve OS versions and architectures from a library package and download it with launchpad API

How to get OS versions, builds(architectures) versions of packages?如何获取操作系统版本,构建(架构)版本的软件包?

As I know, there are similar Python packages such as launchpadlib.据我所知,有类似的 Python 包,例如 launchpadlib。 However, I cannot get OS versions, package builds with this library.但是,我无法获得操作系统版本,使用此库构建包。 I have searched but haven't found any package(s) that can give me all this information.我已经搜索过,但没有找到任何可以提供所有这些信息的软件包。

Implementation with html parser:使用 html 解析器实现:

get os series获取 os 系列

[('warty', '4.10'), ('hoary', '5.04'), ('breezy', '5.10'), ('dapper', '6.06'), ('edgy', '6.10'), ('feisty', '7.04'), ('gutsy', '7.10'), ('hardy', '8.04'), ('intrepid', '8.10'), ('jaunty', '9.04'), ('karmic', '9.10'), ('lucid', '10.04'), ('maverick', '10.10'), ('natty', '11.04'), ('oneiric', '11.10'), ('precise', '12.04'), ('quantal', '12.10'), ('raring', '13.04'), ('saucy', '13.10'), ('trusty', '14.04'), ('utopic', '14.10'), ('vivid', '15.04'), ('wily', '15.10'), ('xenial', '16.04'), ('yakkety', '16.10'), ('zesty', '17.04'), ('artful', '17.10'), ('bionic', '18.04')]

get package builds获取包构建

libc6-dev
['amd64', 'i386', 'powerpc']

get package versions获取软件包版本

libc6-dev
['2.3.2.ds1-13ubuntu2', '2.3.2.ds1-13ubuntu2.2', '2.3.2.ds1-13ubuntu2.2', '2.3.2.ds1-13ubuntu2.3']

on Ubuntu:在 Ubuntu 上:

get your os version with :获取您的操作系统版本:

 >>> import platform
 >>> platform.platform()

get your build package and versions with :使用以下命令获取构建包和版本:

 >>> import subprocess
 >>> output = subprocess.check_output("apt-cache policy libc6-dev",shell=True)

 >>> manipulate output as string.

the shell output for the apt-cache policy is: apt-cache policy的 shell 输出是:

libc6-dev: Installed: 2.23-0ubuntu10 Candidate: 2.23-0ubuntu10
Version table: *** 2.23-0ubuntu10 500 500 http://il.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages 100 /var/lib/dpkg/status 2.23-0ubuntu3 500 500 http://il.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM