diff --git a/python-hatch-vcs.spec b/python-hatch-vcs.spec index ca208d7..2716c2f 100644 --- a/python-hatch-vcs.spec +++ b/python-hatch-vcs.spec @@ -19,11 +19,8 @@ Source0: %{pypi_source hatch_vcs} BuildArch: noarch BuildRequires: python3-devel -# RHBZ#1985340 -BuildRequires: pyproject-rpm-macros >= 1.1.0 - -# For script in %%generate_buildrequires: -BuildRequires: python3dist(tomli) +# RHBZ#1985340, RHBZ#2076994 +BuildRequires: pyproject-rpm-macros >= 1.2.0 %if %{with tests} BuildRequires: python3dist(pytest) @@ -50,25 +47,7 @@ Summary: %{summary} %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 +%pyproject_buildrequires -w %build