python-setuptools-git-versi.../python-setuptools-git-versioning.spec
Steve Kowalik 10e5d5b347 - Update to 2.1.0:
* [breaking] Drop get_branch_tags function which was deprecated
    since 1.8.0.
  * [breaking] version_file option now have precedence over any tags in
    the current branch.
  * [breaking] Drop version_config keyword from setup.py, which was
    deprecated since 1.8.0.
  * [breaking] Does not allow passing setuptools_git_versioning=False
    and setuptools_git_versioning=True to config. Always use
    setuptools_git_versioning={"enabled": True}.
  * [feature] Test Python 3.13 compatibility
  * [feature] Test Python 3.12 compatibility
  * [feature] Remove useless warning if tag_filter, tag_formatter or
    branch_formatter is a regexp instead of function reference.
  * [bugfix] Replace outdated toml package with modern tomli.
- Rip out _service and all of its gubbins, we can successfully test with
  the GitHub tarball, so switch to that.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-setuptools-git-versioning?expand=0&rev=15
2025-01-28 04:25:07 +00:00

96 lines
3.5 KiB
RPMSpec

#
# spec file for package python-setuptools-git-versioning
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-setuptools-git-versioning
Version: 2.1.0
Release: 0
Summary: Use git repo data for building a version number according PEP-440
License: MIT
URL: https://setuptools-git-versioning.readthedocs.io
# SourceDist: https://github.com/dolfinus/setuptools-git-versioning
Source: https://github.com/dolfinus/setuptools-git-versioning/archive/refs/tags/v2.1.0.tar.gz#/setuptools-get-versioning-%{version}.tar.gz
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: git-core
Requires: python-packaging
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: python-setuptools_git_versioning = %{version}-%{release}
BuildArch: noarch
# SECTION test
BuildRequires: %{python_module build}
BuildRequires: %{python_module coverage}
BuildRequires: %{python_module packaging}
BuildRequires: %{python_module pytest-rerunfailures}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module toml}
BuildRequires: git-core
# /SECTION
%python_subpackages
%description
Use git repo data (latest tag, current commit hash, etc) for building a
version number according PEP440.
- Can be installed & configured through both `setup.py` and :PEP518's `pyproject.toml`
- Does not require to change source code of the project
- Tag-, file-, and callback-based versioning schemas are supported
- Templates for *tag*, *dev* and *dirty* versions are separated
- Templates support a lot of substitutions including git and environment information
%prep
%autosetup -p1 -n setuptools-git-versioning-%{version}
# Set version
echo "Version: %{version}" > PKG-INFO
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/setuptools-git-versioning
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# cannot test isolated: no wheels for setuptools, wheel, coverage. Modify after wheel build
sed -i '/assert get_version(repo, isolated=True)/d' tests/test_integration/test_config.py
# test tries to get a wheel wheel in isolated build env
donttest="test_substitution_env"
%pytest -k "not ($donttest)" -n auto
%post
%python_install_alternative setuptools-git-versioning
%postun
%python_uninstall_alternative setuptools-git-versioning
%files %{python_files}
%python_alternative %{_bindir}/setuptools-git-versioning
%{python_sitelib}/setuptools_git_versioning.py*
%{python_sitelib}/setuptools_git_versioning-%{version}.dist-info
%pycache_only %{python_sitelib}/__pycache__/setuptools_git_versioning*.pyc
%changelog