Skip to content
Snippets Groups Projects
Commit 6b58bddb authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Add --find-imports option

parent 6b98bfa7
Branches
No related tags found
No related merge requests found
......@@ -151,6 +151,9 @@ if __name__ == '__main__':
optParser.add_option('--filter-imports',
action='store_true',
help='Filter out files that are not imported')
optParser.add_option('--find-imports',
action='store_true',
help='Add files below CWD imported from MAIN')
(options, args) = optParser.parse_args(sys.argv[1:])
if options.documentation:
......@@ -171,6 +174,13 @@ if __name__ == '__main__':
args = [ keep[0] ] + sorted(keep[1:])
pass
if options.find_imports:
visitor = ImportVisitor(args[0])
imported = [ os.path.normpath(f) for f in visitor.find_all_imports() ]
given = [ os.path.normpath(f) for f in args ]
args = [ given[0] ] + list(sorted(set(imported) | set(given[1:])))
pass
# Read all python files
code = []
processed = set()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment