From 11f596ac87a7c99ed04d2f56d81e0e258b6c18ec Mon Sep 17 00:00:00 2001 From: adobdin Date: Fri, 8 Apr 2016 12:33:39 +0000 Subject: [PATCH] add: simple setup functions --- setup.cfg | 7 +++++++ setup.py | 16 ++++++++++++++++ __init__.py => timmy/__init__.py | 0 timmy.py => timmy/cli.py | 7 ++++--- conf.py => timmy/conf.py | 8 ++++---- flock.py => timmy/flock.py | 0 nodefilter.py => timmy/nodefilter.py | 0 nodes.py => timmy/nodes.py | 0 tools.py => timmy/tools.py | 0 9 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 setup.cfg create mode 100644 setup.py rename __init__.py => timmy/__init__.py (100%) rename timmy.py => timmy/cli.py (97%) rename conf.py => timmy/conf.py (83%) rename flock.py => timmy/flock.py (100%) rename nodefilter.py => timmy/nodefilter.py (100%) rename nodes.py => timmy/nodes.py (100%) rename tools.py => timmy/tools.py (100%) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..118c83e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[build_sphinx] +source-dir = doc/ +build-dir = doc/_build +all_files = 1 + +[upload_sphinx] +upload-dir = doc/_build/html diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..5baccfc --- /dev/null +++ b/setup.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +from setuptools import setup + +setup(name='timmy', + version='0.1', + author = "Aleksandr Dobdin", + author_email = 'dobdin@gmail.com', + license = 'Apache2', + url = 'https://github.com/adobdin/timmy', + # long_description=read('README'), + packages = ["timmy"], + entry_points = { + 'console_scripts': ['timmy = timmy.cli:main'] + } + ) diff --git a/__init__.py b/timmy/__init__.py similarity index 100% rename from __init__.py rename to timmy/__init__.py diff --git a/timmy.py b/timmy/cli.py similarity index 97% rename from timmy.py rename to timmy/cli.py index 169ba49..1676e78 100755 --- a/timmy.py +++ b/timmy/cli.py @@ -16,12 +16,13 @@ # under the License. import argparse -import nodes +import timmy +from timmy import nodes import logging import sys import os -from conf import Conf -import flock +from timmy.conf import Conf +from timmy import flock def main(argv=None): diff --git a/conf.py b/timmy/conf.py similarity index 83% rename from conf.py rename to timmy/conf.py index e936e7f..2147967 100644 --- a/conf.py +++ b/timmy/conf.py @@ -37,16 +37,16 @@ class Conf(object): with open(filename, 'r') as f: conf = yaml.load(f) except IOError as e: - logging.error("I/O error(%s): %s" % (e.errno, e.strerror)) + logging.error("load_conf: I/O error(%s): %s" % (e.errno, e.strerror)) sys.exit(1) except ValueError: - logging.error("Could not convert data") + logging.error("load_conf: Could not convert data") sys.exit(1) except yaml.parser.ParserError as e: - logging.error("Could not parse %s:\n%s" % (filename, str(e))) + logging.error("load_conf: Could not parse %s:\n%s" % (filename, str(e))) sys.exit(1) except: - logging.error("Unexpected error: %s" % sys.exc_info()[0]) + logging.error("load_conf: Unexpected error: %s" % sys.exc_info()[0]) sys.exit(1) logging.info(conf) return Conf(**conf) diff --git a/flock.py b/timmy/flock.py similarity index 100% rename from flock.py rename to timmy/flock.py diff --git a/nodefilter.py b/timmy/nodefilter.py similarity index 100% rename from nodefilter.py rename to timmy/nodefilter.py diff --git a/nodes.py b/timmy/nodes.py similarity index 100% rename from nodes.py rename to timmy/nodes.py diff --git a/tools.py b/timmy/tools.py similarity index 100% rename from tools.py rename to timmy/tools.py