Skip to content

Commit

Permalink
fix(scripts/repin.sh): deactivate and delete env before recreating it
Browse files Browse the repository at this point in the history
  • Loading branch information
vringar committed Jul 20, 2024
1 parent 5e77c98 commit 75634dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
22 changes: 8 additions & 14 deletions scripts/prune-environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,21 @@ def iterate_deps(
break # break out of the sep loop to avoid duplicate entries


def split_off_pip_if_exists(env: dict[str, list[str]], has_pip: bool) -> list[str]:
return env["dependencies"][:-1] if has_pip else env["dependencies"]


deps_not_pip: List[str] = []
deps_pip: List[str] = []

env_unpinned_contains_pip = "pip" in env_unpinned["dependencies"][-1]
env_unpinned_dev_contains_pip = "pip" in env_unpinned_dev["dependencies"][-1]
iterate_deps(
(
env_pinned["dependencies"][:-1]
if env_unpinned_contains_pip or env_unpinned_dev_contains_pip
else env_pinned["dependencies"]
),
(
env_unpinned["dependencies"][:-1]
if env_unpinned_contains_pip
else env_unpinned["dependencies"]
)
+ (
env_unpinned_dev["dependencies"][:-1]
if env_unpinned_dev_contains_pip
else env_unpinned_dev["dependencies"]
split_off_pip_if_exists(
env_pinned, env_unpinned_contains_pip or env_unpinned_dev_contains_pip
),
split_off_pip_if_exists(env_unpinned, env_unpinned_contains_pip)
+ split_off_pip_if_exists(env_unpinned_dev, env_unpinned_dev_contains_pip),
deps_not_pip,
)

Expand Down
6 changes: 5 additions & 1 deletion scripts/repin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ set -e
# Make mamba available to shell script
eval "$(conda shell.bash hook)"


echo "Deactivating and destroying the openwpm env so it can be recreated"
conda deactivate
conda env remove -q -y -n openwpm

# Create openwpm env with unpinned yaml file
# `PYTHONNOUSERSITE` set so python ignores local user site libraries when building the env
# See: https://github.com/openwpm/OpenWPM/pull/682#issuecomment-645648939
Expand Down Expand Up @@ -36,7 +41,6 @@ Darwin)
;;
esac


# Export the environment including manually specify channels
mamba env export --no-builds --override-channels -c conda-forge -c main -f ../environment.yaml

Expand Down

0 comments on commit 75634dc

Please sign in to comment.