diff --git a/.gitignore b/.gitignore index 0d20b64..db5fcea 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.pyc +doc/build diff --git a/doc/source/conf.py b/doc/source/conf.py index 2e3cad3..0b63b77 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -31,6 +31,9 @@ import shlex # ones. extensions = [ 'sphinx.ext.viewcode', +# 'oslosphinx', + 'sphinx.ext.autodoc', + 'sphinxarg.ext', ] # Add any paths that contain templates here, relative to this directory. @@ -49,7 +52,7 @@ master_doc = 'index' # General information about the project. project = u'timmy' -copyright = u'2015, Mirantis' +#copyright = u'2015, Mirantis' author = u'Mirantis' # The version info for the project you're documenting, acts as replacement for @@ -87,7 +90,7 @@ exclude_patterns = [] # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. @@ -110,12 +113,13 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'alabaster' +html_theme = 'classic' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} +#html_theme_options = {'incubating': True} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] @@ -139,7 +143,7 @@ html_theme = 'alabaster' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -177,7 +181,7 @@ html_static_path = ['_static'] #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +html_show_copyright = False # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the diff --git a/doc/source/index.rst b/doc/source/index.rst index bf66522..c41372f 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -14,7 +14,8 @@ Contents: specification configuration usage - + cli + tools Indices and tables ================== diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 1cdd85a..245d305 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -6,6 +6,7 @@ The easiest way to launch timmy would be running the ``timmy.py`` script. However, you need to :doc:`configure ` it first. Basically, the ``timmy.py`` is a simple wrapper that launches ``cli.py``. +Full :doc:`reference ` for command line interface Basic parameters: diff --git a/setup.py b/setup.py index e1a8e71..cfaeece 100644 --- a/setup.py +++ b/setup.py @@ -3,19 +3,21 @@ from setuptools import setup import os -dtm = os.path.join(os.path.abspath(os.sep), 'usr', 'share', 'timmy') +pname = 'timmy' +dtm = os.path.join(os.path.abspath(os.sep), 'usr', 'share', pname) rqfiles = [(os.path.join(dtm, root), [os.path.join(root, f) for f in files]) for root, dirs, files in os.walk('rq')] rqfiles.append((os.path.join(dtm, 'configs'), ['config.yaml', 'rq.yaml'])) -setup(name='timmy', +setup(name=pname, version='1.2.0', author="Aleksandr Dobdin", author_email='dobdin@gmail.com', license='Apache2', url='https://github.com/adobdin/timmy', long_description=open('README.md').read(), - packages=["timmy"], + packages=[pname], data_files=rqfiles, include_package_data=True, - entry_points={'console_scripts': ['timmy=timmy.cli:main']}) + entry_points={'console_scripts': ['%s=%s.cli:main' %(pname, pname) ]}, + ) diff --git a/sphinx-build.sh b/sphinx-build.sh index 46073ad..9f532d6 100755 --- a/sphinx-build.sh +++ b/sphinx-build.sh @@ -17,5 +17,5 @@ # Builds a Sphinx documentation sphinx-build -b html doc/source/ doc/build/ -rm -f "./*.pyc" -rm -f "./timmy/*.pyc" +rm -f ./*.pyc +rm -f ./timmy/*.pyc diff --git a/timmy/cli.py b/timmy/cli.py index 8d3def0..4ef00a5 100755 --- a/timmy/cli.py +++ b/timmy/cli.py @@ -33,12 +33,7 @@ def pretty_run(quiet, msg, f, args=[], kwargs={}): print('%s: done' % msg) return result - -@interrupt_wrapper -def main(argv=None): - if argv is None: - argv = sys.argv - +def parse_args(): parser = argparse.ArgumentParser(description=('Parallel remote command' ' execution and file' ' manipulation tool')) @@ -139,6 +134,14 @@ def main(argv=None): parser.add_argument('-d', '--debug', help='Be extremely verbose.', action='store_true') + return parser + + +@interrupt_wrapper +def main(argv=None): + if argv is None: + argv = sys.argv + parser = parse_args() args = parser.parse_args(argv[1:]) if args.quiet and not args.warning: loglevel = logging.ERROR diff --git a/timmy/tools.py b/timmy/tools.py index 8e3c16d..9839c24 100644 --- a/timmy/tools.py +++ b/timmy/tools.py @@ -164,6 +164,9 @@ def get_dir_structure(rootdir): def load_yaml_file(filename): + """ + Loads yaml data from file + """ try: with open(filename, 'r') as f: return yaml.load(f) @@ -181,6 +184,9 @@ def load_yaml_file(filename): def mdir(directory): + """ + Creates a directory if it doesn't exist + """ if not os.path.exists(directory): logging.debug('creating directory %s' % directory) try: