Fix pep2rss to specify output encoding (GH-634)
This commit is contained in:
parent
44ee870453
commit
abab110be1
|
@ -1,16 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# usage: pep-hook.py $REPOS $REV
|
||||
# (standard post-commit args)
|
||||
|
||||
import os, glob, time, datetime, stat, re, sys
|
||||
import codecs
|
||||
import PyRSS2Gen as rssgen
|
||||
|
||||
RSS_PATH = os.path.join(sys.argv[1], 'peps.rss')
|
||||
|
||||
def firstline_startingwith(full_path, text):
|
||||
for line in codecs.open(full_path, encoding="utf-8"):
|
||||
for line in open(full_path, encoding="utf-8"):
|
||||
if line.startswith(text):
|
||||
return line[len(text):].strip()
|
||||
return None
|
||||
|
@ -71,5 +70,5 @@ rss = rssgen.RSS2(
|
|||
lastBuildDate = datetime.datetime.now(),
|
||||
items = items)
|
||||
|
||||
with open(RSS_PATH, 'w') as fp:
|
||||
fp.write(rss.to_xml())
|
||||
with open(RSS_PATH, 'w', encoding="utf-8") as fp:
|
||||
fp.write(rss.to_xml(encoding="utf-8"))
|
||||
|
|
Loading…
Reference in New Issue