616 lines
76 KiB
HTML
616 lines
76 KiB
HTML
|
|
||
|
|
||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
|
||
|
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
|
||
|
<title>composer.cli.blueprints — Lorax 19.7.14 documentation</title>
|
||
|
|
||
|
<link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
|
||
|
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
var DOCUMENTATION_OPTIONS = {
|
||
|
URL_ROOT: '../../../',
|
||
|
VERSION: '19.7.14',
|
||
|
COLLAPSE_INDEX: false,
|
||
|
FILE_SUFFIX: '.html',
|
||
|
HAS_SOURCE: true
|
||
|
};
|
||
|
</script>
|
||
|
<script type="text/javascript" src="../../../_static/jquery.js"></script>
|
||
|
<script type="text/javascript" src="../../../_static/underscore.js"></script>
|
||
|
<script type="text/javascript" src="../../../_static/doctools.js"></script>
|
||
|
<link rel="top" title="Lorax 19.7.14 documentation" href="../../../index.html" />
|
||
|
<link rel="up" title="composer.cli" href="../cli.html" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="../../../genindex.html" title="General Index"
|
||
|
accesskey="I">index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="../../../py-modindex.html" title="Python Module Index"
|
||
|
>modules</a> |</li>
|
||
|
<li><a href="../../../index.html">Lorax 19.7.14 documentation</a> »</li>
|
||
|
<li><a href="../../index.html" >Module code</a> »</li>
|
||
|
<li><a href="../cli.html" accesskey="U">composer.cli</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<div class="document">
|
||
|
<div class="documentwrapper">
|
||
|
<div class="bodywrapper">
|
||
|
<div class="body">
|
||
|
|
||
|
<h1>Source code for composer.cli.blueprints</h1><div class="highlight"><pre>
|
||
|
<span class="c">#</span>
|
||
|
<span class="c"># Copyright (C) 2018 Red Hat, Inc.</span>
|
||
|
<span class="c">#</span>
|
||
|
<span class="c"># This program is free software; you can redistribute it and/or modify</span>
|
||
|
<span class="c"># it under the terms of the GNU General Public License as published by</span>
|
||
|
<span class="c"># the Free Software Foundation; either version 2 of the License, or</span>
|
||
|
<span class="c"># (at your option) any later version.</span>
|
||
|
<span class="c">#</span>
|
||
|
<span class="c"># This program is distributed in the hope that it will be useful,</span>
|
||
|
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
|
||
|
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
|
||
|
<span class="c"># GNU General Public License for more details.</span>
|
||
|
<span class="c">#</span>
|
||
|
<span class="c"># You should have received a copy of the GNU General Public License</span>
|
||
|
<span class="c"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
|
||
|
<span class="c">#</span>
|
||
|
<span class="kn">import</span> <span class="nn">logging</span>
|
||
|
<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s">"composer-cli"</span><span class="p">)</span>
|
||
|
|
||
|
<span class="kn">import</span> <span class="nn">os</span>
|
||
|
<span class="kn">import</span> <span class="nn">json</span>
|
||
|
|
||
|
<span class="kn">from</span> <span class="nn">composer</span> <span class="kn">import</span> <span class="n">http_client</span> <span class="k">as</span> <span class="n">client</span>
|
||
|
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">argify</span><span class="p">,</span> <span class="n">frozen_toml_filename</span><span class="p">,</span> <span class="n">toml_filename</span><span class="p">,</span> <span class="n">handle_api_result</span>
|
||
|
<span class="kn">from</span> <span class="nn">composer.cli.utilities</span> <span class="kn">import</span> <span class="n">packageNEVRA</span>
|
||
|
|
||
|
<div class="viewcode-block" id="blueprints_cmd"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_cmd">[docs]</a><span class="k">def</span> <span class="nf">blueprints_cmd</span><span class="p">(</span><span class="n">opts</span><span class="p">):</span>
|
||
|
<span class="sd">"""Process blueprints commands</span>
|
||
|
|
||
|
<span class="sd"> :param opts: Cmdline arguments</span>
|
||
|
<span class="sd"> :type opts: argparse.Namespace</span>
|
||
|
<span class="sd"> :returns: Value to return from sys.exit()</span>
|
||
|
<span class="sd"> :rtype: int</span>
|
||
|
|
||
|
<span class="sd"> This dispatches the blueprints commands to a function</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">cmd_map</span> <span class="o">=</span> <span class="p">{</span>
|
||
|
<span class="s">"list"</span><span class="p">:</span> <span class="n">blueprints_list</span><span class="p">,</span>
|
||
|
<span class="s">"show"</span><span class="p">:</span> <span class="n">blueprints_show</span><span class="p">,</span>
|
||
|
<span class="s">"changes"</span><span class="p">:</span> <span class="n">blueprints_changes</span><span class="p">,</span>
|
||
|
<span class="s">"diff"</span><span class="p">:</span> <span class="n">blueprints_diff</span><span class="p">,</span>
|
||
|
<span class="s">"save"</span><span class="p">:</span> <span class="n">blueprints_save</span><span class="p">,</span>
|
||
|
<span class="s">"delete"</span><span class="p">:</span> <span class="n">blueprints_delete</span><span class="p">,</span>
|
||
|
<span class="s">"depsolve"</span><span class="p">:</span> <span class="n">blueprints_depsolve</span><span class="p">,</span>
|
||
|
<span class="s">"push"</span><span class="p">:</span> <span class="n">blueprints_push</span><span class="p">,</span>
|
||
|
<span class="s">"freeze"</span><span class="p">:</span> <span class="n">blueprints_freeze</span><span class="p">,</span>
|
||
|
<span class="s">"tag"</span><span class="p">:</span> <span class="n">blueprints_tag</span><span class="p">,</span>
|
||
|
<span class="s">"undo"</span><span class="p">:</span> <span class="n">blueprints_undo</span><span class="p">,</span>
|
||
|
<span class="s">"workspace"</span><span class="p">:</span> <span class="n">blueprints_workspace</span>
|
||
|
<span class="p">}</span>
|
||
|
<span class="k">if</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">cmd_map</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"Unknown blueprints command: </span><span class="si">%s</span><span class="s">"</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">cmd_map</span><span class="p">[</span><span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]](</span><span class="n">opts</span><span class="o">.</span><span class="n">socket</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">api_version</span><span class="p">,</span> <span class="n">opts</span><span class="o">.</span><span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">:],</span> <span class="n">opts</span><span class="o">.</span><span class="n">json</span><span class="p">)</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_list"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_list">[docs]</a><span class="k">def</span> <span class="nf">blueprints_list</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Output the list of available blueprints</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints list</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/list"</span><span class="p">)</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">"blueprints: "</span> <span class="o">+</span> <span class="s">", "</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">r</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">"blueprints"</span><span class="p">]]))</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_show"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_show">[docs]</a><span class="k">def</span> <span class="nf">blueprints_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Show the blueprints, in TOML format</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints show <blueprint,...> Display the blueprint in TOML format.</span>
|
||
|
|
||
|
<span class="sd"> Multiple blueprints will be separated by \n\n</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/info/</span><span class="si">%s</span><span class="s">?format=toml"</span> <span class="o">%</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span> <span class="o">+</span> <span class="s">"</span><span class="se">\n\n</span><span class="s">"</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_changes"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_changes">[docs]</a><span class="k">def</span> <span class="nf">blueprints_changes</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Display the changes for each of the blueprints</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints changes <blueprint,...> Display the changes for each blueprint.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/changes/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="s">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">"blueprints"</span><span class="p">]:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s">"name"</span><span class="p">])</span>
|
||
|
<span class="k">for</span> <span class="n">change</span> <span class="ow">in</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"changes"</span><span class="p">]:</span>
|
||
|
<span class="n">prettyCommitDetails</span><span class="p">(</span><span class="n">change</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="prettyCommitDetails"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.prettyCommitDetails">[docs]</a><span class="k">def</span> <span class="nf">prettyCommitDetails</span><span class="p">(</span><span class="n">change</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">):</span>
|
||
|
<span class="sd">"""Print the blueprint's change in a nice way</span>
|
||
|
|
||
|
<span class="sd"> :param change: The individual blueprint change dict</span>
|
||
|
<span class="sd"> :type change: dict</span>
|
||
|
<span class="sd"> :param indent: Number of spaces to indent</span>
|
||
|
<span class="sd"> :type indent: int</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">def</span> <span class="nf">revision</span><span class="p">():</span>
|
||
|
<span class="k">if</span> <span class="n">change</span><span class="p">[</span><span class="s">"revision"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">" revision </span><span class="si">%d</span><span class="s">"</span> <span class="o">%</span> <span class="n">change</span><span class="p">[</span><span class="s">"revision"</span><span class="p">]</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">""</span>
|
||
|
|
||
|
<span class="k">print</span> <span class="s">" "</span> <span class="o">*</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">"timestamp"</span><span class="p">]</span> <span class="o">+</span> <span class="s">" "</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">"commit"</span><span class="p">]</span> <span class="o">+</span> <span class="n">revision</span><span class="p">()</span>
|
||
|
<span class="k">print</span> <span class="s">" "</span> <span class="o">*</span> <span class="n">indent</span> <span class="o">+</span> <span class="n">change</span><span class="p">[</span><span class="s">"message"</span><span class="p">]</span> <span class="o">+</span> <span class="s">"</span><span class="se">\n</span><span class="s">"</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_diff"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_diff">[docs]</a><span class="k">def</span> <span class="nf">blueprints_diff</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Display the differences between 2 versions of a blueprint</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints diff <blueprint-name> Display the differences between 2 versions of a blueprint.</span>
|
||
|
<span class="sd"> <from-commit> Commit hash or NEWEST</span>
|
||
|
<span class="sd"> <to-commit> Commit hash, NEWEST, or WORKSPACE</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"blueprints diff is missing the blueprint name, from commit, and to commit"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"blueprints diff is missing the from commit, and the to commit"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"blueprints diff is missing the to commit"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/diff/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">2</span><span class="p">]))</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errors"</span><span class="p">,</span> <span class="p">[]):</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errors"</span><span class="p">,</span> <span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">diff</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">"diff"</span><span class="p">]:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">prettyDiffEntry</span><span class="p">(</span><span class="n">diff</span><span class="p">))</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="prettyDiffEntry"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.prettyDiffEntry">[docs]</a><span class="k">def</span> <span class="nf">prettyDiffEntry</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
|
||
|
<span class="sd">"""Generate nice diff entry string.</span>
|
||
|
|
||
|
<span class="sd"> :param diff: Difference entry dict</span>
|
||
|
<span class="sd"> :type diff: dict</span>
|
||
|
<span class="sd"> :returns: Nice string</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">def</span> <span class="nf">change</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]</span> <span class="ow">and</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"Changed"</span>
|
||
|
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"Added"</span>
|
||
|
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"Removed"</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">"Unknown"</span>
|
||
|
|
||
|
<span class="k">def</span> <span class="nf">name</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
|
||
|
<span class="k">elif</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]</span><span class="o">.</span><span class="n">keys</span><span class="p">()[</span><span class="mi">0</span><span class="p">]</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">"Unknown"</span>
|
||
|
|
||
|
<span class="k">def</span> <span class="nf">details</span><span class="p">(</span><span class="n">diff</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Changed"</span><span class="p">:</span>
|
||
|
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Description"</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">'"</span><span class="si">%s</span><span class="s">" -> "</span><span class="si">%s</span><span class="s">"'</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)],</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)])</span>
|
||
|
<span class="k">elif</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Version"</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">"</span><span class="si">%s</span><span class="s"> -> </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)],</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)])</span>
|
||
|
<span class="k">elif</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">"Module"</span><span class="p">,</span> <span class="s">"Package"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s"> -> </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"name"</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"version"</span><span class="p">],</span>
|
||
|
<span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"version"</span><span class="p">])</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">"Unknown"</span>
|
||
|
<span class="k">elif</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Added"</span><span class="p">:</span>
|
||
|
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">"Module"</span><span class="p">,</span> <span class="s">"Package"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"name"</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"version"</span><span class="p">])</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">" "</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">][</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">diff</span><span class="p">[</span><span class="s">"new"</span><span class="p">]])</span>
|
||
|
<span class="k">elif</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">==</span> <span class="s">"Removed"</span><span class="p">:</span>
|
||
|
<span class="k">if</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="ow">in</span> <span class="p">[</span><span class="s">"Module"</span><span class="p">,</span> <span class="s">"Package"</span><span class="p">]:</span>
|
||
|
<span class="k">return</span> <span class="s">"</span><span class="si">%s</span><span class="s"> </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"name"</span><span class="p">],</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)][</span><span class="s">"version"</span><span class="p">])</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="s">" "</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">][</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">diff</span><span class="p">[</span><span class="s">"old"</span><span class="p">]])</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">change</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">+</span> <span class="s">" "</span> <span class="o">+</span> <span class="n">name</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span> <span class="o">+</span> <span class="s">" "</span> <span class="o">+</span> <span class="n">details</span><span class="p">(</span><span class="n">diff</span><span class="p">)</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_save"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_save">[docs]</a><span class="k">def</span> <span class="nf">blueprints_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Save the blueprint to a TOML file</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints save <blueprint,...> Save the blueprint to a file, <blueprint-name>.toml</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/info/</span><span class="si">%s</span><span class="s">?format=toml"</span> <span class="o">%</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="n">blueprint_toml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
<span class="nb">open</span><span class="p">(</span><span class="n">toml_filename</span><span class="p">(</span><span class="n">blueprint</span><span class="p">),</span> <span class="s">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">blueprint_toml</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_delete"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_delete">[docs]</a><span class="k">def</span> <span class="nf">blueprints_delete</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Delete a blueprint from the server</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> delete <blueprint> Delete a blueprint from the server</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/delete/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">delete_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_depsolve"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_depsolve">[docs]</a><span class="k">def</span> <span class="nf">blueprints_depsolve</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Display the packages needed to install the blueprint</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints depsolve <blueprint,...> Display the packages needed to install the blueprint.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/depsolve/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="s">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">"blueprints"</span><span class="p">]:</span>
|
||
|
<span class="k">if</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"blueprint"</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"version"</span><span class="p">,</span> <span class="s">""</span><span class="p">):</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">"blueprint: </span><span class="si">%s</span><span class="s"> v</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s">"blueprint"</span><span class="p">][</span><span class="s">"name"</span><span class="p">],</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"blueprint"</span><span class="p">][</span><span class="s">"version"</span><span class="p">]))</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">"blueprint: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s">"blueprint"</span><span class="p">][</span><span class="s">"name"</span><span class="p">]))</span>
|
||
|
<span class="k">for</span> <span class="n">dep</span> <span class="ow">in</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"dependencies"</span><span class="p">]:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">" "</span> <span class="o">+</span> <span class="n">packageNEVRA</span><span class="p">(</span><span class="n">dep</span><span class="p">))</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_push"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_push">[docs]</a><span class="k">def</span> <span class="nf">blueprints_push</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Push a blueprint TOML file to the server, updating the blueprint</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> push <blueprint> Push a blueprint TOML file to the server.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/new"</span><span class="p">)</span>
|
||
|
<span class="n">rval</span> <span class="o">=</span> <span class="mi">0</span>
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">blueprint</span><span class="p">):</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"Missing blueprint file: </span><span class="si">%s</span><span class="s">"</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="k">continue</span>
|
||
|
<span class="n">blueprint_toml</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">blueprint</span><span class="p">,</span> <span class="s">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
|
||
|
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url_toml</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="n">blueprint_toml</span><span class="p">)</span>
|
||
|
<span class="k">if</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">):</span>
|
||
|
<span class="n">rval</span> <span class="o">=</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">rval</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_freeze"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_freeze">[docs]</a><span class="k">def</span> <span class="nf">blueprints_freeze</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Handle the blueprints freeze commands</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints freeze <blueprint,...> Display the frozen blueprint's modules and packages.</span>
|
||
|
<span class="sd"> blueprints freeze show <blueprint,...> Display the frozen blueprint in TOML format.</span>
|
||
|
<span class="sd"> blueprints freeze save <blueprint,...> Save the frozen blueprint to a file, <blueprint-name>.frozen.toml.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">if</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">"show"</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="n">blueprints_freeze_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">show_json</span><span class="p">)</span>
|
||
|
<span class="k">elif</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s">"save"</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="n">blueprints_freeze_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">:],</span> <span class="n">show_json</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"freeze is missing the blueprint name"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/freeze/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="s">","</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">))))</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_json</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">result</span><span class="p">[</span><span class="s">"blueprints"</span><span class="p">]:</span>
|
||
|
<span class="n">blueprint</span> <span class="o">=</span> <span class="n">entry</span><span class="p">[</span><span class="s">"blueprint"</span><span class="p">]</span>
|
||
|
<span class="k">if</span> <span class="n">blueprint</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"version"</span><span class="p">,</span> <span class="s">""</span><span class="p">):</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">"blueprint: </span><span class="si">%s</span><span class="s"> v</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s">"name"</span><span class="p">],</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"version"</span><span class="p">]))</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">"blueprint: </span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">blueprint</span><span class="p">[</span><span class="s">"name"</span><span class="p">]))</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"modules"</span><span class="p">]:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">" </span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">m</span><span class="p">[</span><span class="s">"name"</span><span class="p">],</span> <span class="n">m</span><span class="p">[</span><span class="s">"version"</span><span class="p">]))</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">blueprint</span><span class="p">[</span><span class="s">"packages"</span><span class="p">]:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="s">" </span><span class="si">%s</span><span class="s">-</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">p</span><span class="p">[</span><span class="s">"name"</span><span class="p">],</span> <span class="n">p</span><span class="p">[</span><span class="s">"version"</span><span class="p">]))</span>
|
||
|
|
||
|
<span class="c"># Print any errors</span>
|
||
|
<span class="k">for</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errors"</span><span class="p">,</span> <span class="p">[]):</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
|
||
|
|
||
|
<span class="c"># Return a 1 if there are any errors</span>
|
||
|
<span class="k">if</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errors"</span><span class="p">,</span> <span class="p">[]):</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
<span class="k">else</span><span class="p">:</span>
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_freeze_show"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_freeze_show">[docs]</a><span class="k">def</span> <span class="nf">blueprints_freeze_show</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Show the frozen blueprint in TOML format</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints freeze show <blueprint,...> Display the frozen blueprint in TOML format.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"freeze show is missing the blueprint name"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/freeze/</span><span class="si">%s</span><span class="s">?format=toml"</span> <span class="o">%</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">))</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_freeze_save"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_freeze_save">[docs]</a><span class="k">def</span> <span class="nf">blueprints_freeze_save</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Save the frozen blueprint to a TOML file</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints freeze save <blueprint,...> Save the frozen blueprint to a file, <blueprint-name>.frozen.toml.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"freeze save is missing the blueprint name"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/freeze/</span><span class="si">%s</span><span class="s">?format=toml"</span> <span class="o">%</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="n">blueprint_toml</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">get_url_raw</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">)</span>
|
||
|
<span class="nb">open</span><span class="p">(</span><span class="n">frozen_toml_filename</span><span class="p">(</span><span class="n">blueprint</span><span class="p">),</span> <span class="s">"w"</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">blueprint_toml</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="mi">0</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_tag"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_tag">[docs]</a><span class="k">def</span> <span class="nf">blueprints_tag</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Tag the most recent blueprint commit as a release</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints tag <blueprint> Tag the most recent blueprint commit as a release.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/tag/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="s">""</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_undo"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_undo">[docs]</a><span class="k">def</span> <span class="nf">blueprints_undo</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Undo changes to a blueprint</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints undo <blueprint> <commit> Undo changes to a blueprint by reverting to the selected commit.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"undo is missing the blueprint name and commit hash"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
<span class="k">elif</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">)</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"undo is missing commit hash"</span><span class="p">)</span>
|
||
|
<span class="k">return</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/undo/</span><span class="si">%s</span><span class="s">/</span><span class="si">%s</span><span class="s">"</span> <span class="o">%</span> <span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">args</span><span class="p">[</span><span class="mi">1</span><span class="p">]))</span>
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="s">""</span><span class="p">)</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">handle_api_result</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">show_json</span><span class="p">)</span>
|
||
|
</div>
|
||
|
<div class="viewcode-block" id="blueprints_workspace"><a class="viewcode-back" href="../../../composer.cli.html#composer.cli.blueprints.blueprints_workspace">[docs]</a><span class="k">def</span> <span class="nf">blueprints_workspace</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_version</span><span class="p">,</span> <span class="n">args</span><span class="p">,</span> <span class="n">show_json</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="sd">"""Push the blueprint TOML to the temporary workspace storage</span>
|
||
|
|
||
|
<span class="sd"> :param socket_path: Path to the Unix socket to use for API communication</span>
|
||
|
<span class="sd"> :type socket_path: str</span>
|
||
|
<span class="sd"> :param api_version: Version of the API to talk to. eg. "0"</span>
|
||
|
<span class="sd"> :type api_version: str</span>
|
||
|
<span class="sd"> :param args: List of remaining arguments from the cmdline</span>
|
||
|
<span class="sd"> :type args: list of str</span>
|
||
|
<span class="sd"> :param show_json: Set to True to show the JSON output instead of the human readable output</span>
|
||
|
<span class="sd"> :type show_json: bool</span>
|
||
|
|
||
|
<span class="sd"> blueprints workspace <blueprint> Push the blueprint TOML to the temporary workspace storage.</span>
|
||
|
<span class="sd"> """</span>
|
||
|
<span class="n">api_route</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">api_url</span><span class="p">(</span><span class="n">api_version</span><span class="p">,</span> <span class="s">"/blueprints/workspace"</span><span class="p">)</span>
|
||
|
<span class="n">rval</span> <span class="o">=</span> <span class="mi">0</span>
|
||
|
<span class="k">for</span> <span class="n">blueprint</span> <span class="ow">in</span> <span class="n">argify</span><span class="p">(</span><span class="n">args</span><span class="p">):</span>
|
||
|
<span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">exists</span><span class="p">(</span><span class="n">blueprint</span><span class="p">):</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">"Missing blueprint file: </span><span class="si">%s</span><span class="s">"</span><span class="p">,</span> <span class="n">blueprint</span><span class="p">)</span>
|
||
|
<span class="k">continue</span>
|
||
|
<span class="n">blueprint_toml</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">blueprint</span><span class="p">,</span> <span class="s">"r"</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
|
||
|
|
||
|
<span class="n">result</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">post_url_toml</span><span class="p">(</span><span class="n">socket_path</span><span class="p">,</span> <span class="n">api_route</span><span class="p">,</span> <span class="n">blueprint_toml</span><span class="p">)</span>
|
||
|
<span class="k">if</span> <span class="n">show_json</span><span class="p">:</span>
|
||
|
<span class="k">print</span><span class="p">(</span><span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">result</span><span class="p">,</span> <span class="n">indent</span><span class="o">=</span><span class="mi">4</span><span class="p">))</span>
|
||
|
|
||
|
<span class="k">for</span> <span class="n">err</span> <span class="ow">in</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"errors"</span><span class="p">,</span> <span class="p">[]):</span>
|
||
|
<span class="n">log</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="n">err</span><span class="p">)</span>
|
||
|
|
||
|
<span class="c"># Any errors results in returning a 1, but we continue with the rest first</span>
|
||
|
<span class="k">if</span> <span class="ow">not</span> <span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">"status"</span><span class="p">,</span> <span class="bp">False</span><span class="p">):</span>
|
||
|
<span class="n">rval</span> <span class="o">=</span> <span class="mi">1</span>
|
||
|
|
||
|
<span class="k">return</span> <span class="n">rval</span></div>
|
||
|
</pre></div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="sphinxsidebar">
|
||
|
<div class="sphinxsidebarwrapper">
|
||
|
<div id="searchbox" style="display: none">
|
||
|
<h3>Quick search</h3>
|
||
|
<form class="search" action="../../../search.html" method="get">
|
||
|
<input type="text" name="q" />
|
||
|
<input type="submit" value="Go" />
|
||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||
|
<input type="hidden" name="area" value="default" />
|
||
|
</form>
|
||
|
<p class="searchtip" style="font-size: 90%">
|
||
|
Enter search terms or a module, class or function name.
|
||
|
</p>
|
||
|
</div>
|
||
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearer"></div>
|
||
|
</div>
|
||
|
<div class="related">
|
||
|
<h3>Navigation</h3>
|
||
|
<ul>
|
||
|
<li class="right" style="margin-right: 10px">
|
||
|
<a href="../../../genindex.html" title="General Index"
|
||
|
>index</a></li>
|
||
|
<li class="right" >
|
||
|
<a href="../../../py-modindex.html" title="Python Module Index"
|
||
|
>modules</a> |</li>
|
||
|
<li><a href="../../../index.html">Lorax 19.7.14 documentation</a> »</li>
|
||
|
<li><a href="../../index.html" >Module code</a> »</li>
|
||
|
<li><a href="../cli.html" >composer.cli</a> »</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="footer">
|
||
|
© Copyright 2018, Red Hat, Inc..
|
||
|
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|