Skip to content

Commit

Permalink
create_dev_env: Only try to remove old dev env if it exists (#2439)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleymeigh2 authored Jan 3, 2025
2 parents 144797b + 5c5890f commit a5a16bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/release_notes/next/dev-2438-dev-env-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2438: Only try to remove old dev env if it exists
8 changes: 5 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,11 @@ def make_environment_file(self, extra_deps):
return output_env_file.name

def run(self):
print("Removing existing mantidimaging-dev environment")
command_conda_env_remove = [self.conda, "env", "remove", "-n", "mantidimaging-dev"]
subprocess.check_call(command_conda_env_remove)
existing_envs_output = subprocess.check_output([self.conda, "env", "list"], encoding="utf8")
if any(line.startswith("mantidimaging-dev ") for line in existing_envs_output.split("\n")):
print("Removing existing mantidimaging-dev environment")
command_conda_env_remove = [self.conda, "env", "remove", "-n", "mantidimaging-dev"]
subprocess.check_call(command_conda_env_remove)
extra_deps = self.get_package_depends()
env_file_path = self.make_environment_file(extra_deps)
print("Creating conda environment for development")
Expand Down

0 comments on commit a5a16bb

Please sign in to comment.