[buildcore] Cleanup type annotations in Python scripts

This commit is contained in:
2022-08-13 20:32:53 -05:00
parent 84d54ba340
commit b0faac199f
2 changed files with 21 additions and 21 deletions

View File

@ -18,7 +18,7 @@ import sys
from pybb import mkdir, rm
def main():
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('--target', help='Platform target',
default='{:s}-{:s}'.format(sys.platform, platform.machine()))
@ -39,7 +39,7 @@ def main():
sanitizer_status = 'OFF'
else:
print('Error: Invalid build tool')
sys.exit(1)
return 1
if args.build_tool == 'xcode':
build_config = '{:s}-{:s}'.format(args.target, args.build_tool)
@ -60,12 +60,11 @@ def main():
build_tool = '-GXcode'
else:
print('Error: Invalid build tool')
sys.exit(1)
return 1
project_dir = os.getcwd()
build_dir = '{:s}/build/{:s}'.format(project_dir, build_config)
rm(build_dir)
mkdir(build_dir)
cmake_cmd = [
'cmake', '-S', project_dir, '-B', build_dir, build_tool,
'-DCMAKE_EXPORT_COMPILE_COMMANDS=ON',
@ -91,10 +90,11 @@ def main():
rm('compile_commands.json')
if platform.system() != 'Windows':
os.symlink('build/{:s}/compile_commands.json'.format(build_config), 'compile_commands.json')
return 0
if __name__ == '__main__':
try:
main()
sys.exit(main())
except KeyboardInterrupt:
sys.exit(1)