diff --git a/apa b/apa index c1932a9e7c2388087a7bb6412c93e8391e0ebcac..c162fef0ee932c2e4d134bee904e50be7cfe6e40 100755 --- a/apa +++ b/apa @@ -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()