From 05719acdc5bf09d62830ac117e560868db2921a9 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Sun, 28 Apr 2024 21:51:00 +0200 Subject: [PATCH 1/3] BUG: the native and cross files must be UTF-8 encoded --- mesonpy/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index 0455bfd19..7aad33686 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -703,7 +703,7 @@ def __init__( cpu_family = {family!r} endian = 'little' ''') - self._meson_cross_file.write_text(cross_file_data) + self._meson_cross_file.write_text(cross_file_data, encoding='utf-8') self._meson_args['setup'].extend(('--cross-file', os.fspath(self._meson_cross_file))) # write the native file @@ -711,7 +711,7 @@ def __init__( [binaries] python = '{sys.executable}' ''') - self._meson_native_file.write_text(native_file_data) + self._meson_native_file.write_text(native_file_data, encoding='utf-8') # reconfigure if we have a valid Meson build directory. Meson # uses the presence of the 'meson-private/coredata.dat' file From 877c4e5e4a5428c1994e70d8a6ddda4417752c38 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Sun, 28 Apr 2024 21:52:06 +0200 Subject: [PATCH 2/3] BUG: pyproject.toml must be UTF-8 encoded --- mesonpy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index 7aad33686..0d9d5629a 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -646,7 +646,7 @@ def __init__( self._limited_api = False # load pyproject.toml - pyproject = tomllib.loads(self._source_dir.joinpath('pyproject.toml').read_text()) + pyproject = tomllib.loads(self._source_dir.joinpath('pyproject.toml').read_text(encoding='utf-8')) # load meson args from pyproject.toml pyproject_config = _validate_pyproject_config(pyproject) From 7af999b5e8200412797a1bb3fbf6db3c4f241744 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Sun, 28 Apr 2024 21:52:28 +0200 Subject: [PATCH 3/3] BUG: Meson introspection data is UTF-8 encoded --- mesonpy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesonpy/__init__.py b/mesonpy/__init__.py index 0d9d5629a..917bd6d04 100644 --- a/mesonpy/__init__.py +++ b/mesonpy/__init__.py @@ -818,7 +818,7 @@ def build(self) -> None: def _info(self, name: str) -> Any: """Read info from meson-info directory.""" info = self._build_dir.joinpath('meson-info', f'{name}.json') - return json.loads(info.read_text()) + return json.loads(info.read_text(encoding='utf-8')) @property def _manifest(self) -> DefaultDict[str, List[Tuple[pathlib.Path, str]]]: