1
Fork 0

Updated path to add to user path

This commit is contained in:
Edgar P. Burkhart 2022-03-03 12:59:49 +01:00
parent ca099834ca
commit b0c316ff37
Signed by: edpibu
GPG Key ID: 9833D3C5A25BD227
1 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import logging import logging
import os
import sys import sys
import argparse import argparse
import pathlib import pathlib
@ -30,7 +31,9 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
log.info(f"Copying files to '{tmpdir}'") log.info(f"Copying files to '{tmpdir}'")
shutil.copy2(inp, tmpdir) shutil.copy2(inp, tmpdir)
shutil.copytree(pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True) shutil.copytree(
pathlib.Path(config.get("data", "out")), tmpdir, dirs_exist_ok=True
)
if config.has_option("swash", "mpi"): if config.has_option("swash", "mpi"):
mpi = ("-mpi", config.get("swash", "mpi")) mpi = ("-mpi", config.get("swash", "mpi"))
@ -46,7 +49,11 @@ with tempfile.TemporaryDirectory(prefix="swash_", dir=".") as tmp_raw:
log.info(f"Running {cmd}") log.info(f"Running {cmd}")
swash_run = subprocess.Popen( swash_run = subprocess.Popen(
cmd, cwd=tmpdir, stdout=logfile, stderr=logfile, env={"PATH": path} cmd,
cwd=tmpdir,
stdout=logfile,
stderr=logfile,
env={"PATH": f"{path}:{os.environ['PATH']}"},
) )
code = swash_run.wait() code = swash_run.wait()