make_contributing.py 819 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env python3
  2. from __future__ import unicode_literals
  3. import io
  4. import optparse
  5. import re
  6. def main():
  7. return # This is unused in yt-dlp
  8. parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
  9. options, args = parser.parse_args()
  10. if len(args) != 2:
  11. parser.error('Expected an input and an output filename')
  12. infile, outfile = args
  13. with io.open(infile, encoding='utf-8') as inf:
  14. readme = inf.read()
  15. bug_text = re.search(
  16. r'(?s)#\s*BUGS\s*[^\n]*\s*(.*?)#\s*COPYRIGHT', readme).group(1)
  17. dev_text = re.search(
  18. r'(?s)(#\s*DEVELOPER INSTRUCTIONS.*?)#\s*EMBEDDING yt-dlp', readme).group(1)
  19. out = bug_text + dev_text
  20. with io.open(outfile, 'w', encoding='utf-8') as outf:
  21. outf.write(out)
  22. if __name__ == '__main__':
  23. main()