From: Markus Koschany <apo@debian.org>
Date: Sat, 25 Feb 2023 20:52:57 +0100
Subject: python3.11

Origin: https://github.com/renpy/renpy/commit/72815a4915ecb43999f75ff0aaf78ba66020f9aa
---
 module/setup.py    | 5 +++--
 module/setuplib.py | 3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/module/setup.py b/module/setup.py
index 8568a4a..84f9892 100644
--- a/module/setup.py
+++ b/module/setup.py
@@ -56,7 +56,7 @@ setup_env("LD")
 setup_env("CXX")
 
 import setuplib
-from setuplib import android, ios, emscripten, raspi, include, library, cython, cmodule, copyfile, find_unnecessary_gen, generate_all_cython
+from setuplib import android, ios, emscripten, raspi, include, library, cython, cmodule, copyfile, find_unnecessary_gen, generate_all_cython, PY2
 
 # These control the level of optimization versus debugging.
 setuplib.extra_compile_args = [ "-Wno-unused-function" ]
@@ -173,7 +173,8 @@ cython("renpy.pydict")
 cython("renpy.style")
 
 # renpy.compat
-cython("renpy.compat.dictviews")
+if PY2:
+    cython("renpy.compat.dictviews")
 
 # renpy.styledata
 cython("renpy.styledata.styleclass")
diff --git a/module/setuplib.py b/module/setuplib.py
index 5ca782f..01415db 100644
--- a/module/setuplib.py
+++ b/module/setuplib.py
@@ -53,6 +53,9 @@ gen = "gen"
 
 if sys.version_info.major > 2:
     gen += "3"
+    PY2 = False
+else:
+    PY2 = True
 
 if coverage:
     gen += "-coverage"
