Skip to content

Commit

Permalink
correct os.environ usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkinsc committed May 29, 2016
1 parent 669ed7f commit 6017a44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ def __init__(
# in newer versions of conda, CONDA_DEFAULT_ENV can be used
# as it is always the full path (in earlier versions it could be name or path)
# CONDA_ENV_PATH should be reliable, but may (?) be deprecated in the future
if env_root_path or env or not os.environ["CONDA_ENV_PATH"]:
if env_root_path or env or "CONDA_ENV_PATH" not in os.environ or ("CONDA_ENV_PATH" in os.environ and not len(os.environ["CONDA_ENV_PATH"])):
env_root_path = env_root_path or os.path.join(util.file.get_build_path(), 'conda-tools')
env = env or 'default'
self.env_path = os.path.realpath(os.path.expanduser(
os.path.join(env_root_path, env)))
# otherwise, get path of active conda env
elif os.environ["CONDA_ENV_PATH"]:
elif "CONDA_ENV_PATH" in os.environ and len(os.environ["CONDA_ENV_PATH"]):
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.dirname(os.environ["CONDA_ENV_PATH"])

Expand Down

0 comments on commit 6017a44

Please sign in to comment.