135
140
stylesheet_url, source_path, dest_path))
136
141
subprocess.call(command, shell=True)
143
def convert_changelog(lxml_path, changelog_file_path, rst2html_script, stylesheet_url):
144
f = open_file(os.path.join(lxml_path, 'CHANGES.txt'), 'r', encoding='utf-8')
150
links = dict(LP='`%s <https://bugs.launchpad.net/lxml/+bug/%s>`_',
151
GH='`%s <https://github.com/lxml/lxml/issues/%s>`_')
152
replace_tracker_links = re.compile('((LP|GH)#([0-9]+))').sub
153
def insert_link(match):
154
text, ref_type, ref_id = match.groups()
155
return links[ref_type] % (text, ref_id)
156
content = replace_tracker_links(insert_link, content)
158
command = [sys.executable, rst2html_script] + RST2HTML_OPTIONS.split() + [
159
'--link-stylesheet', '--stylesheet', stylesheet_url ]
160
out_file = open(changelog_file_path, 'wb')
162
rst2html = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=out_file)
163
rst2html.communicate(content.encode('utf8'))
138
167
def publish(dirname, lxml_path, release):
139
168
if not os.path.exists(dirname):
140
169
os.mkdir(dirname)
180
209
build_menu(tree, basename, section_head)
182
211
# also convert CHANGES.txt
184
os.path.join(lxml_path, 'CHANGES.txt'),
185
os.path.join(dirname, 'changes-%s.html' % release),
212
convert_changelog(lxml_path, os.path.join(dirname, 'changes-%s.html' % release),
213
script, stylesheet_url)
188
215
# generate sitemap from menu
189
216
sitemap = XML('''\