make_contributing.py 763 B

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