本文整理汇总了Python中kiwi.defaults.Defaults.get_common_functions_file方法的典型用法代码示例。如果您正苦于以下问题:Python Defaults.get_common_functions_file方法的具体用法?Python Defaults.get_common_functions_file怎么用?Python Defaults.get_common_functions_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.defaults.Defaults
的用法示例。
在下文中一共展示了Defaults.get_common_functions_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _import_custom_scripts
# 需要导入模块: from kiwi.defaults import Defaults [as 别名]
# 或者: from kiwi.defaults.Defaults import get_common_functions_file [as 别名]
def _import_custom_scripts(self):
"""
Import custom scripts
"""
# custom_scripts defines a dictionary with all script hooks
# for each script name a the filepath and additional flags
# are defined. the filepath could be either a relative or
# absolute information. If filepath is set to None this indicates
# the script hook is not used. The raise_if_not_exists flag
# causes kiwi to raise an exception if a specified script
# filepath does not exist
script_type = namedtuple(
'script_type', ['filepath', 'raise_if_not_exists']
)
custom_scripts = {
'config.sh': script_type(
filepath='config.sh',
raise_if_not_exists=False
),
'images.sh': script_type(
filepath='images.sh',
raise_if_not_exists=False
),
'edit_boot_config.sh': script_type(
filepath=self.xml_state.build_type.get_editbootconfig(),
raise_if_not_exists=True
),
'edit_boot_install.sh': script_type(
filepath=self.xml_state.build_type.get_editbootinstall(),
raise_if_not_exists=True
)
}
sorted_custom_scripts = OrderedDict(
sorted(custom_scripts.items())
)
description_target = self.root_dir + '/image/'
need_script_helper_functions = False
for name, script in list(sorted_custom_scripts.items()):
if script.filepath:
if script.filepath.startswith('/'):
script_file = script.filepath
else:
script_file = self.description_dir + '/' + script.filepath
if os.path.exists(script_file):
log.info(
'--> Importing %s script as %s',
script.filepath, 'image/' + name
)
Command.run(
['cp', script_file, description_target + name]
)
need_script_helper_functions = True
elif script.raise_if_not_exists:
raise KiwiImportDescriptionError(
'Specified script %s does not exist' % script_file
)
if need_script_helper_functions:
log.info('--> Importing script helper functions')
Command.run(
[
'cp',
Defaults.get_common_functions_file(),
self.root_dir + '/.kconfig'
]
)