aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mdist.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-06-22 22:59:16 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-06-29 11:28:08 +0200
commit3e396b3782813d36d46195564cd0e111422bcaf5 (patch)
treef315e990f71984745fcb8f22dac2f0e400fecadb /mesonbuild/mdist.py
parent28175bbee2c111cf41b80c97bbadd7dbabaa8990 (diff)
downloadmeson-3e396b3782813d36d46195564cd0e111422bcaf5.zip
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.gz
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.bz2
fix: Always explicitly set encoding for text files (fixes #8263)
Diffstat (limited to 'mesonbuild/mdist.py')
-rw-r--r--mesonbuild/mdist.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py
index 397f8cd..22196d8 100644
--- a/mesonbuild/mdist.py
+++ b/mesonbuild/mdist.py
@@ -49,7 +49,7 @@ def create_hash(fname):
hashname = fname + '.sha256sum'
m = hashlib.sha256()
m.update(open(fname, 'rb').read())
- with open(hashname, 'w') as f:
+ with open(hashname, 'w', encoding='utf-8') as f:
# A space and an asterisk because that is the format defined by GNU coreutils
# and accepted by busybox and the Perl shasum tool.
f.write('{} *{}\n'.format(m.hexdigest(), os.path.basename(fname)))
@@ -67,7 +67,7 @@ def process_submodules(dirname):
if not os.path.exists(module_file):
return
subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive'], cwd=dirname)
- for line in open(module_file):
+ for line in open(module_file, encoding='utf-8'):
line = line.strip()
if '=' not in line:
continue
@@ -242,7 +242,7 @@ def check_dist(packagename, meson_command, extra_meson_args, bld_root, privdir):
unpacked_files = glob(os.path.join(unpackdir, '*'))
assert(len(unpacked_files) == 1)
unpacked_src_dir = unpacked_files[0]
- with open(os.path.join(bld_root, 'meson-info', 'intro-buildoptions.json')) as boptions:
+ with open(os.path.join(bld_root, 'meson-info', 'intro-buildoptions.json'), encoding='utf-8') as boptions:
meson_command += ['-D{name}={value}'.format(**o) for o in json.load(boptions)
if o['name'] not in ['backend', 'install_umask', 'buildtype']]
meson_command += extra_meson_args