From 35a66e02c582a152a354f19ea4ae56700b89a79d Mon Sep 17 00:00:00 2001 From: Forest Gregg Date: Wed, 29 Dec 2021 13:44:29 -0500 Subject: [PATCH 1/5] open setup.py as utf-8 in get_requires_python_str will close #976 --- cibuildwheel/projectfiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cibuildwheel/projectfiles.py b/cibuildwheel/projectfiles.py index c4f63c176..eb5fc76cb 100644 --- a/cibuildwheel/projectfiles.py +++ b/cibuildwheel/projectfiles.py @@ -70,7 +70,7 @@ def get_requires_python_str(package_dir: Path) -> Optional[str]: pass try: - with (package_dir / "setup.py").open() as f2: + with (package_dir / "setup.py").open(encoding='utf8') as f2: return setup_py_python_requires(f2.read()) except FileNotFoundError: pass From a109b71f3f84331c44fcb064678106dd4c81b4ed Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Dec 2021 18:45:40 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cibuildwheel/projectfiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cibuildwheel/projectfiles.py b/cibuildwheel/projectfiles.py index eb5fc76cb..fece392f8 100644 --- a/cibuildwheel/projectfiles.py +++ b/cibuildwheel/projectfiles.py @@ -70,7 +70,7 @@ def get_requires_python_str(package_dir: Path) -> Optional[str]: pass try: - with (package_dir / "setup.py").open(encoding='utf8') as f2: + with (package_dir / "setup.py").open(encoding="utf8") as f2: return setup_py_python_requires(f2.read()) except FileNotFoundError: pass From 217b8bd7d7044025ec34c5f37c1d29a6fb5ffb8a Mon Sep 17 00:00:00 2001 From: mayeut Date: Wed, 29 Dec 2021 19:51:50 +0100 Subject: [PATCH 3/5] update test for UTF-8 setup.py --- unit_test/projectfiles_test.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/unit_test/projectfiles_test.py b/unit_test/projectfiles_test.py index c62df6a9c..0ec2ded9e 100644 --- a/unit_test/projectfiles_test.py +++ b/unit_test/projectfiles_test.py @@ -34,7 +34,7 @@ def test_read_setup_py_full(tmp_path): setuptools.randomfunc() setuptools.setup( - name = "hello", + name = "hello©", other = 23, example = ["item", "other"], python_requires = "1.24", @@ -43,7 +43,9 @@ def test_read_setup_py_full(tmp_path): ) ) - assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) == "1.24" + assert ( + setup_py_python_requires(tmp_path.joinpath("setup.py").read_text(encoding="utf8")) == "1.24" + ) assert get_requires_python_str(tmp_path) == "1.24" From 14060376a46f86f0dc9bcd23785c4578510b7562 Mon Sep 17 00:00:00 2001 From: mayeut Date: Wed, 29 Dec 2021 22:22:13 +0100 Subject: [PATCH 4/5] Update projectfiles_test.py --- unit_test/projectfiles_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit_test/projectfiles_test.py b/unit_test/projectfiles_test.py index 0ec2ded9e..66dff4c2f 100644 --- a/unit_test/projectfiles_test.py +++ b/unit_test/projectfiles_test.py @@ -25,7 +25,7 @@ def test_read_setup_py_simple(tmp_path): def test_read_setup_py_full(tmp_path): - with open(tmp_path / "setup.py", "w") as f: + with open(tmp_path / "setup.py", "w", encoding="utf8") as f: f.write( dedent( """ From b9c8a11a9167866a2524ec80df609f11b40688d0 Mon Sep 17 00:00:00 2001 From: mayeut Date: Thu, 30 Dec 2021 00:23:34 +0100 Subject: [PATCH 5/5] fix test --- unit_test/projectfiles_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unit_test/projectfiles_test.py b/unit_test/projectfiles_test.py index 66dff4c2f..6c55d46a1 100644 --- a/unit_test/projectfiles_test.py +++ b/unit_test/projectfiles_test.py @@ -34,7 +34,8 @@ def test_read_setup_py_full(tmp_path): setuptools.randomfunc() setuptools.setup( - name = "hello©", + name = "hello", + description = "≥“”ü", other = 23, example = ["item", "other"], python_requires = "1.24",