def check_with(conf, check, what, *args, **kwargs): """ Perform `check`, also looking at directories specified by the --with-X commandline option and X_HOME environment variable (X = what.upper()) The extra_args """ import os from os.path import abspath with_dir = getattr(conf.options, "with_" + what, None) env_dir = os.environ.get(what.upper() + "_HOME", None) paths = [with_dir, env_dir] + kwargs.pop("extra_paths", []) WHAT = what.upper() kwargs["uselib_store"] = kwargs.get("uselib_store", WHAT) kwargs["use"] = kwargs.get("use", []) + [kwargs["uselib_store"]] for path in [abspath(p) for p in paths if p]: conf.to_log("Checking for %s in %s" % (what, path)) if conf.find_at(check, WHAT, path, **kwargs): conf.msg("Found %s at" % what, path, color="WHITE") return check(**kwargs) conf.msg("Found %s at" % what, "(local environment)", color="WHITE")
def check_with(conf, check, what, *args, **kwargs): """ Perform `check`, also looking at --with-X commandline option and and X_HOME environment variable """ import os with_dir = getattr(conf.options, "with_" + what, None) env_dir = os.environ.get(what.upper() + "_HOME", None) paths = [with_dir, env_dir] + kwargs.pop("extra_paths", []) what = what.upper() kwargs["uselib_store"] = kwargs.get("uselib_store", what) kwargs["use"] = kwargs.get("use", []) + [kwargs["uselib_store"]] for path in [p for p in paths if p]: conf.to_log("Checking in %s" % path) if conf.find_at(check, what, path, **kwargs): return check(**kwargs)