75 lines
1.4 KiB
Python
Executable File
75 lines
1.4 KiB
Python
Executable File
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
import os
|
|
import sys
|
|
import shutil
|
|
import json
|
|
import sync_file as sf
|
|
|
|
|
|
|
|
|
|
|
|
# 一键切换htzd各模块配置
|
|
# 在编译之前使用
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_path(dir_item:str,sub:str):
|
|
with open('ohos_config.json') as f:
|
|
j=json.loads(f.read())
|
|
return os.path.join(j[dir_item],sub)
|
|
|
|
|
|
|
|
|
|
_src_path=f"{get_path('root_path','')}/vendor/htzd_model"
|
|
|
|
_dst_path_vendor=f"{get_path('product_path','')}/hals/utils/sys_param"
|
|
|
|
# _dst_path_device=f"{get_path('device_path','')}/bsp"
|
|
_dst_path_device=f"{get_path('root_path','')}/device/soc/htzd/htzd32xx/kunlun/Mainline/ap"
|
|
|
|
|
|
|
|
|
|
|
|
def copy_files(model:str):
|
|
if(model not in ['sta','cco','iic','3ps']):
|
|
print('par error.')
|
|
return False
|
|
vendor_file_list=['hal_sys_param.c','vendor.para']
|
|
device_file_list=['BUILD.gn']
|
|
for item in vendor_file_list:
|
|
src=f"{_src_path}/{model}/{item}"
|
|
dst=f"{_dst_path_vendor}/{item}"
|
|
shutil.copy(src,dst)
|
|
for item in device_file_list:
|
|
src=f"{_src_path}/{model}/{item}"
|
|
dst=f"{_dst_path_device}/{item}"
|
|
shutil.copy(src,dst)
|
|
print(f"set model {model} done.")
|
|
return True
|
|
|
|
|
|
|
|
'''
|
|
一键编译指定的模块
|
|
'''
|
|
if __name__ == "__main__":
|
|
if(len(sys.argv)>=2):
|
|
par=sys.argv[1]
|
|
if (copy_files(par)):
|
|
os.system("hb build -f --gn-args build_xts=true")
|
|
# os.system("hb build -f")
|
|
sf.main(par)
|
|
else:
|
|
print("please set par.")
|
|
|
|
|