mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-27 07:33:54 +01:00
projects.py: Ongoing code beautification
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
298398af2b
commit
fbf75b1220
1 changed files with 63 additions and 68 deletions
|
|
@ -131,7 +131,7 @@ class Projects(object):
|
|||
if self.glob_os_cascade is not None:
|
||||
return self.glob_os_cascade
|
||||
r = [ 'os', platform.system().lower() ]
|
||||
os = self.res_cache.run(self.get_os, [])
|
||||
os = self.opt_os if self.opt_os is not None else self.res_cache.run(self.get_os, [])
|
||||
name = re.sub('-.*', '', os)
|
||||
series = os
|
||||
while True:
|
||||
|
|
@ -305,11 +305,11 @@ class Projects(object):
|
|||
parser = argparse.ArgumentParser(description='pkg-' + rel_type)
|
||||
# TODO: implement Vendor evaluation
|
||||
|
||||
parser.add_argument('--subsections', '-S', nargs='?', default=None, help='Subsections to consider, comma-separated')
|
||||
parser.add_argument('--delimiter', '-d', nargs='?', default=', ', help='Output words delimiter')
|
||||
parser.add_argument('-S', '--subsections', nargs='?', default=None, help='Subsections to consider, comma-separated')
|
||||
parser.add_argument('-d', '--delimiter', nargs='?', default=', ', help='Output words delimiter')
|
||||
parser.add_argument('flavour', help='Flavour')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
parser.add_argument('--no-subpackages', '-p', action='store_true',
|
||||
parser.add_argument('-p', '--no-subpackages', action='store_true',
|
||||
default=False, help='Cut -run and -devel from package names')
|
||||
parser.add_argument('--no-version', action='store_true',
|
||||
default=False, help='Don\'t report version information')
|
||||
|
|
@ -573,20 +573,16 @@ class Projects(object):
|
|||
# -- parse command line
|
||||
parser = argparse.ArgumentParser(description='janware software project build tool')
|
||||
parser.add_argument('--exclude', default='', help='Space seperated ist of modules to be excluded from build')
|
||||
parser.add_argument('--debug', '-d', action='store_true',
|
||||
default=False, help='Output debug information to stderr')
|
||||
parser.add_argument('--dry-run', '-n', action='store_true',
|
||||
parser.add_argument('-n', '--dry-run', action='store_true',
|
||||
default=False, help='Don\'t build anything, just print what would be done.')
|
||||
parser.add_argument('--build-order', '-O', action='store_true',
|
||||
parser.add_argument('-O', '--build-order', action='store_true',
|
||||
default=False, help='Don\'t build anything, just print the build order.')
|
||||
parser.add_argument('--ignore-deps', '-I', action='store_true',
|
||||
parser.add_argument('-I', '--ignore-deps', action='store_true',
|
||||
default=False, help='Don\'t build dependencies, i.e. build only modules specified on the command line')
|
||||
parser.add_argument('target', default='all', help='Build target')
|
||||
parser.add_argument('modules', nargs='+', default='', help='Modules to be built')
|
||||
|
||||
args = parser.parse_args(args_)
|
||||
if args.debug:
|
||||
self.opt_debug = True
|
||||
|
||||
self.debug("----------------------------------------- running ", ' '.join(args_))
|
||||
|
||||
|
|
@ -690,7 +686,7 @@ class Projects(object):
|
|||
parser = argparse.ArgumentParser(description='ldflags')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
parser.add_argument('--exclude', action='append', help='Exclude Modules', default=[])
|
||||
parser.add_argument('--add-self', '-s', action='store_true',
|
||||
parser.add_argument('-s', '--add-self', action='store_true',
|
||||
default=False, help='Include libflags of specified modules, too, not only their dependencies')
|
||||
args = parser.parse_args(args_)
|
||||
print(self.get_ldflags(args.module, args.exclude, args.add_self))
|
||||
|
|
@ -844,7 +840,7 @@ class Projects(object):
|
|||
def cmd_check(self, args_):
|
||||
parser = argparse.ArgumentParser(description='check')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
parser.add_argument('--flavour', '-f', nargs='?', default = 'build')
|
||||
parser.add_argument('-f', '--flavour', nargs='?', default = 'build')
|
||||
args = parser.parse_args(args_)
|
||||
|
||||
graph = {}
|
||||
|
|
@ -875,11 +871,11 @@ class Projects(object):
|
|||
|
||||
# -------------------------------------------------------------------- here we go
|
||||
def run(self):
|
||||
if __name__ == "__main__":
|
||||
|
||||
skip = 0
|
||||
for a in sys.argv[1::]:
|
||||
self.global_args.append(a)
|
||||
if a in [ '--prefix', '-p', '--topdir', '-t' ]:
|
||||
if a in [ '-p', '--prefix', '-t', '--topdir', '-O', '--os' ]:
|
||||
skip = 1
|
||||
continue
|
||||
if skip > 0:
|
||||
|
|
@ -889,12 +885,12 @@ class Projects(object):
|
|||
break
|
||||
|
||||
parser = argparse.ArgumentParser(description='Project metadata evaluation')
|
||||
parser.add_argument('cmd', default='', help='Command')
|
||||
parser.add_argument('--debug', '-d', action='store_true',
|
||||
parser.add_argument('-d', '--debug', action='store_true',
|
||||
default=False, help='Output debug information to stderr')
|
||||
parser.add_argument('--topdir', '-t', nargs=1, default = [], help='Project Path')
|
||||
parser.add_argument('--prefix', '-p', nargs=1, default = [ self.projs_root ], help='Projects Path Prefix')
|
||||
parser.add_argument('--os', '-O', nargs=1, default = [], help='Target operating system')
|
||||
parser.add_argument('-t', '--topdir', nargs=1, default = [], help='Project Path')
|
||||
parser.add_argument('-p', '--prefix', nargs=1, default = [ self.projs_root ], help='Projects Path Prefix')
|
||||
parser.add_argument('-O', '--os', nargs=1, default = [], help='Target operating system')
|
||||
parser.add_argument('cmd', default='', help='Command, one of: ' + self.commands())
|
||||
parser.add_argument('arg', nargs='*', help='Command arguments')
|
||||
args = parser.parse_args(self.global_args)
|
||||
|
||||
|
|
@ -913,7 +909,6 @@ class Projects(object):
|
|||
if not self.top_name:
|
||||
self.top_name = re.sub('-[0-9.-]*$', '', basename(realpath(self.topdir)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd_name = 'cmd_' + args.cmd.replace('-', '_')
|
||||
cmd = getattr(self, cmd_name)
|
||||
cmd(sys.argv[(len(self.global_args) + 1)::])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue