2014-12-12 15:42:40 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
import io
|
2014-12-15 23:22:38 +00:00
|
|
|
import optparse
|
2014-12-12 15:42:40 +00:00
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2014-12-15 23:22:38 +00:00
|
|
|
parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
|
|
|
|
options, args = parser.parse_args()
|
|
|
|
if len(args) != 2:
|
|
|
|
parser.error('Expected an input and an output filename')
|
|
|
|
|
|
|
|
infile, outfile = args
|
|
|
|
|
|
|
|
with io.open(infile, encoding='utf-8') as inf:
|
2014-12-12 15:42:40 +00:00
|
|
|
readme = inf.read()
|
|
|
|
|
|
|
|
bug_text = re.search(
|
|
|
|
r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1)
|
|
|
|
dev_text = re.search(
|
2020-09-02 18:25:25 +00:00
|
|
|
r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING youtube-dlc',
|
2014-12-12 15:47:22 +00:00
|
|
|
readme).group(1)
|
2014-12-12 15:42:40 +00:00
|
|
|
|
|
|
|
out = bug_text + dev_text
|
|
|
|
|
2014-12-15 23:22:38 +00:00
|
|
|
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
2014-12-12 15:42:40 +00:00
|
|
|
outf.write(out)
|
|
|
|
|
2016-11-17 11:42:56 +00:00
|
|
|
|
2014-12-12 15:42:40 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|