diff --git a/.git_archival.txt b/.git_archival.txt index 3994ec0..8fb235d 100644 --- a/.git_archival.txt +++ b/.git_archival.txt @@ -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$ diff --git a/.gitignore b/.gitignore index 07907eb..00b5113 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ pip-delete-this-directory.txt .dmypy.json dmypy.json .pyre/ +/build/ # Vagrant artifacts .vagrant/** @@ -27,4 +28,4 @@ dmypy.json venv/** # VSCode artifacts -.vscode/** \ No newline at end of file +.vscode/** diff --git a/.packit.yaml b/.packit.yaml index b3bddfa..f5042f5 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -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 diff --git a/ansible-bender.spec b/ansible-bender.spec index 2842893..4be2f64 100644 --- a/ansible-bender.spec +++ b/ansible-bender.spec @@ -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 @@ -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 @@ -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 @@ -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} @@ -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 - 0.10.1-1 - 0.10.1 upstream release diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..42a80f8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[project] +name = "ansible-bender" +authors = [ + {name = "Tomas Tomecek", email = "tomas@tomecek.net"}, +] +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" diff --git a/setup.cfg b/setup.cfg index 631b236..9253123 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 = tomas@tomecek.net -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 diff --git a/setup.py b/setup.py deleted file mode 100644 index 0df2ca4..0000000 --- a/setup.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/python3 - -import os - -import setuptools - -setuptools.setup(use_scm_version=True)