From 4ad479bd12db55c42e10306a16e2ae52696eb658 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 21 Jan 2024 13:07:58 +0100 Subject: [PATCH] Fix build with recent clang. --- setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 5d49790..9ba52bf 100644 --- a/setup.py +++ b/setup.py @@ -13,14 +13,14 @@ @contextlib.contextmanager def patched_path(path, old, new): - contents = path.read_text() + contents = path.read_text("latin-1") if old not in contents: raise Exception(f"Invalid patch: {old}") try: - path.write_text(contents.replace(old, new)) + path.write_text(contents.replace(old, new), "utf-8") yield finally: - path.write_text(contents) + path.write_text(contents, "latin-1") patches = [ @@ -32,6 +32,10 @@ def patched_path(path, old, new): "-Wextra", "-Wextra -Wno-deprecated-declarations -Wno-sign-conversion"), ("Makefiles/Makefile_Mac_clang_shared", "$(LINK_FLAGS)", "$(LINK_FLAGS) -lc++"), + ("TransTableL.cpp", + "const unsigned char lengths[][DDS_SUITS]) const", + "const unsigned char lengths[DDS_SUITS][DDS_SUITS]) const"), + ("Moves.cpp", "", ""), # Only for reencoding. ]