Skip to content
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions scripts/llnl/common_build_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,9 +637,26 @@ def get_build_dir(prefix, host_config):
return pjoin(prefix, "build-" + host_config_root)


_repo_dir = ""
def get_repo_dir():
script_dir = os.path.dirname(os.path.realpath(__file__))
return os.path.abspath(pjoin(script_dir, "../.."))
""" Return absolute path to Smith or Serac repo """
# Only set var once
global _repo_dir
if not _repo_dir:
# Set repo dir to be relative to this script
_repo_dir = os.path.abspath(pjoin(get_script_dir(), "../.."))

# Check the parent dir for an uberenv config with a package_name "smith".
# This means Serac is a submodule. Change the repo dir to be parent dir (i.e.
# Smith repo dir)
smith_uberenv_config_path = pjoin(_repo_dir, "../.uberenv_config.json")
if os.path.exists(smith_uberenv_config_path):
with open(smith_uberenv_config_path) as json_file:
data = json.load(json_file)
if "package_name" in data:
if data["package_name"] == "smith":
_repo_dir = pjoin(_repo_dir, "../")
return _repo_dir


def get_build_and_test_root(prefix, timestamp):
Expand Down Expand Up @@ -685,7 +702,7 @@ def get_shared_spot_dir():


def get_uberenv_path():
return pjoin(get_script_dir(), "../uberenv/uberenv.py")
return pjoin(get_repo_dir(), "scripts/uberenv/uberenv.py")


def on_rz():
Expand All @@ -703,7 +720,7 @@ def get_script_dir():
def get_project_name():
global _project_name
if not _project_name:
uberenv_config_path = os.path.abspath(os.path.join(get_script_dir(), "../../.uberenv_config.json"))
uberenv_config_path = pjoin(get_repo_dir(), ".uberenv_config.json")
_project_name = "UNKNOWN_PROJECT"
if os.path.exists(uberenv_config_path):
with open(uberenv_config_path) as json_file:
Expand Down