Debian Codegraph @

examples/deb822/grep_native_packages.py

raw
1 #!/usr/bin/python3
2
3 # grep the names of all Debian native packages out of Sources files
4 # Copyright (C) 2007 Stefano Zacchiroli <[email protected]>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 import sys
12
13 from debian import deb822
14
15
16 if __name__ == '__main__':
17 for fname in sys.argv[1:]:
18 with open(fname) as f:
19 for stanza in deb822.Sources.iter_paragraphs(f):
20 pieces = stanza['version'].split('-')
21 if len(pieces) < 2:
22 print(stanza['package'])
23