Skip to content

Commit ff25dc3

Browse files
authored
Merge pull request #14 from berttejeda/feature/setupcfg
Feature/setupcfg
2 parents 66b5d84 + 8e10370 commit ff25dc3

File tree

10 files changed

+144
-161
lines changed

10 files changed

+144
-161
lines changed

HISTORY.rst renamed to HISTORY.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
=======
2-
History
3-
=======
4-
5-
0.0.13 (2019-07-17)
6-
------------------
7-
8-
* First release on PyPI.
1+
=======
2+
History
3+
=======
4+
5+
0.0.14 (2019-07-23)
6+
------------------
7+
8+
* First release on PyPI.

MANIFEST.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
include AUTHORS.rst
2+
include requirements.txt
23
include CONTRIBUTING.rst
3-
include HISTORY.rst
4+
include HISTORY.md
45
include LICENSE
5-
include README.rst
6+
include README.md
7+
include VERSION
68
include ansible_taskrunner/lib/locale/en.yaml
79

810
recursive-include tests *

Makefile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,60 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
2929
help:
3030
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
3131

32+
export define ZIPAPP_BASHSCRIPT
33+
set -o errexit
34+
echo activating py3 ...
35+
source activate py3
36+
echo activating py2 ...
37+
source activate py2
38+
exit
39+
cd ansible_taskrunner
40+
for pyver in py2 py3;do
41+
echo Checking for embedded libraries in lib/$${pyver}
42+
if ! test -d lib/$${pyver};then
43+
echo Creating lib/$${pyver}
44+
mkdir lib/$${pyver}
45+
echo Installing requirements to lib/$${pyver} ...
46+
source activate $$pyver
47+
pip install -t lib/$${pyver} -r ../requirements.txt
48+
fi
49+
done
50+
__version=$$(egrep '.*__version__ =' __init__.py | cut -d\ -f3 | tr -d "'")
51+
echo "Version is $${__version}"
52+
__release_dir=../release/$${__version}
53+
lint_result=$$(python cli.py --help)
54+
echo "Initial lint OK, proceeding with build"
55+
if [[ "$$OSTYPE" =~ .*msys.* ]];then
56+
echo "OSType is Windows, nesting libdir ..."
57+
if test -d windows;then
58+
rm -rf windows
59+
else
60+
mkdir windows
61+
fi
62+
cp -r lib plugins windows
63+
echo "Creating zip-app"
64+
make-zipapp -f cli.py -X __pycache__ -x .pyc -d windows
65+
if test -d windows;then rm -rf windows;fi
66+
else
67+
echo "OSType is most likely POSIX native"
68+
echo "Creating zip-app"
69+
make-zipapp -f cli.py -X __pycache__ -x .pyc
70+
fi
71+
mv cli tasks
72+
lint_result=$$(tasks --help)
73+
echo "Initial lint OK, proceeding with release"
74+
if ! test -d $${__release_dir};then mkdir -p $${__release_dir};fi
75+
mv -f tasks $${__release_dir}
76+
echo "Replacing current executable: $$(which tasks)"
77+
yes | cp $${__release_dir}/tasks $$(which tasks)
78+
if [[ -n $$deployment_host_and_path ]];then
79+
echo "Pushing up"
80+
scp_result=$$(scp $${__release_dir}/tasks $${deployment_host_and_path})
81+
fi
82+
endef
83+
84+
build-zipapp:; @ eval "$$ZIPAPP_BASHSCRIPT"
85+
3286
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
3387

3488
clean-build: ## remove build artifacts

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ The inspiration for the tool comes from the gnu make command, which operates in
4444
- A Makefile defines available build steps
4545
- The make command consumes the Makefile at runtime and exposes these steps as command-line options
4646

47+
Jump down to the [usage examples](#usage-examples) to see this in action.
48+
49+
[Installation Instructions](#installation)
50+
4751
<a name="use-case-and-example"></a>
4852
# Use case and example
4953

@@ -533,7 +537,14 @@ Quick usage examples:
533537
* Run the embedded functions `hello` and `preflight_and_run`
534538
`tasks run -d dbhost1 -w webhost1 -t value1 -A -PR`
535539

536-
Now all you need to do is install the `tasks` binary to your ansible controller to start using this workflow!
540+
<a name="installation"></a>
541+
# Installation
542+
543+
Ansible-tasksrunner consists of the `tasks` binary (for now), and it can be installed in a few ways:
544+
545+
1. pip install ansible-taskrunner
546+
2. pip install git+https://github.com/berttejeda/ansible-taskrunner.git
547+
3. Obtaining a [release](#single-executable-releases)
537548

538549
<a name="more-examples"></a>
539550
## More Examples
@@ -633,3 +644,8 @@ This project adopts the the MIT distribution License.
633644

634645
- [click](https://github.com/pallets/click), licensed under BSD-3-Clause
635646
- [pyYaml](https://github.com/yaml/pyyaml), licensed under MIT
647+
648+
Lastly, this package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.
649+
650+
.. _Cookiecutter: https://github.com/audreyr/cookiecutter
651+
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage

README.rst

Lines changed: 0 additions & 37 deletions
This file was deleted.

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.18

ansible_taskrunner/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44

55
__author__ = """Engelbert Tejeda"""
66
__email__ = 'berttejeda@gmail.com'
7-
__version__ = '0.0.14'
87

98
__author__ = 'etejed001c'

ansible_taskrunner/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
# Private variables
7171
__author__ = 'etejeda'
72-
__version__ = '0.0.14-alpha'
72+
__version__ = '0.0.18'
7373
__program_name__ = 'tasks'
7474
__debug = False
7575
verbose = 0

setup.cfg

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
1-
[bumpversion]
2-
current_version = 0.0.13
3-
commit = True
4-
tag = True
1+
[metadata]
2+
name = ansible_taskrunner
3+
author = Engelbert Tejeda
4+
author_email = berttejeda@gmail.com
5+
description = ansible-playbook wrapper with YAML-abstracted python click cli options
6+
version = file: VERSION
7+
url = https://github.com/berttejeda/ansible_taskrunner
8+
keywords =
9+
ansible
10+
playbook
11+
wrapper
12+
bash
13+
python
14+
click
15+
task-runner
16+
subprocess
17+
yaml
18+
cli
19+
options
20+
classifiers =
21+
Development Status :: 3 - Alpha
22+
Intended Audience :: Developers
23+
License :: OSI Approved :: MIT License
24+
Natural Language :: English
25+
Programming Language :: Python :: 2
26+
Programming Language :: Python :: 2.7
27+
Programming Language :: Python :: 3
28+
Programming Language :: Python :: 3.4
29+
Programming Language :: Python :: 3.5
30+
Programming Language :: Python :: 3.6
31+
Programming Language :: Python :: 3.7
32+
long_description = file: README.md
33+
long_description_content_type = text/markdown
34+
license_files =
35+
LICENSE.txt
536

6-
[bumpversion:file:setup.py]
7-
search = version='{current_version}'
8-
replace = version='{new_version}'
37+
[options]
38+
python_requires = >= 2.7
39+
setup_requires =
40+
setuptools >= 40.6
41+
pip >= 10
42+
wheel >= 0.31
43+
packages = find:
44+
zip_safe: False
45+
scripts =
46+
# somescript.py
47+
install_requires =
48+
click==6.7
49+
PyYAML==4.2b1
950

10-
[bumpversion:file:ansible_taskrunner/__init__.py]
11-
search = __version__ = '{current_version}'
12-
replace = __version__ = '{new_version}'
13-
14-
[bdist_wheel]
15-
universal = 1
16-
17-
[flake8]
18-
exclude = docs
19-
20-
[aliases]
21-
# Define setup.py command aliases here
51+
[options.extras_require]
52+
tests =
53+
pytest
54+
pytest-cov
55+
coveralls
56+
flake8
57+
mypy
2258

59+
[options.entry_points]
60+
console_scripts =
61+
tasks=ansible_taskrunner.cli:entrypoint

setup.py

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1 @@
1-
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
4-
"""The setup script."""
5-
6-
from setuptools import setup, find_packages
7-
try: # for pip >= 10
8-
from pip._internal.req import parse_requirements
9-
except ImportError: # for pip <= 9.0.3
10-
from pip.req import parse_requirements
11-
import os
12-
import re
13-
import shutil
14-
import sys
15-
16-
with open("README.rst", "rb") as readme_file:
17-
readme = readme_file.read().decode("utf-8")
18-
19-
with open('HISTORY.rst') as history_file:
20-
history = history_file.read()
21-
22-
embedded_libs = [
23-
'ansible_taskrunner/lib/py2',
24-
'ansible_taskrunner/lib/py3'
25-
]
26-
27-
for embedded_lib in embedded_libs:
28-
if os.path.isdir(embedded_lib):
29-
print('Removing embedded lib %s' % embedded_lib)
30-
shutil.rmtree(embedded_lib)
31-
32-
# parse_requirements() returns generator of pip.req.InstallRequirement objects
33-
install_reqs = parse_requirements("requirements.txt", session=False)
34-
# reqs is a list of requirement
35-
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
36-
requirements = [str(ir.req) for ir in install_reqs]
37-
38-
# Derive version info from main module
39-
try:
40-
# https://stackoverflow.com/questions/52007436/pypi-is-adding-dashes-to-the-beginning-and-end-of-version-name
41-
version = re.search(
42-
'^__version__[\s]+=[\s]+(.*).*',
43-
open('ansible_taskrunner/__init__.py').read(),
44-
re.M
45-
).group(1).strip('"').strip("'")
46-
except AttributeError as e:
47-
print('''
48-
I had trouble determining the verison information from your app.
49-
Make sure the version string matches this format:
50-
__version__ = '1.0'
51-
''')
52-
53-
setup_requirements = [ ]
54-
55-
test_requirements = [ ]
56-
57-
setup(
58-
author="Engelbert Tejeda",
59-
author_email='berttejeda@gmail.com',
60-
classifiers=[
61-
'Development Status :: 3 - Alpha',
62-
'Intended Audience :: Developers',
63-
'License :: OSI Approved :: MIT License',
64-
'Natural Language :: English',
65-
"Programming Language :: Python :: 2",
66-
'Programming Language :: Python :: 2.7',
67-
'Programming Language :: Python :: 3',
68-
'Programming Language :: Python :: 3.4',
69-
'Programming Language :: Python :: 3.5',
70-
'Programming Language :: Python :: 3.6',
71-
'Programming Language :: Python :: 3.7',
72-
],
73-
description="ansible-playbook wrapper with YAML-abstracted python click cli options",
74-
entry_points={
75-
'console_scripts': [
76-
'tasks=ansible_taskrunner.cli:entrypoint',
77-
],
78-
},
79-
install_requires=requirements,
80-
license="MIT license",
81-
long_description=readme + '\n\n' + history,
82-
include_package_data=True,
83-
keywords='ansible playbook wrapper bash python click task-runner subprocess yaml cli options',
84-
name='ansible_taskrunner',
85-
packages=find_packages(exclude=['py2','py3']),
86-
setup_requires=setup_requirements,
87-
test_suite='tests',
88-
tests_require=test_requirements,
89-
url='https://github.com/berttejeda/ansible_taskrunner',
90-
version=version,
91-
zip_safe=False,
92-
)
1+
from setuptools import setup; setup()

0 commit comments

Comments
 (0)