remove direct_url.json file and sed it out from RECORD

With PEP 610 there is created new file direct_url.json since is not
useful for us, it will be removed using py3_install_wheel macro.

See: https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012
This commit is contained in:
Tomas Hrnciar 2020-05-04 11:01:42 +02:00
parent fed99a0478
commit daf7d32612
4 changed files with 23 additions and 1 deletions

View File

@ -44,6 +44,12 @@
%py_install_wheel() %{expand:\\\
pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
rm -rfv %{buildroot}%{_bindir}/__pycache__
for distinfo in %{buildroot}%{python_sitelib}/*.dist-info %{buildroot}%{python_sitearch}/*.dist-info; do
if [ -f ${distinfo}/direct_url.json ]; then
rm -fv ${distinfo}/direct_url.json
sed -i '/direct_url.json/d' ${distinfo}/RECORD
fi
done
}
%python_provide() %{lua:

View File

@ -46,4 +46,10 @@
%py2_install_wheel() %{expand:\\\
pip%{python2_version} install -I dist/%{1} --root %{buildroot} --no-deps
rm -rfv %{buildroot}%{_bindir}/__pycache__
for distinfo in %{buildroot}%{python2_sitelib}/*.dist-info %{buildroot}%{python2_sitearch}/*.dist-info; do
if [ -f ${distinfo}/direct_url.json ]; then
rm -fv ${distinfo}/direct_url.json
sed -i '/direct_url.json/d' ${distinfo}/RECORD
fi
done
}

View File

@ -40,6 +40,12 @@
%py3_install_wheel() %{expand:\\\
pip%{python3_version} install -I dist/%{1} --root %{buildroot} --no-deps
rm -rfv %{buildroot}%{_bindir}/__pycache__
for distinfo in %{buildroot}%{python3_sitelib}/*.dist-info %{buildroot}%{python3_sitearch}/*.dist-info; do
if [ -f ${distinfo}/direct_url.json ]; then
rm -fv ${distinfo}/direct_url.json
sed -i '/direct_url.json/d' ${distinfo}/RECORD
fi
done
}
# This only supports Python 3.5+ and will never work with Python 2.

View File

@ -1,6 +1,6 @@
Name: python-rpm-macros
Version: 3.8
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The common Python RPM macros
# macros: MIT, compileall2.py: PSFv2
@ -80,6 +80,10 @@ install -m 644 %{SOURCE5} \
%changelog
* Mon May 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.8-4
- Make %%py3_install_wheel macro remove direct_url.json file created by PEP 610.
- https://discuss.python.org/t/pep-610-usage-guidelines-for-linux-distributions/4012
* Mon Apr 27 2020 Miro Hrončok <mhroncok@redhat.com> - 3.8-3
- Make pythonX-rpm-macros depend on python-rpm-macros (#1827811)