Package gbp :: Module command_wrappers :: Class Command
[hide private]
[frames] | no frames]

Class Command

object --+
         |
        Command
Known Subclasses:

Wraps a shell command, so we don't have to store any kind of command line options in one of the git-buildpackage commands

Instance Methods [hide private]
 
__call(self, args)
Wraps subprocess.call so we can be verbose and fix python's SIGPIPE handling
 
__call__(self, args=[])
Run the command, convert all errors into CommandExecFailed, assumes that the lower levels printed an error message - only useful if you only expect 0 as result.
 
__init__(self, cmd, args=[], shell=False, extra_env=None, cwd=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__run(self, args)
run self.cmd adding args as additional arguments
 
call(self, args)
Like __call__ but don't use stderr and let the caller handle the return status

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__call__(self, args=[])
(Call operator)

 

Run the command, convert all errors into CommandExecFailed, assumes that the lower levels printed an error message - only useful if you only expect 0 as result.

>>> Command("/bin/true")(["foo", "bar"])
>>> Command("/foo/bar")()
Traceback (most recent call last):
...
CommandExecFailed

__init__(self, cmd, args=[], shell=False, extra_env=None, cwd=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__run(self, args)

 

run self.cmd adding args as additional arguments

Be verbose about errors and encode them in the return value, don't pass on exceptions.

call(self, args)

 

Like __call__ but don't use stderr and let the caller handle the return status

>>> Command("/bin/true").call(["foo", "bar"])
0
>>> Command("/foo/bar").call(["foo", "bar"]) # doctest:+ELLIPSIS
Traceback (most recent call last):
...
CommandExecFailed: Execution failed: ...