Skip to content

Commit

Permalink
Merge pull request #294 from grawlinson/pep-517-ify
Browse files Browse the repository at this point in the history
refactor: attempt to modernise build
  • Loading branch information
TomasTomecek authored Mar 13, 2023
2 parents 17c4d34 + 592c88e commit 692618c
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pip-delete-this-directory.txt
.dmypy.json
dmypy.json
.pyre/
/build/

# Vagrant artifacts
.vagrant/**
Expand All @@ -27,4 +28,4 @@ dmypy.json
venv/**

# VSCode artifacts
.vscode/**
.vscode/**
21 changes: 11 additions & 10 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
specfile_path: ansible-bender.spec
actions:
create-archive:
- "python3 setup.py sdist --dist-dir ."
- "sh -c 'echo ansible-bender-$(python3 setup.py --version).tar.gz'"
- "python3 -m build"
- "sh -c 'ls -1 dist/ansible-bender-$(python3 -m setuptools_scm).tar.gz'"
get-current-version:
- "python3 setup.py --version"
- "python3 -m setuptools_scm"
jobs:
- job: copr_build
targets:
- fedora-all
- fedora-rawhide
# fedora 36 has old setuptools
- fedora-37
trigger: pull_request
- job: tests
trigger: pull_request
targets:
- fedora-all
- job: propose_downstream
trigger: release
dist_git_branches: [rawhide]
- fedora-rawhide
- fedora-37
srpm_build_deps:
- python3-pip # "python3 setup.py --version" needs it
- python3-setuptools_scm
- python3-build
- python3-setuptools
- python3-setuptools_scm
21 changes: 11 additions & 10 deletions ansible-bender.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ Source0: %{pypi_source}

BuildArch: noarch

BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-setuptools_scm
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: pyproject-rpm-macros

%if %{with check}
# These are required for tests:
BuildRequires: python%{python3_pkgversion}-pyyaml
Expand All @@ -27,7 +28,6 @@ BuildRequires: python%{python3_pkgversion}-jsonschema
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-flexmock
BuildRequires: python%{python3_pkgversion}-pytest-xdist
BuildRequires: python%{python3_pkgversion}-libselinux
BuildRequires: ansible-core
BuildRequires: podman
BuildRequires: buildah
Expand All @@ -37,6 +37,9 @@ Requires: (ansible-core or ansible)
Suggests: ansible-core
Requires: buildah

%generate_buildrequires
%pyproject_buildrequires

%description
This is a tool which bends containers using Ansible playbooks and
turns them into container images. It has a pluggable builder selection
Expand All @@ -52,11 +55,12 @@ tl;dr Ansible is the frontend, buildah is the backend.


%build
%py3_build
%pyproject_wheel


%install
%py3_install
%pyproject_install
%pyproject_save_files ansible_bender


%if %{with check}
Expand All @@ -73,15 +77,12 @@ tl;dr Ansible is the frontend, buildah is the backend.
%endif


%files
%{python3_sitelib}/ansible_bender-*.egg-info/
%{python3_sitelib}/ansible_bender/
%files -f %{pyproject_files}
%{_bindir}/ansible-bender
%license LICENSE
%doc docs/* README.md



%changelog
* Mon Feb 06 2023 Tomas Tomecek <[email protected]> - 0.10.1-1
- 0.10.1 upstream release
Expand Down
63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[project]
name = "ansible-bender"
authors = [
{name = "Tomas Tomecek", email = "[email protected]"},
]
description = "A tool which builds container images using Ansible playbooks"
readme = "README.md"
requires-python = ">= 3.6"
keywords = [
"ansible",
"containers",
"linux",
"buildah",
]
license = {text = "MIT"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development",
"Topic :: Utilities",
]
dependencies = [
"PyYAML",
"tabulate",
"jsonschema",
"setuptools",
]
dynamic = ["version"]

[project.urls]
homepage = "https://github.com/ansible-community/ansible-bender"
documentation = "https://ansible-community.github.io/ansible-bender/build/html/index.html"

[project.optional-dependencies]
testing = [
"pytest",
"flexmock",
"pytest-cov",
]

[project.scripts]
ansible-bender = "ansible_bender.cli:main"

# reference for usage:
# https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage
[tool.setuptools_scm]

# references for minimum version selection:
# setuptools: https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
# setuptools-scm: https://github.com/pypa/setuptools_scm/#pyprojecttoml-usage
[build-system]
requires = ["setuptools>=61", "setuptools-scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"
55 changes: 0 additions & 55 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,63 +1,8 @@
[bdist_wheel]
universal = 1

[metadata]
name = ansible-bender
url = https://github.com/ansible-community/ansible-bender
description = A tool which builds container images using Ansible playbooks
long_description = file: README.md
long_description_content_type = text/markdown
author = Tomas Tomecek
author_email = [email protected]
license = MIT
license_file = LICENSE
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Software Development
Topic :: Utilities
keywords =
ansible
containers
linux
buildah


[options]
python_requires = >=3.6
packages = find:
include_package_data = True

setup_requires =
setuptools_scm

install_requires =
PyYAML
tabulate
jsonschema
setuptools

[options.packages.find]
exclude =
tests
tests.*

[options.extras_require]
testing =
pytest
flexmock
pytest-cov

[options.entry_points]
console_scripts =
ansible-bender = ansible_bender.cli:main
7 changes: 0 additions & 7 deletions setup.py

This file was deleted.

0 comments on commit 692618c

Please sign in to comment.