Blob Blame History Raw
%bcond_without tests

# for github etc. use the forgemacros

%global _description %{expand:
versioningit is yet another setuptools plugin for automatically determining
your package's version based on your version control repository's tags. Unlike
others, it allows easy customization of the version format and even lets you
easily override the separate functions used for version extraction &


- Installed & configured through PEP 518's pyproject.toml
- Supports Git, modern Git archives, and Mercurial
- Formatting of the final version uses format template strings, with fields for
  basic VCS information and separate template strings for distanced vs. dirty
  vs. distanced-and-dirty repository states
- Can optionally write the final version to a file for loading at runtime
- The individual methods for VCS querying, tag-to-version calculation, version
  bumping, version formatting, and writing the version to a file can all be
  customized using either functions defined alongside one’s project code or via
  publicly-distributed entry points
- Can alternatively be used as a library for use in or the like, in
  case you don’t want to or can’t configure it via pyproject.toml
- The only thing it does is calculate your version and optionally write it to a
  file; there's no overriding of your sdist contents based on what is in your
  Git repository, especially not without a way to turn it off, because that
  would just be rude.}

Name:           python-versioningit
Version:        0.2.1
Release:        %{autorelease}
Summary:        Versioning It with your Version In Git

License:        MIT
Source0:        %{pypi_source versioningit}
# Man page we're carryng downstream
Source1:        versioningit.1

BuildArch:      noarch

%description %_description

%package -n python3-versioningit
Summary:        %{summary}

# It calls git and hg so these need to be installed
Recommends:     git-core
Recommends:     mercurial

BuildRequires:  python3-devel
%if %{with tests}
BuildRequires:  git-core
BuildRequires:  mercurial

%description -n python3-versioningit %_description

%autosetup -n versioningit-%{version}
# Until pydantic 1.8.x is packaged, we must allow older versions.
# See:
sed -r -i 's/(\bpydantic)[>~]=1\.8.*/\1>=1\.7\.4/g' tox.ini
# Tweak build requirements to use what we have in Fedora. For test
# dependencies, we change all semver pins to minimum versions.
sed -r -i 's/~=/>=/g' tox.ini

# Comment out to remove /usr/bin/env shebangs
# Can use something similar to correct/remove /usr/bin/python shebangs also
# find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

%pyproject_buildrequires %{?with_tests: -t}


%pyproject_save_files versioningit

install -p -m 0644 -Dt %{buildroot}%{_mandir}/man1/  %{SOURCE1}

%if %{with tests}

%files -n python3-versioningit -f %{pyproject_files}
%doc README.rst