Added install/uninstall commands, #531

This commit is contained in:
Rhet Turnbull
2021-12-24 17:05:01 -08:00
parent 1cb8da96ce
commit 085f482820
15 changed files with 362 additions and 219 deletions

View File

@@ -145,14 +145,16 @@ Commands:
export Export photos from the Photos database.
help Print help; for help on commands: help <command>.
info Print out descriptive info of the Photos library database.
install Install Python packages into the same environment as osxphotos
keywords Print out keywords found in the Photos library.
labels Print out image classification labels found in the Photos...
list Print list of Photos libraries found on the system.
persons Print out persons (faces) found in the Photos library.
places Print out places found in the Photos library.
query Query the Photos database using 1 or more search options; if...
repl Run interactive osxphotos shell
repl Run interactive osxphotos REPL shell (useful for debugging,...
tutorial Display osxphotos tutorial.
uninstall Uninstall Python packages from the osxphotos environment
```
To get help on a specific command, use `osxphotos help <command_name>`
@@ -1703,7 +1705,7 @@ Substitution Description
{lf} A line feed: '\n', alias for {newline}
{cr} A carriage return: '\r'
{crlf} a carriage return + line feed: '\r\n'
{osxphotos_version} The osxphotos version, e.g. '0.43.7'
{osxphotos_version} The osxphotos version, e.g. '0.43.8'
{osxphotos_cmd_line} The full command line used to run osxphotos
The following substitutions may result in multiple values. Thus if specified for
@@ -3573,7 +3575,7 @@ The following template field substitutions are availabe for use the templating s
|{lf}|A line feed: '\n', alias for {newline}|
|{cr}|A carriage return: '\r'|
|{crlf}|a carriage return + line feed: '\r\n'|
|{osxphotos_version}|The osxphotos version, e.g. '0.43.7'|
|{osxphotos_version}|The osxphotos version, e.g. '0.43.8'|
|{osxphotos_cmd_line}|The full command line used to run osxphotos|
|{album}|Album(s) photo is contained in|
|{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder|

View File

@@ -71,7 +71,7 @@
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
@@ -93,7 +93,7 @@
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

View File

@@ -731,8 +731,9 @@ dl.glossary dt {
.classifier:before {
font-style: normal;
margin: 0.5em;
margin: 0 0.5em;
content: ":";
display: inline-block;
}
abbr, acronym {
@@ -819,7 +820,7 @@ div.code-block-caption code {
table.highlighttable td.linenos,
span.linenos,
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
-webkit-user-select: text; /* Safari fallback only */
-webkit-user-select: none; /* Chrome/Safari */

View File

@@ -301,12 +301,14 @@ var Documentation = {
window.location.href = prevHref;
return false;
}
break;
case 39: // right
var nextHref = $('link[rel="next"]').prop('href');
if (nextHref) {
window.location.href = nextHref;
return false;
}
break;
}
}
});

View File

@@ -282,7 +282,10 @@ var Search = {
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '' && data !== undefined) {
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
var summary = Search.makeSearchSummary(data, searchterms, hlterms);
if (summary) {
listItem.append(summary);
}
}
Search.output.append(listItem);
setTimeout(function() {
@@ -325,7 +328,9 @@ var Search = {
var results = [];
for (var prefix in objects) {
for (var name in objects[prefix]) {
for (var iMatch = 0; iMatch != objects[prefix].length; ++iMatch) {
var match = objects[prefix][iMatch];
var name = match[4];
var fullname = (prefix ? prefix + '.' : '') + name;
var fullnameLower = fullname.toLowerCase()
if (fullnameLower.indexOf(object) > -1) {
@@ -339,7 +344,6 @@ var Search = {
} else if (parts[parts.length - 1].indexOf(object) > -1) {
score += Scorer.objPartialMatch;
}
var match = objects[prefix][name];
var objname = objnames[match[1]][2];
var title = titles[match[0]];
// If more than one term searched for, we require other words to be
@@ -498,6 +502,9 @@ var Search = {
*/
makeSearchSummary : function(htmlText, keywords, hlwords) {
var text = Search.htmlToText(htmlText);
if (text == "") {
return null;
}
var textLower = text.toLowerCase();
var start = 0;
$.each(keywords, function() {

View File

@@ -963,6 +963,27 @@ to modify this behavior.</p>
<dd><p>Optional argument(s)</p>
</dd></dl>
</div>
<div class="section" id="osxphotos-install">
<h3>install<a class="headerlink" href="#osxphotos-install" title="Permalink to this headline"></a></h3>
<p>Install Python packages into the same environment as osxphotos</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>osxphotos install <span class="o">[</span>OPTIONS<span class="o">]</span> PACKAGES...
</pre></div>
</div>
<p class="rubric">Options</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-osxphotos-install-U">
<span id="cmdoption-osxphotos-install-u"></span><span id="cmdoption-osxphotos-install-upgrade"></span><span class="sig-name descname"><span class="pre">-U</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--upgrade</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-osxphotos-install-U" title="Permalink to this definition"></a></dt>
<dd><p>Upgrade packages to latest version</p>
</dd></dl>
<p class="rubric">Arguments</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-osxphotos-install-arg-PACKAGES">
<span id="cmdoption-osxphotos-install-arg-packages"></span><span class="sig-name descname"><span class="pre">PACKAGES</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-osxphotos-install-arg-PACKAGES" title="Permalink to this definition"></a></dt>
<dd><p>Required argument(s)</p>
</dd></dl>
</div>
<div class="section" id="osxphotos-keywords">
<h3>keywords<a class="headerlink" href="#osxphotos-keywords" title="Permalink to this headline"></a></h3>
@@ -1592,6 +1613,27 @@ if more than one option is provided, they are treated as “AND”
<dd><p>Optional argument(s)</p>
</dd></dl>
</div>
<div class="section" id="osxphotos-uninstall">
<h3>uninstall<a class="headerlink" href="#osxphotos-uninstall" title="Permalink to this headline"></a></h3>
<p>Uninstall Python packages from the osxphotos environment</p>
<div class="highlight-shell notranslate"><div class="highlight"><pre><span></span>osxphotos uninstall <span class="o">[</span>OPTIONS<span class="o">]</span> PACKAGES...
</pre></div>
</div>
<p class="rubric">Options</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-osxphotos-uninstall-y">
<span id="cmdoption-osxphotos-uninstall-yes"></span><span class="sig-name descname"><span class="pre">-y</span></span><span class="sig-prename descclassname"></span><span class="sig-prename descclassname"><span class="pre">,</span> </span><span class="sig-name descname"><span class="pre">--yes</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-osxphotos-uninstall-y" title="Permalink to this definition"></a></dt>
<dd><p>Dont ask for confirmation</p>
</dd></dl>
<p class="rubric">Arguments</p>
<dl class="std option">
<dt class="sig sig-object std" id="cmdoption-osxphotos-uninstall-arg-PACKAGES">
<span id="cmdoption-osxphotos-uninstall-arg-packages"></span><span class="sig-name descname"><span class="pre">PACKAGES</span></span><span class="sig-prename descclassname"></span><a class="headerlink" href="#cmdoption-osxphotos-uninstall-arg-PACKAGES" title="Permalink to this definition"></a></dt>
<dd><p>Required argument(s)</p>
</dd></dl>
</div>
</div>
</div>
@@ -1622,6 +1664,7 @@ if more than one option is provided, they are treated as “AND”
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-export">export</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-help">help</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-info">info</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-install">install</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-keywords">keywords</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-labels">labels</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-list">list</a></li>
@@ -1630,6 +1673,7 @@ if more than one option is provided, they are treated as “AND”
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-query">query</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-repl">repl</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-tutorial">tutorial</a></li>
<li class="toctree-l3"><a class="reference internal" href="#osxphotos-uninstall">uninstall</a></li>
</ul>
</li>
</ul>
@@ -1650,7 +1694,7 @@ if more than one option is provided, they are treated as “AND”
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
@@ -1672,7 +1716,7 @@ if more than one option is provided, they are treated as “AND”
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@@ -630,8 +630,6 @@
<li><a href="cli.html#cmdoption-osxphotos-query-no-likes">osxphotos-query command line option</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
--no-location
@@ -641,6 +639,8 @@
<li><a href="cli.html#cmdoption-osxphotos-query-no-location">osxphotos-query command line option</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
--no-place
@@ -1118,6 +1118,13 @@
<ul>
<li><a href="cli.html#cmdoption-osxphotos-export-update">osxphotos-export command line option</a>
</li>
</ul></li>
<li>
--upgrade
<ul>
<li><a href="cli.html#cmdoption-osxphotos-install-U">osxphotos-install command line option</a>
</li>
</ul></li>
<li>
@@ -1180,6 +1187,13 @@
<ul>
<li><a href="cli.html#cmdoption-osxphotos-export-xattr-template">osxphotos-export command line option</a>
</li>
</ul></li>
<li>
--yes
<ul>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-y">osxphotos-uninstall command line option</a>
</li>
</ul></li>
<li>
@@ -1189,6 +1203,13 @@
<li><a href="cli.html#cmdoption-osxphotos-export-i">osxphotos-export command line option</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-query-i">osxphotos-query command line option</a>
</li>
</ul></li>
<li>
-U
<ul>
<li><a href="cli.html#cmdoption-osxphotos-install-U">osxphotos-install command line option</a>
</li>
</ul></li>
<li>
@@ -1203,6 +1224,13 @@
<ul>
<li><a href="cli.html#cmdoption-osxphotos-v">osxphotos command line option</a>
</li>
</ul></li>
<li>
-y
<ul>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-y">osxphotos-uninstall command line option</a>
</li>
</ul></li>
</ul></td>
@@ -1894,6 +1922,17 @@
<li><a href="cli.html#cmdoption-osxphotos-info-json">--json</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-info-arg-PHOTOS_LIBRARY">PHOTOS_LIBRARY</a>
</li>
</ul></li>
<li>
osxphotos-install command line option
<ul>
<li><a href="cli.html#cmdoption-osxphotos-install-U">--upgrade</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-install-U">-U</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-install-arg-PACKAGES">PACKAGES</a>
</li>
</ul></li>
<li>
@@ -2122,6 +2161,17 @@
<ul>
<li><a href="cli.html#cmdoption-osxphotos-tutorial-arg-WIDTH">WIDTH</a>
</li>
</ul></li>
<li>
osxphotos-uninstall command line option
<ul>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-y">--yes</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-y">-y</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-arg-PACKAGES">PACKAGES</a>
</li>
</ul></li>
<li><a href="reference.html#osxphotos.PhotoInfo.ScoreInfo.overall">overall (osxphotos.PhotoInfo.ScoreInfo attribute)</a>
@@ -2134,6 +2184,15 @@
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
PACKAGES
<ul>
<li><a href="cli.html#cmdoption-osxphotos-install-arg-PACKAGES">osxphotos-install command line option</a>
</li>
<li><a href="cli.html#cmdoption-osxphotos-uninstall-arg-PACKAGES">osxphotos-uninstall command line option</a>
</li>
</ul></li>
<li><a href="reference.html#osxphotos.PhotoInfo.panorama">panorama (osxphotos.PhotoInfo property)</a>
</li>
<li><a href="reference.html#osxphotos.PhotoInfo.path">path (osxphotos.PhotoInfo property)</a>
@@ -2176,6 +2235,8 @@
</li>
<li><a href="reference.html#osxphotos.PhotosDB.photos_by_uuid">photos_by_uuid() (osxphotos.PhotosDB method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li>
PHOTOS_LIBRARY
@@ -2199,8 +2260,6 @@
<li><a href="cli.html#cmdoption-osxphotos-query-arg-PHOTOS_LIBRARY">osxphotos-query command line option</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="reference.html#osxphotos.PhotosDB">PhotosDB (class in osxphotos)</a>
</li>
<li><a href="reference.html#osxphotos.PhotoInfo.place">place (osxphotos.PhotoInfo property)</a>
@@ -2410,7 +2469,7 @@
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
@@ -2432,7 +2491,7 @@
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

View File

@@ -288,6 +288,7 @@ Alternatively, you can also run the command line utility like this: <code class=
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-export">export</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-help">help</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-info">info</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-install">install</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-keywords">keywords</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-labels">labels</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-list">list</a></li>
@@ -296,6 +297,7 @@ Alternatively, you can also run the command line utility like this: <code class=
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-query">query</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-repl">repl</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-tutorial">tutorial</a></li>
<li class="toctree-l3"><a class="reference internal" href="cli.html#osxphotos-uninstall">uninstall</a></li>
</ul>
</li>
</ul>
@@ -351,7 +353,7 @@ Alternatively, you can also run the command line utility like this: <code class=
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
@@ -373,7 +375,7 @@ Alternatively, you can also run the command line utility like this: <code class=
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

View File

@@ -69,7 +69,7 @@
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
@@ -91,7 +91,7 @@
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -38,13 +38,14 @@
<h1 id="search-documentation">Search</h1>
<div id="fallback" class="admonition warning">
<script>$('#fallback').hide();</script>
<noscript>
<div class="admonition warning">
<p>
Please activate JavaScript to enable the search
functionality.
</p>
</div>
</noscript>
<p>
@@ -54,7 +55,7 @@
<form action="" method="get">
<input type="text" name="q" aria-labelledby="search-documentation" value="" />
<input type="text" name="q" aria-labelledby="search-documentation" value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="search" />
<span id="search-progress" style="padding-left: 10px"></span>
</form>
@@ -110,7 +111,7 @@
&copy;2021, Rhet Turnbull.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.3.2</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
</div>

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.43.7"
__version__ = "0.43.8"

View File

@@ -20,6 +20,7 @@ import photoscript
import rich.traceback
import yaml
from rich import pretty
from runpy import run_module
import osxphotos
@@ -3602,6 +3603,30 @@ def run_post_command(
)
@cli.command()
@click.argument("packages", nargs=-1, required=True)
@click.option(
"-U", "--upgrade", is_flag=True, help="Upgrade packages to latest version"
)
def install(packages, upgrade):
"""Install Python packages into the same environment as osxphotos"""
args = ["pip", "install"]
if upgrade:
args += ["--upgrade"]
args += list(packages)
sys.argv = args
run_module("pip", run_name="__main__")
@cli.command()
@click.argument("packages", nargs=-1, required=True)
@click.option("-y", "--yes", is_flag=True, help="Don't ask for confirmation")
def uninstall(packages, yes):
"""Uninstall Python packages from the osxphotos environment"""
sys.argv = ["pip", "uninstall"] + list(packages) + (["-y"] if yes else [])
run_module("pip", run_name="__main__")
@cli.command(hidden=True)
@DB_OPTION
@DB_ARGUMENT