File: copyright.py

package info (click to toggle)
game-data-packager 67
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye
  • size: 16,188 kB
  • sloc: python: 10,576; sh: 515; makefile: 491
file content (35 lines) | stat: -rwxr-xr-x 1,326 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python3
# encoding=utf-8
#
# Copyright © 2015 Simon McVittie <smcv@debian.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# You can find the GPL license text on a Debian system under
# /usr/share/common-licenses/GPL-2.

if __name__ == '__main__':
    cin = open('debian/copyright.in', encoding='utf-8')
    copy = open('debian/copyright', 'w', encoding='utf-8')

    copy.write(cin.__next__())
    copy.write('# This file was generated by debian/copyright.py from debian/copyright.in\n')
    copy.write('# Please edit one of those files instead\n')

    for line in cin:
        if line.lower().startswith('include-license:'):
            license = line.split(':', 1)[1].strip()
            for line in open(license, encoding='utf-8'):
                if line.strip():
                    copy.write('  ' + line)
                else:
                    copy.write(' .\n')
        else:
            copy.write(line)