]> Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/prepare_manpage.py
f66bebfea6de2cec60a10f943380b9247e5c3d60
[youtubedl] / devscripts / prepare_manpage.py
1 from __future__ import unicode_literals
2
3 import io
4 import os.path
5 import sys
6 import re
7
8 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
9 README_FILE = os.path.join(ROOT_DIR, 'README.md')
10
11 with io.open(README_FILE, encoding='utf-8') as f:
12 readme = f.read()
13
14 PREFIX = '%YOUTUBE-DL(1)\n\n# NAME\n'
15 readme = re.sub(r'(?s)# INSTALLATION.*?(?=# DESCRIPTION)', '', readme)
16 readme = PREFIX + readme
17
18 if sys.version_info < (3, 0):
19 print(readme.encode('utf-8'))
20 else:
21 print(readme)