Skip to content

Commit

Permalink
Merge pull request #15 from berttejeda/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
berttejeda authored Jul 23, 2019
2 parents 66815e7 + ff25dc3 commit 3af6226
Show file tree
Hide file tree
Showing 10 changed files with 144 additions and 161 deletions.
16 changes: 8 additions & 8 deletions HISTORY.rst → HISTORY.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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 *
Expand Down
54 changes: 54 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<a name="use-case-and-example"></a>
# Use case and example

Expand Down Expand Up @@ -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!
<a name="installation"></a>
# 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)

<a name="more-examples"></a>
## More Examples
Expand Down Expand Up @@ -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
37 changes: 0 additions & 37 deletions README.rst

This file was deleted.

1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.18
1 change: 0 additions & 1 deletion ansible_taskrunner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@

__author__ = """Engelbert Tejeda"""
__email__ = 'berttejeda@gmail.com'
__version__ = '0.0.14'

__author__ = 'etejed001c'
2 changes: 1 addition & 1 deletion ansible_taskrunner/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

# Private variables
__author__ = 'etejeda'
__version__ = '0.0.14-alpha'
__version__ = '0.0.18'
__program_name__ = 'tasks'
__debug = False
verbose = 0
Expand Down
77 changes: 58 additions & 19 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -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
93 changes: 1 addition & 92 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 3af6226

Please sign in to comment.