cloud-build/cloud-build.py

58 lines
1.1 KiB
Python
Raw Normal View History

2019-03-28 03:28:51 +03:00
#!/usr/bin/python3
import argparse
import os
2020-04-06 23:29:37 +03:00
from cloud_build import CB
2019-07-08 02:14:01 +03:00
2019-03-28 03:28:51 +03:00
PROG = 'cloud-build'
def get_data_dir() -> str:
data_dir = (os.getenv('XDG_DATA_HOME',
os.path.expanduser('~/.local/share'))
+ f'/{PROG}/')
return data_dir
def parse_args():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
'-c',
'--config',
default=f'/etc/{PROG}/config.yaml',
help='path to config',
)
parser.add_argument(
'-d',
'--data-dir',
default=f'/usr/share/{PROG}',
help='system data directory',
)
2019-11-01 16:44:46 +03:00
parser.add_argument(
'--no-tests',
action='store_true',
help='disable running tests',
)
2019-03-28 03:28:51 +03:00
args = parser.parse_args()
if not args.data_dir.endswith('/'):
args.data_dir += '/'
return args
def main():
args = parse_args()
2019-11-01 16:44:46 +03:00
cloud_build = CB(args)
cloud_build.create_images()
cloud_build.copy_external_files()
cloud_build.sign()
2019-03-28 03:28:51 +03:00
cloud_build.sync()
if __name__ == '__main__':
main()