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


Python Iso.relocate_boot_catalog方法代碼示例

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


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

示例1: test_relocate_boot_catalog

# 需要導入模塊: from kiwi.iso import Iso [as 別名]
# 或者: from kiwi.iso.Iso import relocate_boot_catalog [as 別名]
    def test_relocate_boot_catalog(self, mock_open):
        mock_open.return_value = self.context_manager_mock
        volume_descriptor = \
            bytes(b'CD001') + bytes(b'_') * (0x08c - 0x5) + bytes(b'0x1d5f23a')
        eltorito_descriptor = \
            bytes(b'EL TORITO SPECIFICATION') + bytes(b'_') * (0x47 - 0x17) + bytes(b'0x1d5f23a')
        new_volume_descriptor = \
            bytes(b'bogus')
        next_new_volume_descriptor = \
            bytes(b'TEA01')
        new_boot_catalog = bytes(b'\x00') * 0x800
        read_results = [
            new_boot_catalog,
            next_new_volume_descriptor,
            new_volume_descriptor,
            bytes(b'catalog'),
            eltorito_descriptor,
            volume_descriptor
        ]

        def side_effect(arg):
            return read_results.pop()

        self.file_mock.read.side_effect = side_effect

        Iso.relocate_boot_catalog('isofile')
        assert self.file_mock.write.call_args_list == [
            call(bytes(b'catalog')),
            call(
                bytes(b'EL TORITO SPECIFICATION') +
                bytes(b'_') * (0x47 - 0x17) + bytes(b'\x13\x00\x00\x005f23a')
            )
        ]
開發者ID:ChrisBr,項目名稱:kiwi,代碼行數:35,代碼來源:iso_test.py

示例2: test_relocate_boot_catalog

# 需要導入模塊: from kiwi.iso import Iso [as 別名]
# 或者: from kiwi.iso.Iso import relocate_boot_catalog [as 別名]
    def test_relocate_boot_catalog(self, mock_open):
        mock_open.return_value = self.context_manager_mock
        volume_descriptor = \
            'CD001' + '_' * (0x08c - 0x5) + '0x1d5f23a'
        eltorito_descriptor = \
            'EL TORITO SPECIFICATION' + '_' * (0x47 - 0x17) + '0x1d5f23a'
        new_volume_descriptor = \
            'bogus'
        next_new_volume_descriptor = \
            'TEA01'
        new_boot_catalog = format('\x00' * 0x800)
        read_results = [
            new_boot_catalog,
            next_new_volume_descriptor,
            new_volume_descriptor,
            'catalog',
            eltorito_descriptor,
            volume_descriptor
        ]

        def side_effect(arg):
            return read_results.pop()

        self.file_mock.read.side_effect = side_effect

        Iso.relocate_boot_catalog('isofile')
        assert self.file_mock.write.call_args_list == [
            call('catalog'),
            call(
                'EL TORITO SPECIFICATION' +
                '_' * (0x47 - 0x17) + '\x13\x00\x00\x005f23a'
            )
        ]
開發者ID:k0da,項目名稱:kiwi-1,代碼行數:35,代碼來源:iso_test.py

示例3: create_on_file

# 需要導入模塊: from kiwi.iso import Iso [as 別名]
# 或者: from kiwi.iso.Iso import relocate_boot_catalog [as 別名]
    def create_on_file(self, filename, label=None, exclude=None):
        """
        Create iso filesystem from data tree

        There is no label which could be set for iso filesystem
        thus this parameter is not used

        :param string filename: result file path name
        :param string label: unused
        :param string exclude: unused
        """
        iso = Iso(self.root_dir)
        iso.init_iso_creation_parameters(
            self.custom_args['create_options']
        )
        iso.add_efi_loader_parameters()
        Command.run(
            [
                self._find_iso_creation_tool()
            ] + iso.get_iso_creation_parameters() + [
                '-o', filename, self.root_dir
            ]
        )
        hybrid_offset = iso.create_header_end_block(filename)
        Command.run(
            [
                self._find_iso_creation_tool(),
                '-hide', iso.header_end_name,
                '-hide-joliet', iso.header_end_name
            ] + iso.get_iso_creation_parameters() + [
                '-o', filename, self.root_dir
            ]
        )
        iso.relocate_boot_catalog(filename)
        iso.fix_boot_catalog(filename)
        return hybrid_offset
開發者ID:AdamMajer,項目名稱:kiwi-ng,代碼行數:38,代碼來源:isofs.py


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