Implement %pyproject_extras_subpkg
This commit is contained in:
parent
26607dc0db
commit
cb4e43c670
@ -11,6 +11,7 @@
|
||||
%_pyproject_builddir .pyproject-builddir
|
||||
|
||||
%pyproject_files %{_builddir}/pyproject-files
|
||||
%pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo
|
||||
|
||||
%pyproject_wheel() %{expand:\\\
|
||||
export TMPDIR="${PWD}/%{_pyproject_builddir}"
|
||||
@ -28,15 +29,30 @@ if [ -d %{buildroot}%{_bindir} ]; then
|
||||
pathfix.py -pni "%{__python3}" -k%{?py3_shbang_opts: -a%{py3_shbang_opts_nodash}} %{buildroot}%{_bindir}/*
|
||||
rm -rfv %{buildroot}%{_bindir}/__pycache__
|
||||
fi
|
||||
rm -f %{pyproject_ghost_distinfo}
|
||||
if [ -d %{buildroot}%{python3_sitelib} ]; then
|
||||
sed -i 's/pip/rpm/' %{buildroot}%{python3_sitelib}/*.dist-info/INSTALLER
|
||||
for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info; do
|
||||
echo "%ghost ${distinfo#%{buildroot}}" >> %{pyproject_ghost_distinfo}
|
||||
sed -i 's/pip/rpm/' ${distinfo}/INSTALLER
|
||||
done
|
||||
fi
|
||||
if [ -d %{buildroot}%{python3_sitearch} ]; then
|
||||
sed -i 's/pip/rpm/' %{buildroot}%{python3_sitearch}/*.dist-info/INSTALLER
|
||||
if [ %{buildroot}%{python3_sitearch} != %{buildroot}%{python3_sitelib} ] && [ -d %{buildroot}%{python3_sitearch} ]; then
|
||||
for distinfo in %{buildroot}%{python3_sitearch}/*.dist-info; do
|
||||
echo "%ghost ${distinfo#%{buildroot}}" >> %{pyproject_ghost_distinfo}
|
||||
sed -i 's/pip/rpm/' ${distinfo}/INSTALLER
|
||||
done
|
||||
fi
|
||||
lines=$(wc -l %{pyproject_ghost_distinfo} | cut -f1 -d" ")
|
||||
if [ $lines -ne 1 ]; then
|
||||
echo -e "\\n\\nWARNING: %%%%pyproject_extras_subpkg won't work without explicit -i or -F, found $lines dist-info directories.\\n\\n" >/dev/stderr
|
||||
rm %{pyproject_ghost_distinfo} # any attempt to use this will fail
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
%python_extras_subpkg(n:i:f:F) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{pyproject_ghost_distinfo}}}} %**}}}
|
||||
|
||||
|
||||
%pyproject_save_files() %{expand:\\\
|
||||
%{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\
|
||||
--output "%{pyproject_files}" \\
|
||||
|
@ -6,7 +6,7 @@ License: MIT
|
||||
|
||||
# Keep the version at zero and increment only release
|
||||
Version: 0
|
||||
Release: 19%{?dist}
|
||||
Release: 20%{?dist}
|
||||
|
||||
# Macro files
|
||||
Source001: macros.pyproject
|
||||
@ -101,6 +101,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
%license LICENSE
|
||||
|
||||
%changelog
|
||||
* Wed Jul 29 2020 Miro Hrončok <mhroncok@redhat.com> - 0-20
|
||||
- Implement %%pyproject_extras_subpkg
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-19
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
|
55
tests/python-setuptools_scm.spec
Normal file
55
tests/python-setuptools_scm.spec
Normal file
@ -0,0 +1,55 @@
|
||||
Name: python-setuptools_scm
|
||||
Version: 3.5.0
|
||||
Release: 0%{?dist}
|
||||
Summary: The blessed package to manage your versions by SCM tags
|
||||
License: MIT
|
||||
URL: https://github.com/pypa/setuptools_scm/
|
||||
Source0: %{pypi_source setuptools_scm}
|
||||
|
||||
BuildArch: noarch
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: pyproject-rpm-macros
|
||||
|
||||
%description
|
||||
Here we test that %%pyproject_extras_subpkg works and generates
|
||||
setuptools_scm[toml] extra subpackage.
|
||||
|
||||
Note that it only works on Fedora 33+.
|
||||
|
||||
%package -n python3-setuptools_scm
|
||||
Summary: %{summary}
|
||||
|
||||
%description -n python3-setuptools_scm
|
||||
...
|
||||
|
||||
%pyproject_extras_subpkg -n python3-setuptools_scm toml
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n setuptools_scm-%{version}
|
||||
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires
|
||||
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%pyproject_save_files setuptools_scm
|
||||
|
||||
|
||||
%check
|
||||
# Internal check for our macros
|
||||
# making sure that %%{pyproject_ghost_distinfo} has the right content
|
||||
test -f %{pyproject_ghost_distinfo}
|
||||
test "$(cat %{pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info"
|
||||
|
||||
|
||||
%files -n python3-setuptools_scm -f %{pyproject_files}
|
||||
%doc README.rst
|
||||
%doc CHANGELOG.rst
|
||||
%license LICENSE
|
@ -40,6 +40,9 @@
|
||||
- mistune:
|
||||
dir: .
|
||||
run: ./mocktest.sh python-mistune
|
||||
- setuptools_scm:
|
||||
dir: .
|
||||
run: ./mocktest.sh python-setuptools_scm
|
||||
required_packages:
|
||||
- mock
|
||||
- rpmdevtools
|
||||
|
Loading…
Reference in New Issue
Block a user