mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-25 07:00:39 +01:00
projects.py: Add option -d (debug)
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
37130aa077
commit
f0e320698a
1 changed files with 12 additions and 5 deletions
|
|
@ -16,8 +16,9 @@ def re_section(name):
|
||||||
re.DOTALL)
|
re.DOTALL)
|
||||||
# --------------------------------------------------------------------- helpers
|
# --------------------------------------------------------------------- helpers
|
||||||
|
|
||||||
def warning(*objs):
|
def debug(*objs):
|
||||||
print("WARNING: ", *objs, file=sys.stderr)
|
if args.debug:
|
||||||
|
print("DEBUG: ", *objs, file=sys.stderr)
|
||||||
|
|
||||||
def proj_dir(name):
|
def proj_dir(name):
|
||||||
return projs_root + '/' + name
|
return projs_root + '/' + name
|
||||||
|
|
@ -42,7 +43,7 @@ def get_section(path, section):
|
||||||
return r.rstrip()
|
return r.rstrip()
|
||||||
|
|
||||||
def read_value(path, section, key):
|
def read_value(path, section, key):
|
||||||
warning("opening ", path)
|
debug("opening ", path)
|
||||||
try:
|
try:
|
||||||
file = open(path)
|
file = open(path)
|
||||||
except:
|
except:
|
||||||
|
|
@ -104,7 +105,7 @@ def add_modules_from_project_txt(buf, visited, spec, section, key, add_self, sco
|
||||||
# return
|
# return
|
||||||
visited.add(spec)
|
visited.add(spec)
|
||||||
deps = get_value(name, section, key)
|
deps = get_value(name, section, key)
|
||||||
warning("name = ", name, "section = ", section, "key = ", key, "deps = ", deps, "scope = ", scope, "visited = ", visited)
|
debug("name = ", name, "section = ", section, "key = ", key, "deps = ", deps, "scope = ", scope, "visited = ", visited)
|
||||||
if deps and scope > 0:
|
if deps and scope > 0:
|
||||||
if scope == 1:
|
if scope == 1:
|
||||||
subscope = 0
|
subscope = 0
|
||||||
|
|
@ -242,7 +243,6 @@ def cmd_proj_dir(args_):
|
||||||
|
|
||||||
# -------------------------------------------------------------------- here we go
|
# -------------------------------------------------------------------- here we go
|
||||||
|
|
||||||
warning("running ", ' '.join(sys.argv))
|
|
||||||
global_args = []
|
global_args = []
|
||||||
skip = 0
|
skip = 0
|
||||||
for a in sys.argv[1::]:
|
for a in sys.argv[1::]:
|
||||||
|
|
@ -256,13 +256,20 @@ for a in sys.argv[1::]:
|
||||||
if a[0] != '-':
|
if a[0] != '-':
|
||||||
break
|
break
|
||||||
|
|
||||||
|
topdir = None
|
||||||
|
top_name = None
|
||||||
|
|
||||||
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('--debug', '-d', nargs='?', const=True, default=False, help='Output debug information to stderr')
|
||||||
parser.add_argument('--topdir', '-t', nargs='?', help='Project Path')
|
parser.add_argument('--topdir', '-t', nargs='?', help='Project Path')
|
||||||
parser.add_argument('--prefix', '-p', nargs='?', default = expanduser("~") +
|
parser.add_argument('--prefix', '-p', nargs='?', default = expanduser("~") +
|
||||||
'/local/src/cvs.stable/proj', help='Projects Path Prefix')
|
'/local/src/cvs.stable/proj', help='Projects Path Prefix')
|
||||||
parser.add_argument('arg', nargs='*', help='Command arguments')
|
parser.add_argument('arg', nargs='*', help='Command arguments')
|
||||||
args=parser.parse_args(global_args)
|
args=parser.parse_args(global_args)
|
||||||
|
|
||||||
|
debug("running ", ' '.join(sys.argv))
|
||||||
|
|
||||||
projs_root = args.prefix
|
projs_root = args.prefix
|
||||||
if args.topdir:
|
if args.topdir:
|
||||||
topdir = args.topdir
|
topdir = args.topdir
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue