mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-23 22:40:38 +01:00
projects.py/get_modules_from_project_txt(): Support multiple sections
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
a85640e58c
commit
187a3343c3
1 changed files with 25 additions and 24 deletions
|
|
@ -84,7 +84,7 @@ class Build(object):
|
||||||
dep_cache[prereq_type] = {}
|
dep_cache[prereq_type] = {}
|
||||||
|
|
||||||
if True:
|
if True:
|
||||||
r = get_modules_from_project_txt([ cur ], 'pkg.requires.jw',
|
r = get_modules_from_project_txt([ cur ], ['pkg.requires.jw'],
|
||||||
prereq_type, scope = 2, add_self=False, names_only=True)
|
prereq_type, scope = 2, add_self=False, names_only=True)
|
||||||
debug('prerequisites = ' + ' '.join(r))
|
debug('prerequisites = ' + ' '.join(r))
|
||||||
else: # legacy from build.py
|
else: # legacy from build.py
|
||||||
|
|
@ -465,22 +465,23 @@ def add_modules_from_project_txt(buf, visited, spec, section, key, add_self, sco
|
||||||
if add_self:
|
if add_self:
|
||||||
buf.append(spec)
|
buf.append(spec)
|
||||||
|
|
||||||
def get_modules_from_project_txt(names, section, keys, add_self, scope,
|
def get_modules_from_project_txt(names, sections, keys, add_self, scope,
|
||||||
names_only = True):
|
names_only = True):
|
||||||
if isinstance(keys, basestring):
|
if isinstance(keys, basestring):
|
||||||
keys = [ keys ]
|
keys = [ keys ]
|
||||||
#r = set()
|
#r = set()
|
||||||
r = []
|
r = []
|
||||||
for key in keys:
|
for section in sections:
|
||||||
visited = set()
|
for key in keys:
|
||||||
for name in names:
|
visited = set()
|
||||||
rr = []
|
for name in names:
|
||||||
add_modules_from_project_txt_cached(rr, visited, name, section, key, add_self, scope,
|
rr = []
|
||||||
names_only)
|
add_modules_from_project_txt_cached(rr, visited, name, section, key, add_self, scope,
|
||||||
# TODO: this looks like a performance hogger
|
names_only)
|
||||||
for m in rr:
|
# TODO: this looks like a performance hogger
|
||||||
if not m in r:
|
for m in rr:
|
||||||
r.append(m)
|
if not m in r:
|
||||||
|
r.append(m)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def pkg_relations(rel_type, args_):
|
def pkg_relations(rel_type, args_):
|
||||||
|
|
@ -562,7 +563,7 @@ def pkg_relations(rel_type, args_):
|
||||||
print(args.delimiter.join(r))
|
print(args.delimiter.join(r))
|
||||||
|
|
||||||
def get_libname(names):
|
def get_libname(names):
|
||||||
vals = get_modules_from_project_txt(names, 'build', 'libname',
|
vals = get_modules_from_project_txt(names, ['build'], 'libname',
|
||||||
scope = 1, add_self=False, names_only=True)
|
scope = 1, add_self=False, names_only=True)
|
||||||
if not vals:
|
if not vals:
|
||||||
return ' '.join(names)
|
return ' '.join(names)
|
||||||
|
|
@ -572,7 +573,7 @@ def get_libname(names):
|
||||||
|
|
||||||
def is_excluded_from_build(module):
|
def is_excluded_from_build(module):
|
||||||
debug("checking if module " + module + " is excluded from build")
|
debug("checking if module " + module + " is excluded from build")
|
||||||
exclude = get_modules_from_project_txt([ module ], 'build', 'exclude',
|
exclude = get_modules_from_project_txt([ module ], ['build'], 'exclude',
|
||||||
scope = 1, add_self=False, names_only=True)
|
scope = 1, add_self=False, names_only=True)
|
||||||
cascade = os_cascade() + [ 'all' ]
|
cascade = os_cascade() + [ 'all' ]
|
||||||
for p1 in exclude:
|
for p1 in exclude:
|
||||||
|
|
@ -583,7 +584,7 @@ def is_excluded_from_build(module):
|
||||||
|
|
||||||
# -L needs to contain more paths than libs linked with -l would require
|
# -L needs to contain more paths than libs linked with -l would require
|
||||||
def get_ldpathflags(names, exclude = []):
|
def get_ldpathflags(names, exclude = []):
|
||||||
deps = get_modules_from_project_txt(names, 'pkg.requires.jw', 'build',
|
deps = get_modules_from_project_txt(names, ['pkg.requires.jw'], 'build',
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
r = ''
|
r = ''
|
||||||
for m in deps:
|
for m in deps:
|
||||||
|
|
@ -596,7 +597,7 @@ def get_ldpathflags(names, exclude = []):
|
||||||
|
|
||||||
def get_ldflags(names, exclude = [], add_self_ = False):
|
def get_ldflags(names, exclude = [], add_self_ = False):
|
||||||
#print(names)
|
#print(names)
|
||||||
deps = get_modules_from_project_txt(names, 'pkg.requires.jw', 'build',
|
deps = get_modules_from_project_txt(names, ['pkg.requires.jw'], 'build',
|
||||||
scope = 1, add_self=add_self_, names_only=True)
|
scope = 1, add_self=add_self_, names_only=True)
|
||||||
debug("deps = " + ' '.join(deps))
|
debug("deps = " + ' '.join(deps))
|
||||||
#print(deps)
|
#print(deps)
|
||||||
|
|
@ -648,7 +649,7 @@ def cmd_ldlibpath(args_):
|
||||||
parser = argparse.ArgumentParser(description='ldlibpath')
|
parser = argparse.ArgumentParser(description='ldlibpath')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args=parser.parse_args(args_)
|
args=parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', [ 'run', 'build', 'devel' ],
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build', 'devel' ],
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
r = ''
|
r = ''
|
||||||
for m in deps:
|
for m in deps:
|
||||||
|
|
@ -659,7 +660,7 @@ def cmd_pythonpath(args_):
|
||||||
parser = argparse.ArgumentParser(description='pythonpath')
|
parser = argparse.ArgumentParser(description='pythonpath')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args=parser.parse_args(args_)
|
args=parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', [ 'run', 'build' ],
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build' ],
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
r = ''
|
r = ''
|
||||||
for m in deps:
|
for m in deps:
|
||||||
|
|
@ -674,7 +675,7 @@ def cmd_exepath(args_):
|
||||||
parser = argparse.ArgumentParser(description='exepath')
|
parser = argparse.ArgumentParser(description='exepath')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args=parser.parse_args(args_)
|
args=parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', [ 'run', 'build', 'devel' ],
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'], [ 'run', 'build', 'devel' ],
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
debug('deps = ', deps)
|
debug('deps = ', deps)
|
||||||
r = ''
|
r = ''
|
||||||
|
|
@ -701,7 +702,7 @@ def cmd_cflags(args_):
|
||||||
parser = argparse.ArgumentParser(description='cflags')
|
parser = argparse.ArgumentParser(description='cflags')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args=parser.parse_args(args_)
|
args=parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', 'build',
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'build',
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
r = ''
|
r = ''
|
||||||
for m in reversed(deps):
|
for m in reversed(deps):
|
||||||
|
|
@ -712,7 +713,7 @@ def cmd_path(args_):
|
||||||
parser = argparse.ArgumentParser(description='path')
|
parser = argparse.ArgumentParser(description='path')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args=parser.parse_args(args_)
|
args=parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', 'run',
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'run',
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
r = ''
|
r = ''
|
||||||
for m in deps:
|
for m in deps:
|
||||||
|
|
@ -725,7 +726,7 @@ def cmd_prereq(args_):
|
||||||
parser.add_argument('flavour', help='Flavour')
|
parser.add_argument('flavour', help='Flavour')
|
||||||
parser.add_argument('module', nargs='*', help='Modules')
|
parser.add_argument('module', nargs='*', help='Modules')
|
||||||
args = parser.parse_args(args_)
|
args = parser.parse_args(args_)
|
||||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw',
|
deps = get_modules_from_project_txt(args.module, ['pkg.requires.jw'],
|
||||||
args.flavour, scope = 2, add_self=False, names_only=True)
|
args.flavour, scope = 2, add_self=False, names_only=True)
|
||||||
print(' '.join(deps))
|
print(' '.join(deps))
|
||||||
|
|
||||||
|
|
@ -740,7 +741,7 @@ def cmd_required_os_pkg(args_):
|
||||||
modules = args.module
|
modules = args.module
|
||||||
flavours = args.flavours.split()
|
flavours = args.flavours.split()
|
||||||
debug("flavours = " + args.flavours)
|
debug("flavours = " + args.flavours)
|
||||||
deps = get_modules_from_project_txt(modules, 'pkg.requires.jw', flavours,
|
deps = get_modules_from_project_txt(modules, ['pkg.requires.jw'], flavours,
|
||||||
scope = 2, add_self=True, names_only=True)
|
scope = 2, add_self=True, names_only=True)
|
||||||
if args.skip_excluded:
|
if args.skip_excluded:
|
||||||
for d in deps:
|
for d in deps:
|
||||||
|
|
@ -811,7 +812,7 @@ def read_dep_graph(modules, section, graph):
|
||||||
for m in modules:
|
for m in modules:
|
||||||
if m in graph:
|
if m in graph:
|
||||||
continue
|
continue
|
||||||
deps = get_modules_from_project_txt([ m ], 'pkg.requires.jw', section,
|
deps = get_modules_from_project_txt([ m ], ['pkg.requires.jw'], section,
|
||||||
scope = 1, add_self=False, names_only=True)
|
scope = 1, add_self=False, names_only=True)
|
||||||
if not deps is None:
|
if not deps is None:
|
||||||
graph[m] = deps
|
graph[m] = deps
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue