mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-21 05:47:38 +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()
|
file.close()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
path = proj_root + '/doc/share/project.txt'
|
for conf in [ '/doc/share/project.txt', '/make/project.conf' ]:
|
||||||
r = ()
|
path = proj_root + conf
|
||||||
file = open(path)
|
r = ()
|
||||||
if not len(section):
|
try:
|
||||||
for line in file:
|
file = open(path)
|
||||||
r = re.findall('^ *' + key + ' *= *(.*)', line)
|
except:
|
||||||
if (len(r) > 0):
|
continue
|
||||||
break
|
if not len(section):
|
||||||
else:
|
for line in file:
|
||||||
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)
|
r = re.findall('^ *' + key + ' *= *(.*)', line)
|
||||||
if (len(r) > 0):
|
if (len(r) > 0):
|
||||||
break
|
break
|
||||||
file.close()
|
else:
|
||||||
if len(r):
|
in_section = False
|
||||||
return r[0]
|
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
|
return None
|
||||||
|
|
||||||
def add_modules_from_project_txt(buf, spec, section, key, add_self, recursive,
|
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))
|
r.append(' '.join(dep))
|
||||||
print ', '.join(r)
|
print ', '.join(r)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------- here we go
|
||||||
|
|
||||||
global_args = []
|
global_args = []
|
||||||
|
skip = 0
|
||||||
for a in sys.argv[1::]:
|
for a in sys.argv[1::]:
|
||||||
global_args.append(a)
|
global_args.append(a)
|
||||||
|
if a in [ '--prefix', '-p' ]:
|
||||||
|
skip = 1
|
||||||
|
continue
|
||||||
|
if skip > 0:
|
||||||
|
skip = skip -1
|
||||||
|
continue
|
||||||
if a[0] != '-':
|
if a[0] != '-':
|
||||||
break
|
break
|
||||||
|
|
||||||
# -------------------------------------------------------------------- here we go
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Project metadata evaluation')
|
parser = argparse.ArgumentParser(description='Project metadata evaluation')
|
||||||
parser.add_argument('cmd', default='', help='Command')
|
parser.add_argument('cmd', default='', help='Command')
|
||||||
parser.add_argument('--prefix', '-p', nargs='?', default = expanduser("~") + '/local/src/cvs.stable/proj', help='Project Path Prefix')
|
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