add: simple setup functions

This commit is contained in:
adobdin 2016-04-08 12:33:39 +00:00
parent fd11d84149
commit 11f596ac87
9 changed files with 31 additions and 7 deletions

7
setup.cfg Normal file
View File

@ -0,0 +1,7 @@
[build_sphinx]
source-dir = doc/
build-dir = doc/_build
all_files = 1
[upload_sphinx]
upload-dir = doc/_build/html

16
setup.py Normal file
View File

@ -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']
}
)

View File

@ -16,12 +16,13 @@
# under the License. # under the License.
import argparse import argparse
import nodes import timmy
from timmy import nodes
import logging import logging
import sys import sys
import os import os
from conf import Conf from timmy.conf import Conf
import flock from timmy import flock
def main(argv=None): def main(argv=None):

View File

@ -37,16 +37,16 @@ class Conf(object):
with open(filename, 'r') as f: with open(filename, 'r') as f:
conf = yaml.load(f) conf = yaml.load(f)
except IOError as e: 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) sys.exit(1)
except ValueError: except ValueError:
logging.error("Could not convert data") logging.error("load_conf: Could not convert data")
sys.exit(1) sys.exit(1)
except yaml.parser.ParserError as e: 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) sys.exit(1)
except: except:
logging.error("Unexpected error: %s" % sys.exc_info()[0]) logging.error("load_conf: Unexpected error: %s" % sys.exc_info()[0])
sys.exit(1) sys.exit(1)
logging.info(conf) logging.info(conf)
return Conf(**conf) return Conf(**conf)