當前位置: 首頁>>代碼示例>>Python>>正文


Python distro.version方法代碼示例

本文整理匯總了Python中distro.version方法的典型用法代碼示例。如果您正苦於以下問題:Python distro.version方法的具體用法?Python distro.version怎麽用?Python distro.version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在distro的用法示例。


在下文中一共展示了distro.version方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: condUnshareNet

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def condUnshareNet(unshare_net=True):
    if USE_NSPAWN and unshare_net:
        try:
            unshare(CLONE_NEWNET)
            # Set up loopback interface and add default route via loopback in the namespace.
            # Missing default route may confuse some software, see
            # https://github.com/rpm-software-management/mock/issues/113
            ipr = IPRoute()
            dev = ipr.link_lookup(ifname='lo')[0]

            ipr.link('set', index=dev, state='up')
            ipr.route("add", dst="default", gateway="127.0.0.1")
        except exception.UnshareFailed:
            # IPC and UTS ns are supported since the same kernel version. If this
            # fails, there had to be a warning already
            pass
        except Exception as e: # pylint: disable=broad-except
            getLog().warning("network namespace setup failed: %s", e) 
開發者ID:rpm-software-management,項目名稱:mock,代碼行數:20,代碼來源:util.py

示例2: test_cli_with_root_dir_as_json

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_cli_with_root_dir_as_json(self):
        import json
        root_dir = os.path.join(RESOURCES, 'cli', 'fedora30')
        command = [sys.executable, '-m', 'distro', '-j', '--root-dir', root_dir]
        desired_output = {
            'codename': '',
            'id': 'fedora',
            'like': '',
            'version': '30',
            'version_parts': {
                'build_number': '',
                'major': '30',
                'minor': '',
            }
        }

        results = json.loads(self._run(command))
        assert desired_output == results 
開發者ID:nir0s,項目名稱:distro,代碼行數:20,代碼來源:test_distro.py

示例3: test_manjaro1512_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_manjaro1512_lsb_release(self):
        self._test_outcome({
            'id': 'manjarolinux',
            'name': 'ManjaroLinux',
            'pretty_name': 'Manjaro Linux',
            'version': '15.12',
            'pretty_version': '15.12 (Capella)',
            'best_version': '15.12',
            'codename': 'Capella'
        })

    # @pytest.mark.xfail
    # def test_openelec6_lsb_release(self):
    #     # TODO: This should be fixed as part of #109 when dealing
    #     # with distro inconsistencies
    #     desired_outcome = {
    #         'id': 'openelec',
    #         'name': 'OpenELEC',
    #         'pretty_name': 'OpenELEC (official) - Version: 6.0.3',
    #         'version': '6.0.3',
    #         'pretty_version': '6.0.3',
    #         'best_version': '6.0.3',
    #     }
    #     self._test_outcome(desired_outcome) 
開發者ID:nir0s,項目名稱:distro,代碼行數:26,代碼來源:test_distro.py

示例4: test_ubuntu14normal_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_ubuntu14normal_lsb_release(self):
        self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
                                            'ubuntu14_normal'))

        self.distro = distro.LinuxDistribution(
            include_lsb=True,
            os_release_file='path-to-non-existing-file',
            distro_release_file='path-to-non-existing-file')

        desired_outcome = {
            'id': 'ubuntu',
            'name': 'Ubuntu',
            'pretty_name': 'Ubuntu 14.04.3 LTS',
            'version': '14.04',
            'pretty_version': '14.04 (trusty)',
            'best_version': '14.04.3',
            'codename': 'trusty'
        }
        self._test_outcome(desired_outcome) 
開發者ID:nir0s,項目名稱:distro,代碼行數:21,代碼來源:test_distro.py

示例5: test_ubuntu14nomodules_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_ubuntu14nomodules_lsb_release(self):
        self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
                                            'ubuntu14_nomodules'))

        self.distro = distro.LinuxDistribution(
            include_lsb=True,
            os_release_file='path-to-non-existing-file',
            distro_release_file='path-to-non-existing-file')

        desired_outcome = {
            'id': 'ubuntu',
            'name': 'Ubuntu',
            'pretty_name': 'Ubuntu 14.04.3 LTS',
            'version': '14.04',
            'pretty_version': '14.04 (trusty)',
            'best_version': '14.04.3',
            'codename': 'trusty'
        }
        self._test_outcome(desired_outcome) 
開發者ID:nir0s,項目名稱:distro,代碼行數:21,代碼來源:test_distro.py

示例6: test_trailingblanks_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_trailingblanks_lsb_release(self):
        self._setup_for_distro(os.path.join(TESTDISTROS, 'lsb',
                                            'ubuntu14_trailingblanks'))

        self.distro = distro.LinuxDistribution(
            include_lsb=True,
            os_release_file='path-to-non-existing-file',
            distro_release_file='path-to-non-existing-file')

        desired_outcome = {
            'id': 'ubuntu',
            'name': 'Ubuntu',
            'pretty_name': 'Ubuntu 14.04.3 LTS',
            'version': '14.04',
            'pretty_version': '14.04 (trusty)',
            'best_version': '14.04.3',
            'codename': 'trusty'
        }
        self._test_outcome(desired_outcome) 
開發者ID:nir0s,項目名稱:distro,代碼行數:21,代碼來源:test_distro.py

示例7: test_unknowndistro_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_unknowndistro_release(self):
        self._setup_for_distro(os.path.join(TESTDISTROS, 'distro',
                                            'unknowndistro'))

        self.distro = distro.LinuxDistribution()

        desired_outcome = {
            'id': 'unknowndistro',
            'name': 'Unknown Distro',
            'pretty_name': 'Unknown Distro 1.0 (Unknown Codename)',
            'version': '1.0',
            'pretty_version': '1.0 (Unknown Codename)',
            'best_version': '1.0',
            'codename': 'Unknown Codename',
            'major_version': '1',
            'minor_version': '0'
        }
        self._test_outcome(desired_outcome) 
開發者ID:nir0s,項目名稱:distro,代碼行數:20,代碼來源:test_distro.py

示例8: test_slackware14_dist_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_slackware14_dist_release(self):
        desired_outcome = {
            'id': 'slackware',
            'name': 'Slackware',
            'pretty_name': 'Slackware 14.1',
            'version': '14.1',
            'pretty_version': '14.1',
            'best_version': '14.1',
            'major_version': '14',
            'minor_version': '1'
        }
        self._test_outcome(
            desired_outcome,
            'slackware',
            '14',
            release_file_suffix='version') 
開發者ID:nir0s,項目名稱:distro,代碼行數:18,代碼來源:test_distro.py

示例9: test_centos5_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_centos5_release(self):
        desired_outcome = {
            'id': 'centos',
            'name': 'CentOS',
            'pretty_name': 'CentOS 5.11 (Final)',
            'version': '5.11',
            'pretty_version': '5.11 (Final)',
            'best_version': '5.11',
            'codename': 'Final',
            'major_version': '5',
            'minor_version': '11'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'centos',
            'name': 'CentOS',
            'version_id': '5.11',
            'codename': 'Final'
        }
        self._test_release_file_info('centos-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:23,代碼來源:test_distro.py

示例10: test_centos7_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_centos7_release(self):
        desired_outcome = {
            'id': 'centos',
            'name': 'CentOS Linux',
            'pretty_name': 'CentOS Linux 7 (Core)',
            'version': '7',
            'pretty_version': '7 (Core)',
            'best_version': '7.1.1503',
            'like': 'rhel fedora',
            'codename': 'Core',
            'major_version': '7'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'centos',
            'name': 'CentOS Linux',
            'version_id': '7.1.1503',
            'codename': 'Core'
        }
        self._test_release_file_info('centos-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:23,代碼來源:test_distro.py

示例11: test_fedora19_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_fedora19_release(self):
        desired_outcome = {
            'id': 'fedora',
            'name': 'Fedora',
            'pretty_name': 'Fedora 19 (Schrödinger’s Cat)',
            'version': '19',
            'pretty_version': '19 (Schrödinger’s Cat)',
            'best_version': '19',
            'codename': 'Schrödinger’s Cat',
            'major_version': '19'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'fedora',
            'name': 'Fedora',
            'version_id': '19',
            'codename': 'Schrödinger’s Cat'
        }
        self._test_release_file_info('fedora-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:22,代碼來源:test_distro.py

示例12: test_fedora23_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_fedora23_release(self):
        desired_outcome = {
            'id': 'fedora',
            'name': 'Fedora',
            'pretty_name': 'Fedora 23 (Twenty Three)',
            'version': '23',
            'pretty_version': '23 (Twenty Three)',
            'best_version': '23',
            'codename': 'Twenty Three',
            'major_version': '23'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'fedora',
            'name': 'Fedora',
            'version_id': '23',
            'codename': 'Twenty Three'
        }
        self._test_release_file_info('fedora-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:22,代碼來源:test_distro.py

示例13: test_fedora30_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_fedora30_release(self):
        desired_outcome = {
            'id': 'fedora',
            'name': 'Fedora',
            'pretty_name': 'Fedora 30 (Thirty)',
            'version': '30',
            'pretty_version': '30',
            'best_version': '30',
            'codename': '',
            'major_version': '30'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'fedora',
            'name': 'Fedora',
            'version_id': '30',
            'codename': 'Thirty'
        }
        self._test_release_file_info('fedora-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:22,代碼來源:test_distro.py

示例14: test_kvmibm1_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_kvmibm1_release(self):
        desired_outcome = {
            'id': 'kvmibm',
            'name': 'KVM for IBM z Systems',
            'pretty_name': 'KVM for IBM z Systems 1.1.1 (Z)',
            'version': '1.1.1',
            'pretty_version': '1.1.1 (Z)',
            'best_version': '1.1.1',
            'like': 'rhel fedora',
            'codename': 'Z',
            'major_version': '1',
            'minor_version': '1',
            'build_number': '1'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'base',
            'name': 'KVM for IBM z Systems',
            'version_id': '1.1.1',
            'codename': 'Z'
        }
        self._test_release_file_info('base-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:25,代碼來源:test_distro.py

示例15: test_mageia5_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import version [as 別名]
def test_mageia5_release(self):
        desired_outcome = {
            'id': 'mageia',
            'name': 'Mageia',
            'pretty_name': 'Mageia 5',
            'version': '5',
            'pretty_version': '5 (thornicroft)',
            'best_version': '5',
            'like': 'mandriva fedora',
            # TODO: Codename differs between distro release and lsb_release.
            'codename': 'thornicroft',
            'major_version': '5'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'mageia',
            'name': 'Mageia',
            'version_id': '5',
            'codename': 'Official'
        }
        self._test_release_file_info('mageia-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:24,代碼來源:test_distro.py


注:本文中的distro.version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。