diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2017-12-11 11:47:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 11:47:40 +0100 |
commit | a14277eecf65ac216dd1b756acee8c23ecdf95d9 (patch) | |
tree | 174b504a43cf8b9e88165c1effd3ca9b28945d32 /git/util.py | |
parent | 0a96030d82fa379d24b952a58eed395143950c7b (diff) | |
parent | f48d08760552448a196fa400725cde7198e9c9b9 (diff) | |
download | gitpython-a14277eecf65ac216dd1b756acee8c23ecdf95d9.tar.gz |
Merge pull request #702 from yarikoptic/bf-happy-travis
BF (codename "happy travis"): trying to address lints etc to make Travis green again
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/git/util.py b/git/util.py index 5baeee91..18c28fd1 100644 --- a/git/util.py +++ b/git/util.py @@ -188,20 +188,15 @@ def assure_directory_exists(path, is_file=False): def _get_exe_extensions(): - try: - winprog_exts = tuple(p.upper() for p in os.environ['PATHEXT'].split(os.pathsep)) - except: - winprog_exts = ('.BAT', 'COM', '.EXE') - - return winprog_exts + PATHEXT = os.environ.get('PATHEXT', None) + return tuple(p.upper() for p in PATHEXT.split(os.pathsep)) \ + if PATHEXT \ + else (('.BAT', 'COM', '.EXE') if is_win else ()) def py_where(program, path=None): # From: http://stackoverflow.com/a/377028/548792 - try: - winprog_exts = tuple(p.upper() for p in os.environ['PATHEXT'].split(os.pathsep)) - except: - winprog_exts = is_win and ('.BAT', 'COM', '.EXE') or () + winprog_exts = _get_exe_extensions() def is_exec(fpath): return osp.isfile(fpath) and os.access(fpath, os.X_OK) and ( @@ -347,7 +342,7 @@ def expand_path(p, expand_vars=True): if expand_vars: p = osp.expandvars(p) return osp.normpath(osp.abspath(p)) - except: + except Exception: return None #} END utilities |