contrib/import-checker.py
changeset 25063 723e364488f4
parent 24669 fbdbff1b486a
child 25064 3bbbadf69d0a
equal deleted inserted replaced
25062:b7a8e9fa605f 25063:723e364488f4
   213 
   213 
   214 def _cycle_sortkey(c):
   214 def _cycle_sortkey(c):
   215     return len(c), c
   215     return len(c), c
   216 
   216 
   217 def main(argv):
   217 def main(argv):
   218     if len(argv) < 2:
   218     if len(argv) < 2 or (argv[1] == '-' and len(argv) > 2):
   219         print 'Usage: %s file [file] [file] ...'
   219         print 'Usage: %s {-|file [file] [file] ...}'
   220         return 1
   220         return 1
       
   221     if argv[1] == '-':
       
   222         argv = argv[:1]
       
   223         argv.extend(l.rstrip() for l in sys.stdin.readlines())
   221     used_imports = {}
   224     used_imports = {}
   222     any_errors = False
   225     any_errors = False
   223     for source_path in argv[1:]:
   226     for source_path in argv[1:]:
   224         f = open(source_path)
   227         f = open(source_path)
   225         modname = dotted_name_of_path(source_path, trimpure=True)
   228         modname = dotted_name_of_path(source_path, trimpure=True)