本文整理匯總了Python中kiwi.iso.Iso.create_header_end_block方法的典型用法代碼示例。如果您正苦於以下問題:Python Iso.create_header_end_block方法的具體用法?Python Iso.create_header_end_block怎麽用?Python Iso.create_header_end_block使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kiwi.iso.Iso
的用法示例。
在下文中一共展示了Iso.create_header_end_block方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_on_file
# 需要導入模塊: from kiwi.iso import Iso [as 別名]
# 或者: from kiwi.iso.Iso import create_header_end_block [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
示例2: TestIso
# 需要導入模塊: from kiwi.iso import Iso [as 別名]
# 或者: from kiwi.iso.Iso import create_header_end_block [as 別名]
#.........這裏部分代碼省略.........
mock_command.assert_called_once_with(
['/usr/bin/isoinfo', '-R', '-l', '-i', 'some-iso']
)
@patch('os.path.exists')
@patch('kiwi.iso.Command.run')
@patch_open
def test_isols_usr_lib_genisoimage_isoinfo_used(
self, mock_open, mock_command, mock_exists
):
exists_results = [True, False]
def side_effect(self):
return exists_results.pop()
mock_exists.side_effect = side_effect
self.iso.isols('some-iso')
mock_command.assert_called_once_with(
['/usr/lib/genisoimage/isoinfo', '-R', '-l', '-i', 'some-iso']
)
@patch('kiwi.iso.Command.run')
@patch('os.path.exists')
def test_isols(self, mock_exists, mock_command):
mock_exists.return_value = True
output_type = namedtuple('output_type', ['output'])
output_data = ''
with open('../data/iso_listing.txt') as iso:
output_data = iso.read()
mock_command.return_value = output_type(output=output_data)
result = self.iso.isols('some-iso')
assert result[2158].name == 'header_end'
def test_create_header_end_block(self):
temp_file = NamedTemporaryFile()
self.iso.header_end_file = temp_file.name
assert self.iso.create_header_end_block(
'../data/iso_with_marker.iso'
) == 96
@raises(KiwiIsoLoaderError)
def test_create_header_end_block_raises(self):
temp_file = NamedTemporaryFile()
self.iso.header_end_file = temp_file.name
self.iso.create_header_end_block(
'../data/iso_no_marker.iso'
)
@patch('kiwi.iso.Command.run')
def test_create_hybrid(self, mock_command):
mbrid = mock.Mock()
mbrid.get_id = mock.Mock(
return_value='0x0815'
)
Iso.create_hybrid(42, mbrid, 'some-iso')
mock_command.assert_called_once_with(
[
'isohybrid', '--offset', '42',
'--id', '0x0815', '--type', '0x83',
'--uefi', 'some-iso'
]
)
@patch_open
@raises(KiwiIsoMetaDataError)
def test_iso_metadata_iso9660_invalid(self, mock_open):