Update execWith* docstrings
This commit is contained in:
parent
1a6a118665
commit
3560d12608
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -253,6 +253,7 @@
|
|||||||
<span class="k">def</span> <span class="nf">_run_program</span><span class="p">(</span><span class="n">argv</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">env_prune</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
|
<span class="k">def</span> <span class="nf">_run_program</span><span class="p">(</span><span class="n">argv</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">env_prune</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
|
||||||
<span class="n">binary_output</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">filter_stderr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
<span class="n">binary_output</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">filter_stderr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
||||||
<span class="sd">""" Run an external program, log the output and return it to the caller</span>
|
<span class="sd">""" Run an external program, log the output and return it to the caller</span>
|
||||||
|
|
||||||
<span class="sd"> :param argv: The command to run and argument</span>
|
<span class="sd"> :param argv: The command to run and argument</span>
|
||||||
<span class="sd"> :param root: The directory to chroot to before running command.</span>
|
<span class="sd"> :param root: The directory to chroot to before running command.</span>
|
||||||
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
||||||
@ -320,6 +321,7 @@
|
|||||||
<div class="viewcode-block" id="execWithRedirect"><a class="viewcode-back" href="../../pylorax.html#pylorax.executils.execWithRedirect">[docs]</a><span class="k">def</span> <span class="nf">execWithRedirect</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">env_prune</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
|
<div class="viewcode-block" id="execWithRedirect"><a class="viewcode-back" href="../../pylorax.html#pylorax.executils.execWithRedirect">[docs]</a><span class="k">def</span> <span class="nf">execWithRedirect</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">stdout</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">env_prune</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span>
|
||||||
<span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">binary_output</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
<span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">binary_output</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
||||||
<span class="sd">""" Run an external program and redirect the output to a file.</span>
|
<span class="sd">""" Run an external program and redirect the output to a file.</span>
|
||||||
|
|
||||||
<span class="sd"> :param command: The command to run</span>
|
<span class="sd"> :param command: The command to run</span>
|
||||||
<span class="sd"> :param argv: The argument list</span>
|
<span class="sd"> :param argv: The argument list</span>
|
||||||
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
||||||
@ -339,6 +341,7 @@
|
|||||||
<div class="viewcode-block" id="execWithCapture"><a class="viewcode-back" href="../../pylorax.html#pylorax.executils.execWithCapture">[docs]</a><span class="k">def</span> <span class="nf">execWithCapture</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">filter_stderr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
|
<div class="viewcode-block" id="execWithCapture"><a class="viewcode-back" href="../../pylorax.html#pylorax.executils.execWithCapture">[docs]</a><span class="k">def</span> <span class="nf">execWithCapture</span><span class="p">(</span><span class="n">command</span><span class="p">,</span> <span class="n">argv</span><span class="p">,</span> <span class="n">stdin</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">root</span><span class="o">=</span><span class="s">'/'</span><span class="p">,</span> <span class="n">log_output</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span> <span class="n">filter_stderr</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span>
|
||||||
<span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
<span class="n">raise_err</span><span class="o">=</span><span class="bp">False</span><span class="p">,</span> <span class="n">callback</span><span class="o">=</span><span class="bp">None</span><span class="p">):</span>
|
||||||
<span class="sd">""" Run an external program and capture standard out and err.</span>
|
<span class="sd">""" Run an external program and capture standard out and err.</span>
|
||||||
|
|
||||||
<span class="sd"> :param command: The command to run</span>
|
<span class="sd"> :param command: The command to run</span>
|
||||||
<span class="sd"> :param argv: The argument list</span>
|
<span class="sd"> :param argv: The argument list</span>
|
||||||
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
<span class="sd"> :param stdin: The file object to read stdin from.</span>
|
||||||
|
Binary file not shown.
@ -264,32 +264,56 @@
|
|||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="pylorax.executils.execWithCapture">
|
<dt id="pylorax.executils.execWithCapture">
|
||||||
<tt class="descclassname">pylorax.executils.</tt><tt class="descname">execWithCapture</tt><big>(</big><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>root='/'</em>, <em>log_output=True</em>, <em>filter_stderr=False</em>, <em>raise_err=False</em>, <em>callback=None</em><big>)</big><a class="reference internal" href="_modules/pylorax/executils.html#execWithCapture"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithCapture" title="Permalink to this definition">¶</a></dt>
|
<tt class="descclassname">pylorax.executils.</tt><tt class="descname">execWithCapture</tt><big>(</big><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>root='/'</em>, <em>log_output=True</em>, <em>filter_stderr=False</em>, <em>raise_err=False</em>, <em>callback=None</em><big>)</big><a class="reference internal" href="_modules/pylorax/executils.html#execWithCapture"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithCapture" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>Run an external program and capture standard out and err.
|
<dd><p>Run an external program and capture standard out and err.</p>
|
||||||
:param command: The command to run
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
:param argv: The argument list
|
<col class="field-name" />
|
||||||
:param stdin: The file object to read stdin from.
|
<col class="field-body" />
|
||||||
:param root: The directory to chroot to before running command.
|
<tbody valign="top">
|
||||||
:param log_output: Whether to log the output of command
|
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
:param filter_stderr: Whether stderr should be excluded from the returned output
|
<li><strong>command</strong> – The command to run</li>
|
||||||
:param raise_err: whether to raise a CalledProcessError if the returncode is non-zero
|
<li><strong>argv</strong> – The argument list</li>
|
||||||
:return: The output of the command</p>
|
<li><strong>stdin</strong> – The file object to read stdin from.</li>
|
||||||
|
<li><strong>root</strong> – The directory to chroot to before running command.</li>
|
||||||
|
<li><strong>log_output</strong> – Whether to log the output of command</li>
|
||||||
|
<li><strong>filter_stderr</strong> – Whether stderr should be excluded from the returned output</li>
|
||||||
|
<li><strong>raise_err</strong> – whether to raise a CalledProcessError if the returncode is non-zero</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The output of the command</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="pylorax.executils.execWithRedirect">
|
<dt id="pylorax.executils.execWithRedirect">
|
||||||
<tt class="descclassname">pylorax.executils.</tt><tt class="descname">execWithRedirect</tt><big>(</big><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>stdout=None</em>, <em>root='/'</em>, <em>env_prune=None</em>, <em>log_output=True</em>, <em>binary_output=False</em>, <em>raise_err=False</em>, <em>callback=None</em><big>)</big><a class="reference internal" href="_modules/pylorax/executils.html#execWithRedirect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithRedirect" title="Permalink to this definition">¶</a></dt>
|
<tt class="descclassname">pylorax.executils.</tt><tt class="descname">execWithRedirect</tt><big>(</big><em>command</em>, <em>argv</em>, <em>stdin=None</em>, <em>stdout=None</em>, <em>root='/'</em>, <em>env_prune=None</em>, <em>log_output=True</em>, <em>binary_output=False</em>, <em>raise_err=False</em>, <em>callback=None</em><big>)</big><a class="reference internal" href="_modules/pylorax/executils.html#execWithRedirect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pylorax.executils.execWithRedirect" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>Run an external program and redirect the output to a file.
|
<dd><p>Run an external program and redirect the output to a file.</p>
|
||||||
:param command: The command to run
|
<table class="docutils field-list" frame="void" rules="none">
|
||||||
:param argv: The argument list
|
<col class="field-name" />
|
||||||
:param stdin: The file object to read stdin from.
|
<col class="field-body" />
|
||||||
:param stdout: Optional file object to redirect stdout and stderr to.
|
<tbody valign="top">
|
||||||
:param root: The directory to chroot to before running command.
|
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||||
:param env_prune: environment variable to remove before execution
|
<li><strong>command</strong> – The command to run</li>
|
||||||
:param log_output: whether to log the output of command
|
<li><strong>argv</strong> – The argument list</li>
|
||||||
:param binary_output: whether to treat the output of command as binary data
|
<li><strong>stdin</strong> – The file object to read stdin from.</li>
|
||||||
:param raise_err: whether to raise a CalledProcessError if the returncode is non-zero
|
<li><strong>stdout</strong> – Optional file object to redirect stdout and stderr to.</li>
|
||||||
:param callback: method to call while waiting for process to finish, passed Popen object
|
<li><strong>root</strong> – The directory to chroot to before running command.</li>
|
||||||
:return: The return code of the command</p>
|
<li><strong>env_prune</strong> – environment variable to remove before execution</li>
|
||||||
|
<li><strong>log_output</strong> – whether to log the output of command</li>
|
||||||
|
<li><strong>binary_output</strong> – whether to treat the output of command as binary data</li>
|
||||||
|
<li><strong>raise_err</strong> – whether to raise a CalledProcessError if the returncode is non-zero</li>
|
||||||
|
<li><strong>callback</strong> – method to call while waiting for process to finish, passed Popen object</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The return code of the command</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
@ -1197,7 +1221,7 @@ image is built with the filename “${prefix}-${kernel.version}.img”</
|
|||||||
<dd><p>Bases: <a class="reference internal" href="#pylorax.base.DataHolder" title="pylorax.base.DataHolder"><tt class="xref py py-class docutils literal"><span class="pre">pylorax.base.DataHolder</span></tt></a></p>
|
<dd><p>Bases: <a class="reference internal" href="#pylorax.base.DataHolder" title="pylorax.base.DataHolder"><tt class="xref py py-class docutils literal"><span class="pre">pylorax.base.DataHolder</span></tt></a></p>
|
||||||
<dl class="attribute">
|
<dl class="attribute">
|
||||||
<dt id="pylorax.ArchData.bcj_arch">
|
<dt id="pylorax.ArchData.bcj_arch">
|
||||||
<tt class="descname">bcj_arch</tt><em class="property"> = {'x86_64': 'x86', 'ppc': 'powerpc', 'ppc64': 'powerpc', 'arm': 'arm', 'i386': 'x86', 'ppc64le': 'powerpc', 'armhfp': 'arm'}</em><a class="headerlink" href="#pylorax.ArchData.bcj_arch" title="Permalink to this definition">¶</a></dt>
|
<tt class="descname">bcj_arch</tt><em class="property"> = {'ppc': 'powerpc', 'ppc64le': 'powerpc', 'armhfp': 'arm', 'arm': 'arm', 'ppc64': 'powerpc', 'x86_64': 'x86', 'i386': 'x86'}</em><a class="headerlink" href="#pylorax.ArchData.bcj_arch" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd></dd></dl>
|
<dd></dd></dl>
|
||||||
|
|
||||||
<dl class="attribute">
|
<dl class="attribute">
|
||||||
|
File diff suppressed because one or more lines are too long
@ -124,6 +124,7 @@ def startProgram(argv, root='/', stdin=None, stdout=subprocess.PIPE, stderr=subp
|
|||||||
def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_output=True,
|
def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_output=True,
|
||||||
binary_output=False, filter_stderr=False, raise_err=False, callback=None):
|
binary_output=False, filter_stderr=False, raise_err=False, callback=None):
|
||||||
""" Run an external program, log the output and return it to the caller
|
""" Run an external program, log the output and return it to the caller
|
||||||
|
|
||||||
:param argv: The command to run and argument
|
:param argv: The command to run and argument
|
||||||
:param root: The directory to chroot to before running command.
|
:param root: The directory to chroot to before running command.
|
||||||
:param stdin: The file object to read stdin from.
|
:param stdin: The file object to read stdin from.
|
||||||
@ -191,6 +192,7 @@ def _run_program(argv, root='/', stdin=None, stdout=None, env_prune=None, log_ou
|
|||||||
def execWithRedirect(command, argv, stdin=None, stdout=None, root='/', env_prune=None,
|
def execWithRedirect(command, argv, stdin=None, stdout=None, root='/', env_prune=None,
|
||||||
log_output=True, binary_output=False, raise_err=False, callback=None):
|
log_output=True, binary_output=False, raise_err=False, callback=None):
|
||||||
""" Run an external program and redirect the output to a file.
|
""" Run an external program and redirect the output to a file.
|
||||||
|
|
||||||
:param command: The command to run
|
:param command: The command to run
|
||||||
:param argv: The argument list
|
:param argv: The argument list
|
||||||
:param stdin: The file object to read stdin from.
|
:param stdin: The file object to read stdin from.
|
||||||
@ -210,6 +212,7 @@ def execWithRedirect(command, argv, stdin=None, stdout=None, root='/', env_prune
|
|||||||
def execWithCapture(command, argv, stdin=None, root='/', log_output=True, filter_stderr=False,
|
def execWithCapture(command, argv, stdin=None, root='/', log_output=True, filter_stderr=False,
|
||||||
raise_err=False, callback=None):
|
raise_err=False, callback=None):
|
||||||
""" Run an external program and capture standard out and err.
|
""" Run an external program and capture standard out and err.
|
||||||
|
|
||||||
:param command: The command to run
|
:param command: The command to run
|
||||||
:param argv: The argument list
|
:param argv: The argument list
|
||||||
:param stdin: The file object to read stdin from.
|
:param stdin: The file object to read stdin from.
|
||||||
|
Loading…
Reference in New Issue
Block a user