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.
This commit is contained in:
Rémi Verschelde 2021-02-11 17:54:35 +01:00
parent b9863e157e
commit 75910d1e9b
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 3 deletions

View File

@ -174,9 +174,7 @@ def detect_modules(search_path, recursive=False):
version_path = os.path.join(path, "version.py") version_path = os.path.join(path, "version.py")
if os.path.exists(version_path): if os.path.exists(version_path):
with open(version_path) as f: with open(version_path) as f:
version = {} if 'short_name = "godot"' in f.read():
exec(f.read(), version)
if version.get("short_name") == "godot":
return True return True
return False return False