Skip to content

Commit

Permalink
Bring back devirtualization
Browse files Browse the repository at this point in the history
  • Loading branch information
dominichofer committed Nov 6, 2024
1 parent 8b5222c commit 77df0b9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/spack_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,23 @@ def run_with_spack(command: str, log: Path) -> None:
f.write(f"{command}\n\n")

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.
# 'deactivate' deactivates the python virtual environment.
# '2>&1' redirects stderr to stdout.
ret = subprocess.run(
f'{command} >> {log} 2>&1',
check=False,
shell=True,
env=env,
)
end = time.time()

Expand Down

0 comments on commit 77df0b9

Please sign in to comment.