From aa490cf0a44012158fec298cda30f0962add0982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Wed, 20 Mar 2013 09:31:27 -0300 Subject: Prioritize path_extension in which method --- changes/feature_improve_which | 2 ++ src/leap/common/files.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changes/feature_improve_which diff --git a/changes/feature_improve_which b/changes/feature_improve_which new file mode 100644 index 0000000..d1d1fb5 --- /dev/null +++ b/changes/feature_improve_which @@ -0,0 +1,2 @@ + o Prioritize the path_extension in the which method so it finds our bundled + app before the system one, if any. diff --git a/src/leap/common/files.py b/src/leap/common/files.py index 9b80236..e3c8423 100644 --- a/src/leap/common/files.py +++ b/src/leap/common/files.py @@ -112,7 +112,7 @@ def which(name, flags=os.X_OK, path_extension="/usr/sbin:/sbin"): result = [] exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep)) path = os.environ.get('PATH', None) - path += ":" + path_extension + path = path_extension + os.pathsep + path if path is None: return [] parts = path.split(os.pathsep) -- cgit v1.2.3