diff --git a/HISTORY.rst b/HISTORY.md similarity index 71% rename from HISTORY.rst rename to HISTORY.md index 504314a..fed8008 100644 --- a/HISTORY.rst +++ b/HISTORY.md @@ -1,8 +1,8 @@ -======= -History -======= - -0.0.13 (2019-07-17) ------------------- - -* First release on PyPI. +======= +History +======= + +0.0.14 (2019-07-23) +------------------ + +* First release on PyPI. diff --git a/MANIFEST.in b/MANIFEST.in index 9fb3cff..24f7525 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,10 @@ include AUTHORS.rst +include requirements.txt include CONTRIBUTING.rst -include HISTORY.rst +include HISTORY.md include LICENSE -include README.rst +include README.md +include VERSION include ansible_taskrunner/lib/locale/en.yaml recursive-include tests * diff --git a/Makefile b/Makefile index b3d16f4..bbe9a59 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,60 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT" help: @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) +export define ZIPAPP_BASHSCRIPT + set -o errexit + echo activating py3 ... + source activate py3 + echo activating py2 ... + source activate py2 + exit + cd ansible_taskrunner + for pyver in py2 py3;do + echo Checking for embedded libraries in lib/$${pyver} + if ! test -d lib/$${pyver};then + echo Creating lib/$${pyver} + mkdir lib/$${pyver} + echo Installing requirements to lib/$${pyver} ... + source activate $$pyver + pip install -t lib/$${pyver} -r ../requirements.txt + fi + done + __version=$$(egrep '.*__version__ =' __init__.py | cut -d\ -f3 | tr -d "'") + echo "Version is $${__version}" + __release_dir=../release/$${__version} + lint_result=$$(python cli.py --help) + echo "Initial lint OK, proceeding with build" + if [[ "$$OSTYPE" =~ .*msys.* ]];then + echo "OSType is Windows, nesting libdir ..." + if test -d windows;then + rm -rf windows + else + mkdir windows + fi + cp -r lib plugins windows + echo "Creating zip-app" + make-zipapp -f cli.py -X __pycache__ -x .pyc -d windows + if test -d windows;then rm -rf windows;fi + else + echo "OSType is most likely POSIX native" + echo "Creating zip-app" + make-zipapp -f cli.py -X __pycache__ -x .pyc + fi + mv cli tasks + lint_result=$$(tasks --help) + echo "Initial lint OK, proceeding with release" + if ! test -d $${__release_dir};then mkdir -p $${__release_dir};fi + mv -f tasks $${__release_dir} + echo "Replacing current executable: $$(which tasks)" + yes | cp $${__release_dir}/tasks $$(which tasks) + if [[ -n $$deployment_host_and_path ]];then + echo "Pushing up" + scp_result=$$(scp $${__release_dir}/tasks $${deployment_host_and_path}) + fi +endef + +build-zipapp:; @ eval "$$ZIPAPP_BASHSCRIPT" + clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts clean-build: ## remove build artifacts diff --git a/README.md b/README.md index f2a0e11..3b9cf6d 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,10 @@ The inspiration for the tool comes from the gnu make command, which operates in - A Makefile defines available build steps - The make command consumes the Makefile at runtime and exposes these steps as command-line options +Jump down to the [usage examples](#usage-examples) to see this in action. + +[Installation Instructions](#installation) + # Use case and example @@ -533,7 +537,14 @@ Quick usage examples: * Run the embedded functions `hello` and `preflight_and_run` `tasks run -d dbhost1 -w webhost1 -t value1 -A -PR` -Now all you need to do is install the `tasks` binary to your ansible controller to start using this workflow! + +# Installation + +Ansible-tasksrunner consists of the `tasks` binary (for now), and it can be installed in a few ways: + +1. pip install ansible-taskrunner +2. pip install git+https://github.com/berttejeda/ansible-taskrunner.git +3. Obtaining a [release](#single-executable-releases) ## More Examples @@ -633,3 +644,8 @@ This project adopts the the MIT distribution License. - [click](https://github.com/pallets/click), licensed under BSD-3-Clause - [pyYaml](https://github.com/yaml/pyyaml), licensed under MIT + +Lastly, this package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template. + +.. _Cookiecutter: https://github.com/audreyr/cookiecutter +.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage diff --git a/README.rst b/README.rst deleted file mode 100644 index dca184e..0000000 --- a/README.rst +++ /dev/null @@ -1,37 +0,0 @@ -================== -ansible-taskrunner -================== - - -.. image:: https://img.shields.io/pypi/v/ansible_taskrunner.svg - :target: https://pypi.python.org/pypi/ansible_taskrunner - -.. image:: https://img.shields.io/travis/berttejeda/ansible_taskrunner.svg - :target: https://travis-ci.org/berttejeda/ansible_taskrunner - -.. image:: https://readthedocs.org/projects/ansible-taskrunner/badge/?version=latest - :target: https://ansible-taskrunner.readthedocs.io/en/latest/?badge=latest - :alt: Documentation Status - - - - -ansible-playbook wrapper with YAML-abstracted python click cli options - - -* Free software: MIT license -* Documentation: https://ansible-taskrunner.readthedocs.io. - - -Features --------- - -* TODO Employ language/regional options - -Credits -------- - -This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template. - -.. _Cookiecutter: https://github.com/audreyr/cookiecutter -.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..a618622 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.18 \ No newline at end of file diff --git a/ansible_taskrunner/__init__.py b/ansible_taskrunner/__init__.py index 1607f1e..685d278 100644 --- a/ansible_taskrunner/__init__.py +++ b/ansible_taskrunner/__init__.py @@ -4,6 +4,5 @@ __author__ = """Engelbert Tejeda""" __email__ = 'berttejeda@gmail.com' -__version__ = '0.0.14' __author__ = 'etejed001c' diff --git a/ansible_taskrunner/cli.py b/ansible_taskrunner/cli.py index 0c5c32b..36fb183 100644 --- a/ansible_taskrunner/cli.py +++ b/ansible_taskrunner/cli.py @@ -69,7 +69,7 @@ # Private variables __author__ = 'etejeda' -__version__ = '0.0.14-alpha' +__version__ = '0.0.18' __program_name__ = 'tasks' __debug = False verbose = 0 diff --git a/setup.cfg b/setup.cfg index 0b60895..c8c8f7f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,22 +1,61 @@ -[bumpversion] -current_version = 0.0.13 -commit = True -tag = True +[metadata] +name = ansible_taskrunner +author = Engelbert Tejeda +author_email = berttejeda@gmail.com +description = ansible-playbook wrapper with YAML-abstracted python click cli options +version = file: VERSION +url = https://github.com/berttejeda/ansible_taskrunner +keywords = + ansible + playbook + wrapper + bash + python + click + task-runner + subprocess + yaml + cli + options +classifiers = + Development Status :: 3 - Alpha + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Natural Language :: English + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 +long_description = file: README.md +long_description_content_type = text/markdown +license_files = + LICENSE.txt -[bumpversion:file:setup.py] -search = version='{current_version}' -replace = version='{new_version}' +[options] +python_requires = >= 2.7 +setup_requires = + setuptools >= 40.6 + pip >= 10 + wheel >= 0.31 +packages = find: +zip_safe: False +scripts = +# somescript.py +install_requires = + click==6.7 + PyYAML==4.2b1 -[bumpversion:file:ansible_taskrunner/__init__.py] -search = __version__ = '{current_version}' -replace = __version__ = '{new_version}' - -[bdist_wheel] -universal = 1 - -[flake8] -exclude = docs - -[aliases] -# Define setup.py command aliases here +[options.extras_require] +tests = + pytest + pytest-cov + coveralls + flake8 + mypy +[options.entry_points] +console_scripts = + tasks=ansible_taskrunner.cli:entrypoint \ No newline at end of file diff --git a/setup.py b/setup.py index 756c2e4..003ff5e 100644 --- a/setup.py +++ b/setup.py @@ -1,92 +1 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -"""The setup script.""" - -from setuptools import setup, find_packages -try: # for pip >= 10 - from pip._internal.req import parse_requirements -except ImportError: # for pip <= 9.0.3 - from pip.req import parse_requirements -import os -import re -import shutil -import sys - -with open("README.rst", "rb") as readme_file: - readme = readme_file.read().decode("utf-8") - -with open('HISTORY.rst') as history_file: - history = history_file.read() - -embedded_libs = [ -'ansible_taskrunner/lib/py2', -'ansible_taskrunner/lib/py3' -] - -for embedded_lib in embedded_libs: - if os.path.isdir(embedded_lib): - print('Removing embedded lib %s' % embedded_lib) - shutil.rmtree(embedded_lib) - -# parse_requirements() returns generator of pip.req.InstallRequirement objects -install_reqs = parse_requirements("requirements.txt", session=False) -# reqs is a list of requirement -# e.g. ['django==1.5.1', 'mezzanine==1.4.6'] -requirements = [str(ir.req) for ir in install_reqs] - -# Derive version info from main module -try: - # https://stackoverflow.com/questions/52007436/pypi-is-adding-dashes-to-the-beginning-and-end-of-version-name - version = re.search( - '^__version__[\s]+=[\s]+(.*).*', - open('ansible_taskrunner/__init__.py').read(), - re.M - ).group(1).strip('"').strip("'") -except AttributeError as e: - print(''' - I had trouble determining the verison information from your app. - Make sure the version string matches this format: - __version__ = '1.0' - ''') - -setup_requirements = [ ] - -test_requirements = [ ] - -setup( - author="Engelbert Tejeda", - author_email='berttejeda@gmail.com', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Natural Language :: English', - "Programming Language :: Python :: 2", - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - ], - description="ansible-playbook wrapper with YAML-abstracted python click cli options", - entry_points={ - 'console_scripts': [ - 'tasks=ansible_taskrunner.cli:entrypoint', - ], - }, - install_requires=requirements, - license="MIT license", - long_description=readme + '\n\n' + history, - include_package_data=True, - keywords='ansible playbook wrapper bash python click task-runner subprocess yaml cli options', - name='ansible_taskrunner', - packages=find_packages(exclude=['py2','py3']), - setup_requires=setup_requirements, - test_suite='tests', - tests_require=test_requirements, - url='https://github.com/berttejeda/ansible_taskrunner', - version=version, - zip_safe=False, -) +from setuptools import setup; setup()