Skip to content

Commit

Permalink
revert clean env
Browse files Browse the repository at this point in the history
  • Loading branch information
dominichofer committed Nov 7, 2024
1 parent 20fe9af commit 6fb5890
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parent_dir=$( cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" ; pwd -P )

if [[ "$#" == 1 ]]; then
uenv="$1"
export SPACK_UENV_PATH="$uenv"
export SPACK_SYSTEM_CONFIG_PATH="$uenv"/config

if [[ $uenv == "euler" ]]; then
Expand Down
20 changes: 10 additions & 10 deletions test/spack_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ def run_with_spack(command: str, log: Path) -> None:
with log.open("a") as f:
f.write(f"{command}\n\n")

# setup-env.sh may define SPACK_UENV_PATH.
if "SPACK_UENV_PATH" in os.environ:
uenv = os.environ["SPACK_UENV_PATH"]
else:
uenv = ""

start = time.time()
# Remove python virtual environment paths for this subprocess call
env = os.environ.copy()
if 'VIRTUAL_ENV' in env:
del env['VIRTUAL_ENV']
if 'PATH' in env:
# Filter out any paths related to the virtual environment
env['PATH'] = ':'.join(p for p in env['PATH'].split(':')
if '.venv' not in p)
# Direct stream to avoid buffering.
# 'env -i' clears the environment.
# 'bash -l' makes it a login shell.
# 'bash -c' reads commands from string.
# '2>&1' redirects stderr to stdout.
ret = subprocess.run(
f'{command} >> {log} 2>&1',
f'env -i bash -l -c "(. {REPO_DIR}/setup-env.sh {uenv}; {command}) >> {log} 2>&1"',
check=False,
shell=True,
env=env,
)
end = time.time()

Expand Down

0 comments on commit 6fb5890

Please sign in to comment.