Skip to content

Commit

Permalink
Add update --recreate option
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshanuikabundi committed Aug 31, 2022
1 parent 0f7e2e7 commit f5ddc4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions soap/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import environ
from pathlib import Path
from typing import Sequence, Dict, Optional, Union
from shutil import which
from shutil import which, rmtree
import subprocess as sp
from soap.utils import get_git_root

Expand All @@ -15,7 +15,7 @@ def conda(
*,
stdin: Optional[str] = None,
env: Optional[Dict[str, str]] = None,
cmd: Optional[str] = None
cmd: Optional[str] = None,
):
"""
Call conda or mamba with the specified arguments
Expand Down Expand Up @@ -76,8 +76,8 @@ def env_from_file(
delete and recreate an existing environment.
"""
env_path = Path(env_path)
if not allow_update:
env_path.unlink(missing_ok=True)
if env_path.exists() and not allow_update:
rmtree(env_path)

if env_path.exists() and allow_update:
conda(
Expand Down

0 comments on commit f5ddc4e

Please sign in to comment.