Skip to content

Commit

Permalink
bugfix for active env path determination in CondaPackage() where dir …
Browse files Browse the repository at this point in the history
…is already correct (no trailing bin/) (#329)
  • Loading branch information
tomkinsc committed Jun 1, 2016
1 parent 86c66dd commit 749a1c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def __init__(
# CONDA_ENV_PATH is always a path, but not always present
self.env_path = None
if "CONDA_ENV_PATH" in os.environ and len(os.environ["CONDA_ENV_PATH"]):
_log.debug('CONDA_ENV_PATH found')
last_path_component = os.path.basename(os.path.normpath(os.environ["CONDA_ENV_PATH"]))
self.env_path = os.path.dirname(os.environ["CONDA_ENV_PATH"]) if last_path_component == "bin" else os.environ["CONDA_ENV_PATH"]
elif "CONDA_DEFAULT_ENV" in os.environ and len(os.environ["CONDA_DEFAULT_ENV"]):
Expand All @@ -248,7 +249,7 @@ def __init__(
_log.debug('Conda env found is specified as dir: %s' % conda_env_path)
conda_env_path = os.path.abspath(conda_env_path)
last_path_component = os.path.basename(os.path.normpath(conda_env_path))
self.env_path = os.path.dirname(last_path_component) if last_path_component == "bin" else last_path_component
self.env_path = os.path.dirname(last_path_component) if last_path_component == "bin" else conda_env_path
else: # if conda env is an environment name, infer the path
_log.debug('Conda env found is specified by name: %s' % conda_env_path)
result = util.misc.run_and_print(["conda", "env", "list", "--json"], loglevel=logging.DEBUG, env=os.environ)
Expand Down

0 comments on commit 749a1c2

Please sign in to comment.