当前位置: 首页>>代码示例>>Python>>正文


Python xml_description.XMLDescription类代码示例

本文整理汇总了Python中kiwi.xml_description.XMLDescription的典型用法代码示例。如果您正苦于以下问题:Python XMLDescription类的具体用法?Python XMLDescription怎么用?Python XMLDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XMLDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

 def setup(self):
     self.tmpfile = mock.Mock()
     self.tmpfile.name = 'tmpfile'
     description = XMLDescription('../data/example_dot_profile_config.xml')
     self.profile = Profile(
         XMLState(description.load())
     )
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:7,代码来源:system_profile_test.py

示例2: setup

    def setup(self, mock_root_bind, mock_root_init):
        description = XMLDescription(
            description='../data/example_config.xml',
            derived_from='derived/description'
        )
        self.xml = description.load()

        self.manager = mock.MagicMock(
            return_value=mock.MagicMock()
        )
        self.manager.package_requests = ['foo']
        self.manager.collection_requests = ['foo']
        self.manager.product_requests = ['foo']

        root_init = mock.MagicMock()
        mock_root_init.return_value = root_init
        root_bind = mock.MagicMock()
        root_bind.root_dir = 'root_dir'
        mock_root_bind.return_value = root_bind
        self.state = XMLState(
            self.xml
        )
        self.system = SystemPrepare(
            xml_state=self.state, root_dir='root_dir',
            allow_existing=True
        )
        mock_root_init.assert_called_once_with(
            'root_dir', True
        )
        root_init.create.assert_called_once_with()
        mock_root_bind.assert_called_once_with(
            root_init
        )
        root_bind.setup_intermediate_config.assert_called_once_with()
        root_bind.mount_kernel_file_systems.assert_called_once_with()
开发者ID:SUSE,项目名称:kiwi,代码行数:35,代码来源:system_prepare_test.py

示例3: test_get_build_type_vmconfig_entries_for_vmx_type

 def test_get_build_type_vmconfig_entries_for_vmx_type(self):
     description = XMLDescription('../data/example_config.xml')
     xml_data = description.load()
     state = XMLState(xml_data, ['vmxFlavour'], 'vmx')
     assert state.get_build_type_vmconfig_entries() == [
         'numvcpus = "4"', 'cpuid.coresPerSocket = "2"'
     ]
开发者ID:SUSE,项目名称:kiwi,代码行数:7,代码来源:xml_state_test.py

示例4: setup

    def setup(self, mock_machine, mock_exists, mock_mkdtemp):
        mock_machine.return_value = 'x86_64'
        mock_exists.return_value = True
        description = XMLDescription('../data/example_config.xml')
        self.xml_state = XMLState(
            description.load()
        )

        self.manager = mock.Mock()
        self.system_prepare = mock.Mock()
        self.setup = mock.Mock()
        self.profile = mock.Mock()
        self.system_prepare.setup_repositories = mock.Mock(
            return_value=self.manager
        )
        kiwi.boot.image.kiwi.SystemPrepare = mock.Mock(
            return_value=self.system_prepare
        )
        kiwi.boot.image.kiwi.SystemSetup = mock.Mock(
            return_value=self.setup
        )
        kiwi.boot.image.kiwi.Profile = mock.Mock(
            return_value=self.profile
        )
        mock_mkdtemp.return_value = 'boot-directory'
        self.boot_image = BootImageKiwi(
            self.xml_state, 'some-target-dir'
        )
开发者ID:ChrisBr,项目名称:kiwi,代码行数:28,代码来源:boot_image_kiwi_test.py

示例5: test_check_boot_description_exists_does_not_exist

 def test_check_boot_description_exists_does_not_exist(self):
     description = XMLDescription(
         '../data/example_runtime_checker_boot_desc_not_found.xml'
     )
     xml_state = XMLState(description.load())
     runtime_checker = RuntimeChecker(xml_state)
     runtime_checker.check_boot_description_exists()
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:7,代码来源:runtime_checker_test.py

示例6: test_get_volumes_no_explicit_root_setup_other_fullsize_volume

 def test_get_volumes_no_explicit_root_setup_other_fullsize_volume(self):
     description = XMLDescription(
         '../data/example_lvm_no_root_full_usr_config.xml'
     )
     xml_data = description.load()
     state = XMLState(xml_data)
     volume_type = namedtuple(
         'volume_type', [
             'name',
             'size',
             'realpath',
             'mountpoint',
             'fullsize'
         ]
     )
     assert state.get_volumes() == [
         volume_type(
             name='LVusr', size=None, realpath='usr',
             mountpoint=None, fullsize=True
         ),
         volume_type(
             name='LVRoot', size='freespace:30', realpath='/',
             mountpoint=None, fullsize=False
         )
     ]
开发者ID:toabctl,项目名称:kiwi,代码行数:25,代码来源:xml_state_test.py

示例7: test_check_boot_description_exists_no_boot_ref

 def test_check_boot_description_exists_no_boot_ref(self):
     description = XMLDescription(
         '../data/example_runtime_checker_no_boot_reference.xml'
     )
     xml_state = XMLState(description.load())
     runtime_checker = RuntimeChecker(xml_state)
     runtime_checker.check_boot_description_exists()
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:7,代码来源:runtime_checker_test.py

示例8: setup

 def setup(self, mock_machine):
     mock_machine.return_value = 'x86_64'
     self.xml_state = mock.MagicMock()
     self.xml_state.build_type.get_filesystem = mock.Mock(
         return_value='ext3'
     )
     self.xml_state.xml_data.get_name = mock.Mock(
         return_value='some-image'
     )
     self.xml_state.get_image_version = mock.Mock(
         return_value='1.2.3'
     )
     self.xml_state.xml_data.description_dir = 'description_dir'
     self.setup = SystemSetup(
         self.xml_state, 'root_dir'
     )
     description = XMLDescription(
         description='../data/example_config.xml',
         derived_from='derived/description'
     )
     self.setup_with_real_xml = SystemSetup(
         XMLState(description.load()), 'root_dir'
     )
     command_run = namedtuple(
         'command', ['output', 'error', 'returncode']
     )
     self.run_result = command_run(
         output='password-hash\n',
         error='stderr',
         returncode=0
     )
开发者ID:ChrisBr,项目名称:kiwi,代码行数:31,代码来源:system_setup_test.py

示例9: test_get_volumes

 def test_get_volumes(self):
     description = XMLDescription('../data/example_lvm_default_config.xml')
     xml_data = description.load()
     state = XMLState(xml_data)
     volume_type = namedtuple(
         'volume_type', [
             'name',
             'size',
             'realpath',
             'mountpoint',
             'fullsize'
         ]
     )
     assert state.get_volumes() == [
         volume_type(
             name='LVusr_lib', size='size:1024',
             realpath='usr/lib',
             mountpoint=None, fullsize=False
         ),
         volume_type(
             name='LVRoot', size='freespace:500',
             realpath='/',
             mountpoint=None, fullsize=False
         ),
         volume_type(
             name='etc_volume', size='freespace:30',
             realpath='etc',
             mountpoint='LVetc', fullsize=False
         ),
         volume_type(
             name='bin_volume', size=None,
             realpath='/usr/bin',
             mountpoint='LVusr_bin', fullsize=True
         )
     ]
开发者ID:toabctl,项目名称:kiwi,代码行数:35,代码来源:xml_state_test.py

示例10: test_create_cpio

 def test_create_cpio(self, mock_shell_quote, mock_open, mock_temp):
     mock_temp.return_value = self.tmpfile
     description = XMLDescription('../data/example_dot_profile_config.xml')
     profile = Profile(
         XMLState(description.load(), None, 'cpio')
     )
     profile.create()
     assert profile.dot_profile['kiwi_cpio_name'] == 'LimeJeOS-openSUSE-13.2'
开发者ID:toabctl,项目名称:kiwi,代码行数:8,代码来源:profile_test.py

示例11: load_xml_description

    def load_xml_description(self, description_directory):
        """
        Load, upgrade, validate XML description

        Attributes

        * :attr:`xml_data`
            instance of XML data toplevel domain (image), stateless data

        * :attr:`config_file`
            used config file path

        * :attr:`xml_state`
            Instance of XMLState, stateful data
        """
        from ..logger import log

        log.info('Loading XML description')
        config_file = description_directory + '/config.xml'
        if not os.path.exists(config_file):
            # alternative config file lookup location
            config_file = description_directory + '/image/config.xml'
        if not os.path.exists(config_file):
            # glob config file search, first match wins
            glob_match = description_directory + '/*.kiwi'
            for kiwi_file in glob.iglob(glob_match):
                config_file = kiwi_file
                break

        if not os.path.exists(config_file):
            raise KiwiConfigFileNotFound(
                'no XML description found in %s' % description_directory
            )

        description = XMLDescription(
            config_file
        )
        self.xml_data = description.load()
        self.config_file = config_file.replace('//', '/')
        self.xml_state = XMLState(
            self.xml_data,
            self.global_args['--profile'],
            self.global_args['--type']
        )

        log.info('--> loaded %s', self.config_file)
        if self.xml_state.build_type:
            log.info(
                '--> Selected build type: %s',
                self.xml_state.get_build_type_name()
            )
        if self.xml_state.profiles:
            log.info(
                '--> Selected profiles: %s',
                ','.join(self.xml_state.profiles)
            )

        self.runtime_checker = RuntimeChecker(self.xml_state)
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:58,代码来源:base.py

示例12: test_get_users

 def test_get_users(self):
     description = XMLDescription('../data/example_multiple_users_config.xml')
     xml_data = description.load()
     state = XMLState(xml_data)
     users = state.get_users()
     assert len(users) == 3
     assert any(u.get_name() == 'root' for u in users)
     assert any(u.get_name() == 'tux' for u in users)
     assert any(u.get_name() == 'kiwi' for u in users) 
开发者ID:SUSE,项目名称:kiwi,代码行数:9,代码来源:xml_state_test.py

示例13: test_setup_ix86

 def test_setup_ix86(self, mock_machine, mock_exists):
     mock_machine.return_value = 'i686'
     description = XMLDescription(
         '../data/example_disk_config.xml'
     )
     disk_builder = DiskBuilder(
         XMLState(description.load()), 'target_dir', 'root_dir'
     )
     assert disk_builder.arch == 'ix86'
开发者ID:matt4d617474,项目名称:kiwi,代码行数:9,代码来源:builder_disk_test.py

示例14: test_create_displayname_is_image_name

 def test_create_displayname_is_image_name(self, mock_which, mock_temp):
     mock_which.return_value = 'cp'
     mock_temp.return_value = self.tmpfile
     description = XMLDescription('../data/example_pxe_config.xml')
     profile = Profile(
         XMLState(description.load())
     )
     profile.create()
     os.remove(self.tmpfile.name)
     assert profile.dot_profile['kiwi_displayname'] == 'LimeJeOS-openSUSE-13.2'
开发者ID:Conan-Kudo,项目名称:kiwi,代码行数:10,代码来源:system_profile_test.py

示例15: test_copy_bootdelete_packages_no_delete_section_in_boot_descr

 def test_copy_bootdelete_packages_no_delete_section_in_boot_descr(self):
     boot_description = XMLDescription(
         '../data/isoboot/example-distribution-no-delete-section/config.xml'
     )
     boot_state = XMLState(
         boot_description.load()
     )
     self.state.copy_bootdelete_packages(boot_state)
     to_delete_packages = boot_state.get_to_become_deleted_packages()
     assert 'vim' in to_delete_packages
开发者ID:ChrisBr,项目名称:kiwi,代码行数:10,代码来源:xml_state_test.py


注:本文中的kiwi.xml_description.XMLDescription类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。