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


Python distro.name方法代碼示例

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


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

示例1: main

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [as 別名]
def main():

    dist_name = distro.name().lower()
    
    if dist_name in ['ubuntu', 'debian', 'kali', 'debian gnu/linux', 'kali gnu/linux']:
        debian()

    elif dist_name == 'fedora':
        fedora()

    elif dist_name in ['archlinux', 'arch', 'arch linux', 'manjaro', 'manjaro linux']:
        archlinux()

    elif dist_name == 'parrot gnu/linux':
        parrot()

    else:
        logger.error('Unhandled distribution to install deps: {}'.format(dist_name))
        logger.error('Please poke me or submit a PR.')
        return 
開發者ID:bannsec,項目名稱:stegoVeritas,代碼行數:22,代碼來源:install_deps.py

示例2: test_ubuntu14normal_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例3: test_trailingblanks_lsb_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例4: test_unknowndistro_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例5: test_slackware14_dist_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例6: test_centos5_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例7: test_centos7_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例8: test_fedora19_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例9: test_fedora23_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例10: test_fedora30_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例11: test_kvmibm1_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [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

示例12: test_manjaro1512_release

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

        self._test_release_file_info(
            'manjaro-release',
            {'id': 'manjaro',
             'name': 'Manjaro Linux'}) 
開發者ID:nir0s,項目名稱:distro,代碼行數:19,代碼來源:test_distro.py

示例13: test_opensuse42_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [as 別名]
def test_opensuse42_release(self):
        desired_outcome = {
            'id': 'opensuse',
            'name': 'openSUSE Leap',
            'pretty_name': 'openSUSE Leap 42.1 (x86_64)',
            'version': '42.1',
            'pretty_version': '42.1 (x86_64)',
            'best_version': '42.1',
            'like': 'suse',
            'codename': 'x86_64',
            'major_version': '42',
            'minor_version': '1'
        }
        self._test_outcome(desired_outcome)

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

示例14: test_oracle7_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [as 別名]
def test_oracle7_release(self):
        desired_outcome = {
            'id': 'oracle',
            'name': 'Oracle Linux Server',
            'pretty_name': 'Oracle Linux Server 7.5',
            'version': '7.5',
            'pretty_version': '7.5',
            'best_version': '7.5',
            'major_version': '7',
            'minor_version': '5'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'oracle',
            'name': 'Oracle Linux Server',
            'version_id': '7.5',
        }
        distro_info = self._test_release_file_info(
            'oracle-release', desired_info)
        assert 'codename' not in distro_info 
開發者ID:nir0s,項目名稱:distro,代碼行數:23,代碼來源:test_distro.py

示例15: test_rhel6_release

# 需要導入模塊: import distro [as 別名]
# 或者: from distro import name [as 別名]
def test_rhel6_release(self):
        desired_outcome = {
            'id': 'rhel',
            'name': 'Red Hat Enterprise Linux Server',
            'pretty_name': 'Red Hat Enterprise Linux Server 6.5 (Santiago)',
            'version': '6.5',
            'pretty_version': '6.5 (Santiago)',
            'best_version': '6.5',
            'codename': 'Santiago',
            'major_version': '6',
            'minor_version': '5'
        }
        self._test_outcome(desired_outcome)

        desired_info = {
            'id': 'redhat',
            'name': 'Red Hat Enterprise Linux Server',
            'version_id': '6.5',
            'codename': 'Santiago'
        }
        self._test_release_file_info('redhat-release', desired_info) 
開發者ID:nir0s,項目名稱:distro,代碼行數:23,代碼來源:test_distro.py


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