summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-18 02:32:06 +0100
committerAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-22 04:21:12 +0100
commit55669f6cfc03e96cee236dc9b9cdeb1deb31cef0 (patch)
tree4578b4b0b93346e2356de779cf4c0c06f31e0668 /utils
parentc08bffde98391a193debbeaee9af8c4f5ef8c77f (diff)
downloadsphinx-git-55669f6cfc03e96cee236dc9b9cdeb1deb31cef0.tar.gz
Specify encoding
Diffstat (limited to 'utils')
-rwxr-xr-xutils/bump_version.py10
-rw-r--r--utils/doclinter.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/utils/bump_version.py b/utils/bump_version.py
index 1d2101c6d..aeaed864b 100755
--- a/utils/bump_version.py
+++ b/utils/bump_version.py
@@ -27,7 +27,7 @@ def bump_version(path, version_info, in_develop=True):
if in_develop:
version += '+'
- with open(path, 'r+') as f:
+ with open(path, 'r+', encoding='utf-8') as f:
body = f.read()
body = re.sub(r"(?<=__version__ = ')[^']+", version, body)
body = re.sub(r"(?<=__released__ = ')[^']+", release, body)
@@ -88,7 +88,7 @@ class Changes:
self.fetch_version()
def fetch_version(self):
- with open(self.path) as f:
+ with open(self.path, encoding='utf-8') as f:
version = f.readline().strip()
matched = re.search(r'^Release (.*) \((.*)\)$', version)
if matched is None:
@@ -105,7 +105,7 @@ class Changes:
release_date = datetime.now().strftime('%b %d, %Y')
heading = 'Release %s (released %s)' % (self.version, release_date)
- with open(self.path, 'r+') as f:
+ with open(self.path, 'r+', encoding='utf-8') as f:
f.readline() # skip first two lines
f.readline()
body = f.read()
@@ -126,12 +126,12 @@ class Changes:
version_info[4] or '')
heading = 'Release %s (in development)' % version
- with open(os.path.join(script_dir, 'CHANGES_template')) as f:
+ with open(os.path.join(script_dir, 'CHANGES_template'), encoding='utf-8') as f:
f.readline() # skip first two lines
f.readline()
tmpl = f.read()
- with open(self.path, 'r+') as f:
+ with open(self.path, 'r+', encoding='utf-8') as f:
body = f.read()
f.seek(0)
diff --git a/utils/doclinter.py b/utils/doclinter.py
index 6ef8cbe10..d67a49b05 100644
--- a/utils/doclinter.py
+++ b/utils/doclinter.py
@@ -12,7 +12,7 @@ LEADING_SPACES = re.compile(r'^(\s*)')
def lint(path: str) -> int:
- with open(path) as f:
+ with open(path, encoding='utf-8') as f:
document = f.readlines()
errors = 0