summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-02-11 17:54:35 +0100
committerRémi Verschelde <rverschelde@gmail.com>2021-02-11 17:54:41 +0100
commit75910d1e9b37dc5647a9f8883c5a2268188a2423 (patch)
tree63514c71a14a0bcd47f4fe093df73a567f74b3c6
parentb9863e157e3329d4a74f4c3c738ddd414cb28799 (diff)
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.
-rw-r--r--methods.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/methods.py b/methods.py
index f302500b5d..45cfe00959 100644
--- a/methods.py
+++ b/methods.py
@@ -174,9 +174,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