mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 06:06:32 +00:00
graph-depends: handle the depth argument in a more pythonic way
Add some comment as well, enhance help text. [thanks to Samuel for the hints to make it even more pythonic] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Cc: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
95ab905ba7
commit
e347bee02c
@ -33,13 +33,15 @@ FULL_MODE = 1
|
|||||||
PKG_MODE = 2
|
PKG_MODE = 2
|
||||||
|
|
||||||
mode = 0
|
mode = 0
|
||||||
|
|
||||||
|
# Limit drawing the dependency graph to this depth. 0 means 'no limit'.
|
||||||
max_depth = 0
|
max_depth = 0
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Graph pacakges dependencies")
|
parser = argparse.ArgumentParser(description="Graph pacakges dependencies")
|
||||||
parser.add_argument("--package", '-p', metavar="PACKAGE",
|
parser.add_argument("--package", '-p', metavar="PACKAGE",
|
||||||
help="Graph the dependencies of PACKAGE")
|
help="Graph the dependencies of PACKAGE")
|
||||||
parser.add_argument("--depth", '-d', metavar="DEPTH",
|
parser.add_argument("--depth", '-d', metavar="DEPTH", dest="depth", type=int, default=0,
|
||||||
help="Limit the dependency graph to DEPTH levels")
|
help="Limit the dependency graph to DEPTH levels; 0 means no limit.")
|
||||||
parser.add_argument("--transitive", dest="transitive", action='store_true',
|
parser.add_argument("--transitive", dest="transitive", action='store_true',
|
||||||
default=True)
|
default=True)
|
||||||
parser.add_argument("--no-transitive", dest="transitive", action='store_false',
|
parser.add_argument("--no-transitive", dest="transitive", action='store_false',
|
||||||
@ -52,8 +54,7 @@ else:
|
|||||||
mode = PKG_MODE
|
mode = PKG_MODE
|
||||||
rootpkg = args.package
|
rootpkg = args.package
|
||||||
|
|
||||||
if args.depth is not None:
|
max_depth = args.depth
|
||||||
max_depth = int(args.depth)
|
|
||||||
|
|
||||||
transitive = args.transitive
|
transitive = args.transitive
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user