Skip to content

Commit

Permalink
Skeleton for binary (requirements, setup, basic bin
Browse files Browse the repository at this point in the history
  • Loading branch information
typotter committed Oct 29, 2017
1 parent 82f073a commit 18b867f
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
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.
55 changes: 55 additions & 0 deletions bin/photopi
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)
3 changes: 3 additions & 0 deletions photopi/__init__.py
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__])
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docopt
28 changes: 28 additions & 0 deletions setup.py
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",
)

0 comments on commit 18b867f

Please sign in to comment.