-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skeleton for binary (requirements, setup, basic bin
- Loading branch information
Showing
5 changed files
with
118 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
# photopi | ||
photopi CLI | ||
================ | ||
|
||
Software for helping with photopiy operations from the command line. | ||
|
||
Installation | ||
------------ | ||
|
||
Clone this repo and run: | ||
|
||
.. code-block:: sh | ||
|
||
pip install -r requirements.txt | ||
python setup.py install | ||
|
||
Running the Commands | ||
-------------------- | ||
|
||
After installation the `photopi` command should be available in your | ||
shell: | ||
|
||
.. code-block:: sh | ||
|
||
photopi bark | ||
|
||
|
||
Virtualenv Support | ||
------------------ | ||
|
||
This library is virtualenv compatible, simply activate your | ||
virtualenv prior to running the installation commands above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env python | ||
""" | ||
Usage: photopi bark [options] [-v ...] | ||
photopi tl load --device=<device> [--label=<label>, --base=<base_dir>, --remote=<remote_dir>] | ||
photopi tl make --name=<name> --device=<device> [--label=<label>, --base=<base_dir>, --remote=<remote_dir>] | ||
photopi tl store --device=<device> [--label=<label>, --base=<base_dir>, --remote=<remote_dir>] | ||
photopi tl clean --device=<device> [--label=<label>, --base=<base_dir>] | ||
photopi tl fixtar --device=<device> --rebase=<rebase> --part=<part> [--label=<label>, --base=<base_dir>] | ||
photopi tl fixtars --device=<device> [--label=<label>, --base=<base_dir>, --remote=<remote_dir>] | ||
photopi timelapse --device=<device> --name=<name> [--label=<label>, --base=<base_dir>, --remote=<remote_dir>] | ||
photopi test --file=<file> | ||
Options: | ||
--config=file Specify a path to configuration instead of defaults | ||
-v Include verbose logging. Multiple v's adds verbosity | ||
-h, --help Print help | ||
""" | ||
from docopt import docopt | ||
import sys, time, logging | ||
|
||
def setup_logging(root_verbose=False, photopi_verbose=False): | ||
logging.captureWarnings(True) | ||
logging.getLogger().setLevel(logging.WARN) | ||
if root_verbose: | ||
logging.getLogger().setLevel(logging.DEBUG) | ||
logging.getLogger('photopi').setLevel(logging.INFO) | ||
if photopi_verbose: | ||
logging.getLogger('photopi').setLevel(logging.DEBUG) | ||
|
||
def do_bark(args): | ||
print("Bark") | ||
from subprocess import call | ||
call(["echo \"bark\""], shell=True) | ||
|
||
def main(): | ||
args = docopt(__doc__) | ||
if args['-v']: | ||
if args['-v'] > 1: | ||
setup_logging(True, True) | ||
else: | ||
setup_logging(False, True) | ||
else: | ||
setup_logging() | ||
|
||
if args['bark']: | ||
return do_bark(args) | ||
return False | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig() | ||
if main(): | ||
sys.exit(0) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
__numeric_version__ = (0, 0, 9) | ||
__version__ = '.'.join([str(x) for x in __numeric_version__]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docopt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from setuptools import setup, find_packages | ||
# pylint: disable=no-name-in-module,F0401,W0232,C0111,R0201 | ||
import photopi | ||
|
||
def readme(): | ||
"Returns the contents of the README.md file" | ||
with open("README.md") as f: | ||
return f.read() | ||
|
||
setup( | ||
name='photopi', | ||
version=photopi.__version__, | ||
description='Command line client for photopi', | ||
long_description=readme(), | ||
author='Tyler Potter', | ||
author_email='[email protected]', | ||
url='http://github.com/typotter/photopi', | ||
packages=find_packages(), | ||
install_requires=[ | ||
'setuptools', | ||
'docopt', | ||
'PyYAML' | ||
], | ||
scripts=[ | ||
'bin/photopi' | ||
], | ||
test_suite="nose.collector", | ||
) |