aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/command_wrappers.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-09-18 21:09:54 +0200
committerGuido Günther <agx@sigxcpu.org>2017-09-19 19:07:31 +0200
commit096852c66b5d207a8e37d75011c2c648d62812c9 (patch)
tree78a8722dd4d4b9a71932563fea232fc481745af5 /gbp/command_wrappers.py
parent4e6c4cfbb1b6be83385b314ebe655c4e30d4efd5 (diff)
command_wrappers: fix path lookups
Python3 performs path lookups by itself when no path is given so remove our path lookup code. Thanks: Nish Aravamudan
Diffstat (limited to 'gbp/command_wrappers.py')
-rw-r--r--gbp/command_wrappers.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index 0532a04b..76def2e4 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -72,12 +72,13 @@ class Command(object):
Note that it does not do any shell quoting even with shell=True so
you have to quote arguments yourself if necessary.
+
+ If cmd doesn't contain a path component it will be looked up in $PATH.
"""
def __init__(self, cmd, args=[], shell=False, extra_env=None, cwd=None,
capture_stderr=False,
- capture_stdout=False,
- check_path=False):
- self.cmd = self._find_in_path(cmd) if check_path else cmd
+ capture_stdout=False):
+ self.cmd = cmd
self.args = args
self.run_error = "'%s' failed: {err_reason}" % (" ".join([self.cmd] + self.args))
self.shell = shell
@@ -91,13 +92,6 @@ class Command(object):
self.env = None
self._reset_state()
- def _find_in_path(self, exe):
- for p in os.getenv("PATH", "/usr/bin:/bin"):
- path = os.path.join(p, exe)
- if os.path.exists(path):
- return path
- return exe
-
def _reset_state(self):
self.retcode = 1
self.stdout, self.stderr, self.err_reason = [''] * 3