"""
This script tries to set ordering in which packages ought to be sent to builders.
-Input: file with names of packages. One package name per line.
+Input: file with names of packages. If not given packages are read from stdin. One package name per line.
Output: sorted packages on stdout.
If the script goes in a infinite loop, that means there is a cycle or other bug.
if __name__ == "__main__":
- if len(sys.argv) < 2:
- print("Usage: %s filename" % sys.argv[0])
- sys.exit(1)
- with open(sys.argv[1], 'r') as f:
+ with (len(sys.argv) > 1 and open(sys.argv[1], 'r') or sys.stdin) as f:
for line in f:
spec = os.path.basename(os.path.normpath(line.rstrip())).removesuffix('.spec')
parse_spec(spec)