Merge pull request #25764 from akien-mga/scons-relative-import
SCons: Fix import clash between Godot and system modules
This commit is contained in:
commit
17809ca9a9
1 changed files with 11 additions and 10 deletions
21
SConstruct
21
SConstruct
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
EnsureSConsVersion(0, 98, 1)
|
EnsureSConsVersion(0, 98, 1)
|
||||||
|
|
||||||
import string
|
# System
|
||||||
import os
|
|
||||||
import os.path
|
|
||||||
import glob
|
import glob
|
||||||
|
import os
|
||||||
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# Local
|
||||||
import methods
|
import methods
|
||||||
import gles_builders
|
import gles_builders
|
||||||
from platform_methods import run_in_subprocess
|
from platform_methods import run_in_subprocess
|
||||||
|
@ -27,7 +29,7 @@ for x in sorted(glob.glob("platform/*")):
|
||||||
continue
|
continue
|
||||||
tmppath = "./" + x
|
tmppath = "./" + x
|
||||||
|
|
||||||
sys.path.append(tmppath)
|
sys.path.insert(0, tmppath)
|
||||||
import detect
|
import detect
|
||||||
|
|
||||||
if (os.path.exists(x + "/export/export.cpp")):
|
if (os.path.exists(x + "/export/export.cpp")):
|
||||||
|
@ -123,7 +125,6 @@ customs = ['custom.py']
|
||||||
|
|
||||||
profile = ARGUMENTS.get("profile", False)
|
profile = ARGUMENTS.get("profile", False)
|
||||||
if profile:
|
if profile:
|
||||||
import os.path
|
|
||||||
if os.path.isfile(profile):
|
if os.path.isfile(profile):
|
||||||
customs.append(profile)
|
customs.append(profile)
|
||||||
elif os.path.isfile(profile + ".py"):
|
elif os.path.isfile(profile + ".py"):
|
||||||
|
@ -203,7 +204,7 @@ for k in platform_opts.keys():
|
||||||
for x in module_list:
|
for x in module_list:
|
||||||
module_enabled = True
|
module_enabled = True
|
||||||
tmppath = "./modules/" + x
|
tmppath = "./modules/" + x
|
||||||
sys.path.append(tmppath)
|
sys.path.insert(0, tmppath)
|
||||||
import config
|
import config
|
||||||
enabled_attr = getattr(config, "is_enabled", None)
|
enabled_attr = getattr(config, "is_enabled", None)
|
||||||
if (callable(enabled_attr) and not config.is_enabled()):
|
if (callable(enabled_attr) and not config.is_enabled()):
|
||||||
|
@ -253,8 +254,8 @@ elif env_base['p'] != "":
|
||||||
env_base["platform"] = selected_platform
|
env_base["platform"] = selected_platform
|
||||||
|
|
||||||
if selected_platform in platform_list:
|
if selected_platform in platform_list:
|
||||||
|
tmppath = "./platform/" + selected_platform
|
||||||
sys.path.append("./platform/" + selected_platform)
|
sys.path.insert(0, tmppath)
|
||||||
import detect
|
import detect
|
||||||
if "create" in dir(detect):
|
if "create" in dir(detect):
|
||||||
env = detect.create(env_base)
|
env = detect.create(env_base)
|
||||||
|
@ -380,7 +381,7 @@ if selected_platform in platform_list:
|
||||||
|
|
||||||
suffix += env.extra_suffix
|
suffix += env.extra_suffix
|
||||||
|
|
||||||
sys.path.remove("./platform/" + selected_platform)
|
sys.path.remove(tmppath)
|
||||||
sys.modules.pop('detect')
|
sys.modules.pop('detect')
|
||||||
|
|
||||||
env.module_list = []
|
env.module_list = []
|
||||||
|
@ -390,7 +391,7 @@ if selected_platform in platform_list:
|
||||||
if not env['module_' + x + '_enabled']:
|
if not env['module_' + x + '_enabled']:
|
||||||
continue
|
continue
|
||||||
tmppath = "./modules/" + x
|
tmppath = "./modules/" + x
|
||||||
sys.path.append(tmppath)
|
sys.path.insert(0, tmppath)
|
||||||
env.current_module = x
|
env.current_module = x
|
||||||
import config
|
import config
|
||||||
# can_build changed number of arguments between 3.0 (1) and 3.1 (2),
|
# can_build changed number of arguments between 3.0 (1) and 3.1 (2),
|
||||||
|
|
Loading…
Reference in a new issue