Skip to content

Commit 32fd41a

Browse files
committed
update away from setup.py
1 parent ccb6dd0 commit 32fd41a

File tree

3 files changed

+45
-36
lines changed

3 files changed

+45
-36
lines changed

pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "ansible-modules-hashivault"
7+
version = "5.5.0"
8+
description = "Ansible Modules for Hashicorp Vault"
9+
readme = "README.rst"
10+
license = "MIT"
11+
authors = [
12+
{name = "Terry Howe", email = "[email protected]"}
13+
]
14+
classifiers = [
15+
"Programming Language :: Python :: 3",
16+
"Operating System :: OS Independent",
17+
]
18+
requires-python = ">=3.9"
19+
dependencies = [
20+
"ansible-core>=2.12.0",
21+
"hvac>=2.1.0",
22+
"requests",
23+
]
24+
25+
[project.urls]
26+
Homepage = "https://github.com/TerryHowe/ansible-modules-hashivault"
27+
28+
[tool.setuptools]
29+
py-modules = [
30+
"ansible.module_utils.hashivault",
31+
"ansible.plugins.lookup.hashivault",
32+
"ansible.plugins.action.hashivault_read_to_file",
33+
"ansible.plugins.action.hashivault_write_from_file",
34+
"ansible.plugins.doc_fragments.hashivault",
35+
]
36+
packages = ["ansible.modules.hashivault"]

setup.py

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,5 @@
11
#!/usr/bin/env python
2+
# Legacy setup.py for backward compatibility
3+
# Primary config is in pyproject.toml
24
from setuptools import setup
3-
4-
py_files = [
5-
"ansible/module_utils/hashivault",
6-
"ansible/plugins/lookup/hashivault",
7-
"ansible/plugins/action/hashivault_read_to_file",
8-
"ansible/plugins/action/hashivault_write_from_file",
9-
"ansible/plugins/doc_fragments/hashivault",
10-
]
11-
files = [
12-
"ansible/modules/hashivault",
13-
]
14-
15-
long_description = open('README.rst', 'r').read()
16-
17-
setup(
18-
name='ansible-modules-hashivault',
19-
version='5.5.0',
20-
description='Ansible Modules for Hashicorp Vault',
21-
long_description=long_description,
22-
long_description_content_type='text/x-rst',
23-
author='Terry Howe',
24-
author_email='[email protected]',
25-
url='https://github.com/TerryHowe/ansible-modules-hashivault',
26-
py_modules=py_files,
27-
packages=files,
28-
install_requires=[
29-
'ansible-core>=2.12.0',
30-
'hvac>=2.1.0',
31-
'requests',
32-
],
33-
)
5+
setup()

upload.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ fi
1717
git pull
1818
pip install gitchangelog
1919
pip install twine
20-
OLDVERSION=$(grep version setup.py | sed -e "s/.*='//" -e "s/',//")
21-
vi setup.py
22-
VERSION=$(grep version setup.py | sed -e "s/.*='//" -e "s/',//")
20+
pip install build
21+
OLDVERSION=$(grep '^version' pyproject.toml | sed -e 's/.*= "//' -e 's/"//')
22+
vi pyproject.toml
23+
VERSION=$(grep '^version' pyproject.toml | sed -e 's/.*= "//' -e 's/"//')
2324
if [ "$OLDVERSION" == "$VERSION" ]
2425
then
2526
echo "Old version $OLDVERSION same as $VERSION"
@@ -30,7 +31,7 @@ GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=log.showsignature GIT_CONFIG_VALUE_0=false g
3031
vi CHANGELOG.rst
3132
echo "Ready to push $VERSION (cntrl-c to quit)?"
3233
read ANS
33-
git commit -m "Version $VERSION" CHANGELOG.rst setup.py
34+
git commit -m "Version $VERSION" CHANGELOG.rst pyproject.toml
3435
git push origin main
3536
git tag --force -a $VERSION -m v$VERSION
3637
git push origin --tags
@@ -41,5 +42,5 @@ git push origin --tags
4142

4243
# twine
4344
rm -rf dist
44-
python setup.py sdist # bdist_wheel
45+
python3.9 -m build --sdist
4546
twine upload dist/*

0 commit comments

Comments
 (0)