From 10f0be77196105347d90078e1f8bf621cf6486e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 11 Feb 2021 17:54:35 +0100 Subject: [PATCH] SCons: Fix Godot detection in custom modules logic `exec()` was not a good idea as it assumes a certain type of `version.py` file similar to Godot's own file, which is not always a reliable assumption (see https://github.com/godotengine/godot/pull/43057#issuecomment-777632900). Also restores Python 2 support for the 3.2 branch. (cherry picked from commit 75910d1e9b37dc5647a9f8883c5a2268188a2423) --- methods.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/methods.py b/methods.py index d9bc4fcb065..7f16bd56aac 100644 --- a/methods.py +++ b/methods.py @@ -163,9 +163,7 @@ def detect_modules(search_path, recursive=False): version_path = os.path.join(path, "version.py") if os.path.exists(version_path): with open(version_path) as f: - version = {} - exec(f.read(), version) - if version.get("short_name") == "godot": + if 'short_name = "godot"' in f.read(): return True return False