2021-10-09 10:26:08 +00:00
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
|
2021-10-10 18:04:45 +00:00
|
|
|
import architecture
|
2021-10-10 19:34:35 +00:00
|
|
|
import remote as r
|
2021-10-10 17:08:47 +00:00
|
|
|
import subsystem
|
2021-10-09 10:26:08 +00:00
|
|
|
|
|
|
|
ACTION = 'action'
|
|
|
|
ARCHITECTURES = 'architectures'
|
|
|
|
COMPRESSION = 'compression'
|
|
|
|
DIRECTORY = 'directory'
|
|
|
|
FILESYSTEM = 'filesystem'
|
|
|
|
REMOTE = 'remote'
|
|
|
|
SUBSYSTEMS = 'subsystems'
|
|
|
|
TEMPORARY = 'temporary'
|
|
|
|
THREADS = 'threads'
|
|
|
|
VERBOSE = 'verbose'
|
|
|
|
|
|
|
|
|
|
|
|
class Formatter(argparse.RawTextHelpFormatter,
|
|
|
|
argparse.ArgumentDefaultsHelpFormatter):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def parse():
|
|
|
|
parser = argparse.ArgumentParser(formatter_class=Formatter)
|
|
|
|
|
|
|
|
parser.add_argument(f'-{VERBOSE[0]}', f'--{VERBOSE}', type=bool, help='''\
|
|
|
|
verbose output
|
|
|
|
''')
|
|
|
|
|
|
|
|
parser.add_argument(f'-{DIRECTORY[0]}', f'--{DIRECTORY}', type=str,
|
|
|
|
help='''\
|
|
|
|
msys repository's directory
|
|
|
|
''')
|
|
|
|
parser.add_argument(f'--{TEMPORARY}', type=str, help='''\
|
|
|
|
msys repository's temporary directory
|
|
|
|
''')
|
|
|
|
parser.add_argument(f'-{THREADS[0]}', f'--{THREADS}', type=int, help='''\
|
|
|
|
number of threads to use
|
|
|
|
''')
|
|
|
|
parser.add_argument(f'{ACTION}', type=str, nargs='?',
|
|
|
|
choices=['build', 'check', 'info', 'sync'], help='''\
|
|
|
|
action to perform onto msys repository
|
|
|
|
''')
|
|
|
|
|
|
|
|
sync = parser.add_argument_group('sync')
|
|
|
|
sync.add_argument(f'-{REMOTE[0]}', f'--{REMOTE}', type=str, help='''\
|
|
|
|
msys remote repository's location
|
|
|
|
''')
|
|
|
|
sync.add_argument(f'-{ARCHITECTURES[0]}', f'--{ARCHITECTURES}', type=str,
|
2021-10-10 18:04:45 +00:00
|
|
|
nargs='+', choices=architecture.ARCHITECTURES.keys(),
|
|
|
|
help='''\
|
2021-10-09 10:26:08 +00:00
|
|
|
list of architectures to sync
|
|
|
|
''')
|
|
|
|
sync.add_argument(f'-{SUBSYSTEMS[0]}', f'--{SUBSYSTEMS}', type=str,
|
2021-10-10 17:08:47 +00:00
|
|
|
nargs='+', choices=subsystem.FAMILIES, help='''\
|
2021-10-09 10:26:08 +00:00
|
|
|
list of subsystems to sync
|
|
|
|
''')
|
|
|
|
|
|
|
|
build = parser.add_argument_group('build')
|
|
|
|
parser.add_argument(f'-{FILESYSTEM[0]}', f'--{FILESYSTEM}', type=str,
|
|
|
|
help='''\
|
|
|
|
directory containing modifications applying to filesystem
|
|
|
|
''')
|
|
|
|
build.add_argument(f'-{COMPRESSION[0]}', f'--{COMPRESSION}', type=str,
|
2021-10-10 01:52:31 +00:00
|
|
|
choices=['gz', 'xz', 'zst'], help='''\
|
2021-10-09 10:26:08 +00:00
|
|
|
compression applying to archive
|
|
|
|
''')
|
|
|
|
|
|
|
|
parser.set_defaults(
|
|
|
|
directory=os.curdir,
|
|
|
|
temporary='tmp',
|
|
|
|
threads=2,
|
|
|
|
|
|
|
|
action='info',
|
|
|
|
|
2021-10-10 19:34:35 +00:00
|
|
|
remote=r.MAIN,
|
2021-10-10 18:11:36 +00:00
|
|
|
architectures=[architecture.MAIN],
|
2021-10-10 17:10:13 +00:00
|
|
|
subsystems=[subsystem.MAIN, 'mingw'],
|
2021-10-09 10:26:08 +00:00
|
|
|
|
|
|
|
filesystem='fs',
|
2021-10-09 18:45:16 +00:00
|
|
|
compression='zst',
|
2021-10-09 10:26:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return vars(parser.parse_args())
|
2021-10-10 13:44:03 +00:00
|
|
|
|
2021-10-10 13:46:37 +00:00
|
|
|
|
2021-10-10 13:44:03 +00:00
|
|
|
D = parse()
|
|
|
|
|
2021-10-10 17:02:34 +00:00
|
|
|
action = D[ACTION]
|
2021-10-10 13:44:03 +00:00
|
|
|
architectures = D[ARCHITECTURES]
|
2021-10-10 17:02:34 +00:00
|
|
|
directory = D[DIRECTORY]
|
|
|
|
remote = D[REMOTE]
|
2021-10-10 14:27:52 +00:00
|
|
|
subsystems = D[SUBSYSTEMS]
|
2021-10-10 17:02:34 +00:00
|
|
|
temporary = D[TEMPORARY]
|
|
|
|
threads = D[THREADS]
|