awtk/staticcheck/common/awtk_files.py

81 lines
3.4 KiB
Python
Raw Normal View History

2019-04-14 19:14:16 +08:00
import os
import copy
import glob
2019-04-22 18:33:12 +08:00
import subprocess
2019-04-14 19:14:16 +08:00
def joinPath(root, subdir):
return os.path.abspath(os.path.normpath(os.path.join(root, subdir)))
if 'AWTK_ROOT_DIR' in os.environ:
AWTK_ROOT_DIR=os.path.abspath(os.environ['AWTK_ROOT_DIR']);
else:
AWTK_ROOT_DIR=os.path.abspath('../../');
AWTK_SRC_DIR=joinPath(AWTK_ROOT_DIR, 'src');
AWKT_TKC_FILES=glob.glob(AWTK_SRC_DIR+'/tkc/*.c')
AWKT_BASE_FILES=glob.glob(AWTK_SRC_DIR+'/base/*.c')
AWKT_WIDGETS_FILES=glob.glob(AWTK_SRC_DIR+'/widgets/*.c')
AWKT_WIDGETS_FILES=glob.glob(AWTK_SRC_DIR+'/widgets/*.c')
AWKT_EXT_WIDGETS_FILES=glob.glob(AWTK_SRC_DIR+'/ext_widgets/*.c') + glob.glob(AWTK_SRC_DIR+'/ext_widgets/*/*.c')
AWKT_UILOADER_FILES=glob.glob(AWTK_SRC_DIR+'/ui_loader/*.c')
AWKT_LAYOUTERS_FILES=glob.glob(AWTK_SRC_DIR+'/layouters/*.c')
AWKT_XML_FILES=glob.glob(AWTK_SRC_DIR+'/xml/*.c')
AWKT_SVG_FILES=glob.glob(AWTK_SRC_DIR+'/svg/*.c')
2020-08-27 11:42:39 +08:00
AWKT_APP_CONF_FILES=glob.glob(AWTK_SRC_DIR+'/app_conf/*.c')
2020-02-01 18:17:38 +08:00
AWKT_UBJSON_FILES=glob.glob(AWTK_SRC_DIR+'/ubjson/*.c')
2019-04-14 19:14:16 +08:00
AWKT_CLIPBOARD_FILES=glob.glob(AWTK_SRC_DIR+'/clip_board/clip_board_default.c')
AWKT_WIDGET_ANIMATORS_FILES=glob.glob(AWTK_SRC_DIR+'/widget_animators/*.c')
AWKT_WINDOW_ANIMATORS_FILES=glob.glob(AWTK_SRC_DIR+'/window_animators/*.c')
AWKT_DIALOG_HIGHLIGHTERS_FILES=glob.glob(AWTK_SRC_DIR+'/dialog_highlighters/*.c')
AWKT_FONT_LOADER_FILES=glob.glob(AWTK_SRC_DIR+'/font_loader/*.c')
2019-04-15 18:08:41 +08:00
AWKT_IMAGE_LOADER_FILES=glob.glob(AWTK_SRC_DIR+'/image_loader/*.c')
2019-05-01 21:29:07 +08:00
AWKT_DESIGNER_SUPPORT_FILES=glob.glob(AWTK_SRC_DIR+'/designer_support/*.c')
2019-04-20 11:24:54 +08:00
AWKT_INPUT_METHOD_FILES=glob.glob(AWTK_SRC_DIR+'/input_methods/input_method_creator.c')
2019-04-14 19:14:16 +08:00
AWKT_FONT_GLOBAL_FILES=glob.glob(AWTK_SRC_DIR+'/*.c')
2019-08-03 17:41:35 +08:00
NATIVE_WINDOW_FILES=glob.glob(AWTK_SRC_DIR+'/native_window/native_window_raw.c')
WINDOW_MANAGER_FILES=glob.glob(AWTK_SRC_DIR+'/window_manager/window_manager_default.c')
2019-11-08 07:18:40 +08:00
GRAPHIC_BUFFER_FILES=glob.glob(AWTK_SRC_DIR+'/graphic_buffer/graphic_buffer_default.c')
2019-04-14 19:14:16 +08:00
2020-08-27 11:42:39 +08:00
COMMON_FILES=AWKT_TKC_FILES + AWKT_BASE_FILES + AWKT_WIDGETS_FILES + AWKT_EXT_WIDGETS_FILES + AWKT_UILOADER_FILES + AWKT_LAYOUTERS_FILES + AWKT_SVG_FILES + AWKT_APP_CONF_FILES + AWKT_WIDGET_ANIMATORS_FILES + AWKT_WINDOW_ANIMATORS_FILES + AWKT_DIALOG_HIGHLIGHTERS_FILES + AWKT_CLIPBOARD_FILES + AWKT_FONT_GLOBAL_FILES + AWKT_INPUT_METHOD_FILES + NATIVE_WINDOW_FILES + WINDOW_MANAGER_FILES + GRAPHIC_BUFFER_FILES;
2019-04-14 19:14:16 +08:00
2019-04-15 18:08:41 +08:00
INFER_FILES=COMMON_FILES
2019-05-01 21:29:07 +08:00
WEB_FILES=COMMON_FILES + AWKT_XML_FILES + AWKT_DESIGNER_SUPPORT_FILES
2019-04-15 18:08:41 +08:00
CPPCHECK_FILES=COMMON_FILES + AWKT_XML_FILES + AWKT_FONT_LOADER_FILES + AWKT_IMAGE_LOADER_FILES
2019-04-14 19:14:16 +08:00
def getCppCheckFiles():
return CPPCHECK_FILES;
def getInferFiles():
return INFER_FILES;
def getWebFiles():
return WEB_FILES;
def getIncludes():
2019-07-07 07:31:41 +08:00
return '-I' + AWTK_ROOT_DIR + '/3rd ' + '-I' + AWTK_ROOT_DIR + ' -I' + AWTK_SRC_DIR +' -I' + AWTK_SRC_DIR +'/ext_widgets';
2019-04-14 19:14:16 +08:00
def toExe(name):
if OS_NAME == 'Windows':
return name + '.exe'
else:
return name
2019-04-23 11:06:13 +08:00
def writeArgs(filename, str):
2019-04-23 16:19:35 +08:00
with open(filename, "w") as text_file:
text_file.write(str);
2019-04-23 11:06:13 +08:00
2019-04-23 11:14:12 +08:00
def runArgsInFile(cmd, flags, files):
2019-04-23 11:06:13 +08:00
cmd_args = flags + ' ' + getIncludes() + ' ' + ' '.join(files)
cmd_args = cmd_args.replace('\\', '\\\\');
writeArgs("args.txt", cmd_args);
2019-04-14 19:14:16 +08:00
print(cmd_args)
2019-04-23 11:06:13 +08:00
os.system(cmd + ' @args.txt');
2019-04-14 19:14:16 +08:00
2019-04-23 11:14:12 +08:00
def run(cmd, flags, files):
cmd_args = cmd + ' ' + flags + ' ' + getIncludes() + ' ' + ' '.join(files)
cmd_args = cmd_args.replace('\\', '\\\\');
print(cmd_args)
os.system(cmd_args);