mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-09 02:24:45 +00:00
acrn-config: refine board name with undline_name api
Sometimes character '-' or space need to be converted to '_' to make string format uniformed. Add this common api to satisfy such requirment and refine the code for board name generating. Tracked-On: #3852 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
@@ -622,3 +622,19 @@ def get_max_clos(board_file):
|
||||
clos_max = int(line.split(':')[1])
|
||||
|
||||
return (cache_support, clos_max)
|
||||
|
||||
|
||||
def undline_name(name):
|
||||
"""
|
||||
This convert name which has contain '-' to '_'
|
||||
:param name: name which contain '-' and ' '
|
||||
:return: name_str which contain'_'
|
||||
"""
|
||||
# convert '-' to '_' in name string
|
||||
name_str = "_".join(name.split('-')).upper()
|
||||
|
||||
# stitch '_' while ' ' in name string
|
||||
if ' ' in name_str:
|
||||
name_str = "_".join(name_str.split()).upper()
|
||||
|
||||
return name_str
|
||||
|
||||
Reference in New Issue
Block a user