diff --git a/scripts/projects.py b/scripts/projects.py index 266f6b43..0fa12d07 100644 --- a/scripts/projects.py +++ b/scripts/projects.py @@ -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')