mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 12:03:31 +01:00
projects.py: Support make/project.conf, fix --prefix
- Allow make/project.conf as alternative project config file - Fix --prefix option Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
8597e3b87d
commit
7965d9cd91
1 changed files with 34 additions and 23 deletions
|
|
@ -40,30 +40,34 @@ def get_value(name, section, key):
|
|||
file.close()
|
||||
return r
|
||||
|
||||
path = proj_root + '/doc/share/project.txt'
|
||||
r = ()
|
||||
file = open(path)
|
||||
if not len(section):
|
||||
for line in file:
|
||||
r = re.findall('^ *' + key + ' *= *(.*)', line)
|
||||
if (len(r) > 0):
|
||||
break
|
||||
else:
|
||||
in_section = False
|
||||
pat = '[' + section + ']'
|
||||
for line in file:
|
||||
if (line.rstrip() == pat):
|
||||
in_section = True
|
||||
continue
|
||||
if in_section:
|
||||
if len(line) and line[0] == '[':
|
||||
break
|
||||
for conf in [ '/doc/share/project.txt', '/make/project.conf' ]:
|
||||
path = proj_root + conf
|
||||
r = ()
|
||||
try:
|
||||
file = open(path)
|
||||
except:
|
||||
continue
|
||||
if not len(section):
|
||||
for line in file:
|
||||
r = re.findall('^ *' + key + ' *= *(.*)', line)
|
||||
if (len(r) > 0):
|
||||
break
|
||||
file.close()
|
||||
if len(r):
|
||||
return r[0]
|
||||
else:
|
||||
in_section = False
|
||||
pat = '[' + section + ']'
|
||||
for line in file:
|
||||
if (line.rstrip() == pat):
|
||||
in_section = True
|
||||
continue
|
||||
if in_section:
|
||||
if len(line) and line[0] == '[':
|
||||
break
|
||||
r = re.findall('^ *' + key + ' *= *(.*)', line)
|
||||
if (len(r) > 0):
|
||||
break
|
||||
file.close()
|
||||
if len(r):
|
||||
return r[0]
|
||||
return None
|
||||
|
||||
def add_modules_from_project_txt(buf, spec, section, key, add_self, recursive,
|
||||
|
|
@ -147,14 +151,21 @@ def cmd_pkg_requires(args_):
|
|||
r.append(' '.join(dep))
|
||||
print ', '.join(r)
|
||||
|
||||
# -------------------------------------------------------------------- here we go
|
||||
|
||||
global_args = []
|
||||
skip = 0
|
||||
for a in sys.argv[1::]:
|
||||
global_args.append(a)
|
||||
if a in [ '--prefix', '-p' ]:
|
||||
skip = 1
|
||||
continue
|
||||
if skip > 0:
|
||||
skip = skip -1
|
||||
continue
|
||||
if a[0] != '-':
|
||||
break
|
||||
|
||||
# -------------------------------------------------------------------- here we go
|
||||
|
||||
parser = argparse.ArgumentParser(description='Project metadata evaluation')
|
||||
parser.add_argument('cmd', default='', help='Command')
|
||||
parser.add_argument('--prefix', '-p', nargs='?', default = expanduser("~") + '/local/src/cvs.stable/proj', help='Project Path Prefix')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue