|
|
|
@ -0,0 +1,99 @@
|
|
|
|
|
# Let’s try to build this as early as we can, since it’s a dependency for
|
|
|
|
|
# python-userpath.
|
|
|
|
|
%bcond_with bootstrap
|
|
|
|
|
%if %{without bootstrap}
|
|
|
|
|
%bcond_without tests
|
|
|
|
|
%else
|
|
|
|
|
%bcond_with tests
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
Name: python-hatch-vcs
|
|
|
|
|
Version: 0.2.0
|
|
|
|
|
Release: %autorelease
|
|
|
|
|
Summary: Hatch plugin for versioning with your preferred VCS
|
|
|
|
|
|
|
|
|
|
License: MIT
|
|
|
|
|
URL: https://github.com/ofek/hatch-vcs
|
|
|
|
|
Source0: %{pypi_source hatch_vcs}
|
|
|
|
|
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
|
|
BuildRequires: python3-devel
|
|
|
|
|
|
|
|
|
|
# For script in %%generate_buildrequires:
|
|
|
|
|
BuildRequires: python3dist(tomli)
|
|
|
|
|
|
|
|
|
|
%if %{with tests}
|
|
|
|
|
BuildRequires: python3dist(pytest)
|
|
|
|
|
BuildRequires: git-core
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%global common_description %{expand: \
|
|
|
|
|
This provides a plugin for Hatch that uses your preferred version control
|
|
|
|
|
system (like Git) to determine project versions.}
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
%{common_description}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%package -n python3-hatch-vcs
|
|
|
|
|
Summary: %{summary}
|
|
|
|
|
|
|
|
|
|
%description -n python3-hatch-vcs
|
|
|
|
|
%{common_description}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
%autosetup -n hatch_vcs-%{version}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%generate_buildrequires
|
|
|
|
|
# Cannot use %%pyproject_buildrequires -r (the default) with hatchling:
|
|
|
|
|
# “ValueError: build backend cannot provide build metadata (incl. runtime
|
|
|
|
|
# requirements) before build”. See: https://github.com/ofek/hatch/issues/128
|
|
|
|
|
#
|
|
|
|
|
# We work around this by writing the dependencies from pyproject.toml into a
|
|
|
|
|
# text file. This may not be necessary in the future; see:
|
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=2076994
|
|
|
|
|
'%{python3}' <<'EOF'
|
|
|
|
|
from tomli import load
|
|
|
|
|
|
|
|
|
|
def emit(tomlbase, reqtag, getdeps):
|
|
|
|
|
with open(f'{tomlbase}.toml', 'rb') as cfgfile:
|
|
|
|
|
deps = getdeps(load(cfgfile))
|
|
|
|
|
with open(f'requirements.{reqtag}.txt', 'w') as reqfile:
|
|
|
|
|
reqfile.writelines(f'{dep}\n' for dep in deps)
|
|
|
|
|
|
|
|
|
|
emit('pyproject', 'pyproject', lambda cfg: cfg['project']['dependencies'])
|
|
|
|
|
EOF
|
|
|
|
|
%pyproject_buildrequires -R requirements.pyproject.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
%pyproject_wheel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
%pyproject_install
|
|
|
|
|
%pyproject_save_files hatch_vcs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%check
|
|
|
|
|
%if %{with tests}
|
|
|
|
|
%pytest
|
|
|
|
|
%else
|
|
|
|
|
%pyproject_check_import
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%files -n python3-hatch-vcs -f %{pyproject_files}
|
|
|
|
|
# The license file is installed in an unusual subdirectory. See
|
|
|
|
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1985340.
|
|
|
|
|
%dir %{python3_sitelib}/hatch_vcs-%{version}.dist-info/license_files
|
|
|
|
|
%license %{python3_sitelib}/hatch_vcs-%{version}.dist-info/license_files/LICENSE.txt
|
|
|
|
|
%doc HISTORY.md
|
|
|
|
|
%doc README.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
|
%autochangelog
|