Skip to content

Commit

Permalink
Merge 40d1ab9 into b449e24
Browse files Browse the repository at this point in the history
  • Loading branch information
alubbock committed Dec 10, 2018
2 parents b449e24 + 40d1ab9 commit 1a03ae5
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions pysb/pathfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ def get_path(prog_name):
path_conf['name'],
_get_executable(prog_name)))

# If this is anaconda, check the anaconda binary dir
if _is_anaconda():
try:
_path_cache[prog_name] = _validate_path(prog_name,
_get_anaconda_bindir())
return _path_cache[prog_name]
except ValueError:
pass
# Check the Anaconda environment, if applicable, or BINDIR
try:
_path_cache[prog_name] = _validate_path(prog_name,
_get_anaconda_bindir())
return _path_cache[prog_name]
except ValueError:
pass

# Check default paths for this operating system
if os.name not in path_conf['search_paths'].keys():
Expand Down Expand Up @@ -186,10 +185,6 @@ def set_path(prog_name, full_path):
_path_cache[prog_name] = _validate_path(prog_name, full_path)


def _is_anaconda():
""" Identify if this is an anaconda environment """
return 'conda' in sys.version


def _get_anaconda_bindir():
""" Get the binary path from python build time (for anaconda) """
Expand All @@ -198,7 +193,7 @@ def _get_anaconda_bindir():
if conda_env:
return os.path.join(conda_env, 'Scripts' if os.name == 'nt' else 'bin')

# Otherwise, use the default anaconda bin directory
# Otherwise, try the default anaconda/python bin directory
bindir = sysconfig.get_config_var('BINDIR')
if os.name == 'nt':
# bindir doesn't point to scripts directory on Windows
Expand Down Expand Up @@ -236,7 +231,7 @@ def _validate_path(prog_name, full_path):
if not os.path.isfile(full_path):
# On anaconda, check batch file on Windows, if applicable
batch_file = _get_batch_file(prog_name)
if _is_anaconda() and os.name == 'nt' and batch_file:
if os.name == 'nt' and batch_file:
try:
return _validate_path(prog_name,
os.path.join(full_path, batch_file))
Expand Down

0 comments on commit 1a03ae5

Please sign in to comment.