summaryrefslogtreecommitdiff
path: root/methods.py
diff options
context:
space:
mode:
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/methods.py b/methods.py
index cb3b39ac68..ca6756f95f 100644
--- a/methods.py
+++ b/methods.py
@@ -2,6 +2,7 @@ import os
import re
import glob
import subprocess
+from collections import OrderedDict
def add_source_files(self, sources, files, warn_duplicates=True):
@@ -138,7 +139,7 @@ def parse_cg_file(fname, uniforms, sizes, conditionals):
def detect_modules(at_path):
- module_list = {} # name : path
+ module_list = OrderedDict() # name : path
modules_glob = os.path.join(at_path, "*")
files = glob.glob(modules_glob)
@@ -230,6 +231,30 @@ def disable_module(self):
self.disabled_modules.append(self.current_module)
+def module_check_dependencies(self, module, dependencies):
+ """
+ Checks if module dependencies are enabled for a given module,
+ and prints a warning if they aren't.
+ Meant to be used in module `can_build` methods.
+ Returns a boolean (True if dependencies are satisfied).
+ """
+ missing_deps = []
+ for dep in dependencies:
+ opt = "module_{}_enabled".format(dep)
+ if not opt in self or not self[opt]:
+ missing_deps.append(dep)
+
+ if missing_deps != []:
+ print(
+ "Disabling '{}' module as the following dependencies are not satisfied: {}".format(
+ module, ", ".join(missing_deps)
+ )
+ )
+ return False
+ else:
+ return True
+
+
def use_windows_spawn_fix(self, platform=None):
if os.name != "nt":
@@ -778,3 +803,14 @@ def show_progress(env):
progress_finish_command = Command("progress_finish", [], progress_finish)
AlwaysBuild(progress_finish_command)
+
+
+def dump(env):
+ # Dumps latest build information for debugging purposes and external tools.
+ from json import dump
+
+ def non_serializable(obj):
+ return "<<non-serializable: %s>>" % (type(obj).__qualname__)
+
+ with open(".scons_env.json", "w") as f:
+ dump(env.Dictionary(), f, indent=4, default=non_serializable)