From 2a3657055b8a8a1d3ce076072aa5a642f1c1fb2b Mon Sep 17 00:00:00 2001 From: Nana Mensah Date: Mon, 28 Oct 2019 12:03:27 +0000 Subject: [PATCH] Add environment scripts to remove dx python2 from PYTHONPATH --- wscleaner/README.md | 4 ++++ wscleaner/env/activate_env_vars.sh | 10 ++++++++++ wscleaner/env/deactivate_env_vars.sh | 4 ++++ 3 files changed, 18 insertions(+) create mode 100644 wscleaner/env/activate_env_vars.sh create mode 100644 wscleaner/env/deactivate_env_vars.sh diff --git a/wscleaner/README.md b/wscleaner/README.md index 515e4cb..91c17fb 100644 --- a/wscleaner/README.md +++ b/wscleaner/README.md @@ -52,6 +52,10 @@ optional arguments: pytest . --auth_token DNA_NEXUS_KEY ``` +## Workstation Environment +The directory `env/` in this repository contains conda environment scripts for the workstation. These remove conflicts in the PYTHONPATH environment variable by editing the variable when conda is activated. The conda documentation describes where to place these scripts under ['saving environment variables'](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#macos-and-linux). + + ## License Developed by Viapath Genome Informatics diff --git a/wscleaner/env/activate_env_vars.sh b/wscleaner/env/activate_env_vars.sh new file mode 100644 index 0000000..b77e02c --- /dev/null +++ b/wscleaner/env/activate_env_vars.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Cache the python path +export wsc_PPCACHE=$PYTHONPATH + +# Remove the dxtoolkit path from the pythonpath environment variable +# Python searches this when importing modules, causing clashes with conda install +PYTHONPATH_CLEAN=$(echo $PYTHONPATH | sed s,/usr/share/dnanexus/lib/python2.7/site-packages:,,) +# Set the new pythonpath +export PYTHONPATH=$PYTHONPATH_CLEAN diff --git a/wscleaner/env/deactivate_env_vars.sh b/wscleaner/env/deactivate_env_vars.sh new file mode 100644 index 0000000..e0f5191 --- /dev/null +++ b/wscleaner/env/deactivate_env_vars.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +# Set the python path to the original before the environment was active +export PYTHONPATH=${wsc_PPCACHE}