%pyproject_save_files: Support nested directories in dist-info
This commit is contained in:
parent
6015300d34
commit
6d0900f5b5
@ -10,7 +10,7 @@ License: MIT
|
||||
# Increment Y and reset Z when new macros or features are added
|
||||
# Increment Z when this is a bugfix or a cosmetic change
|
||||
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
||||
Version: 1.0.1
|
||||
Version: 1.1.0
|
||||
Release: 1%{?dist}
|
||||
|
||||
# Macro files
|
||||
@ -121,6 +121,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
%license LICENSE
|
||||
|
||||
%changelog
|
||||
* Tue Apr 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.1.0-1
|
||||
- %%pyproject_save_files: Support nested directories in dist-info
|
||||
- Fixes: rhbz#1985340
|
||||
|
||||
* Tue Mar 22 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.1-1
|
||||
- Prefix paths of intermediate files (such as %%{pyproject_files}) with NVRA
|
||||
|
||||
|
@ -320,15 +320,20 @@ def classify_paths(
|
||||
# we handle bytecode separately
|
||||
continue
|
||||
|
||||
if path.parent == distinfo:
|
||||
if path.name in ("RECORD", "REQUESTED"):
|
||||
if distinfo in path.parents:
|
||||
if path.parent == distinfo and path.name in ("RECORD", "REQUESTED"):
|
||||
# RECORD and REQUESTED files are removed in %pyproject_install
|
||||
# See PEP 627
|
||||
continue
|
||||
if license_files and path.name in license_files:
|
||||
if license_files and str(path.relative_to(distinfo)) in license_files:
|
||||
paths["metadata"]["licenses"].append(path)
|
||||
else:
|
||||
paths["metadata"]["files"].append(path)
|
||||
# nested directories within distinfo
|
||||
index = path.parents.index(distinfo)
|
||||
for parent in list(path.parents)[:index]: # no direct slice until Python 3.10
|
||||
if parent not in paths["metadata"]["dirs"]:
|
||||
paths["metadata"]["dirs"].append(parent)
|
||||
continue
|
||||
|
||||
for sitedir in sitedirs:
|
||||
|
@ -413,6 +413,7 @@ classified:
|
||||
metadata:
|
||||
dirs:
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses
|
||||
docs: []
|
||||
files:
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/AUTHORS
|
||||
@ -422,8 +423,8 @@ classified:
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/entry_points.txt
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/top_level.txt
|
||||
licenses:
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/LICENSE
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/LICENSE.python
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses/LICENSE
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses/LICENSE.python
|
||||
lang:
|
||||
django:
|
||||
af:
|
||||
@ -7766,6 +7767,7 @@ dumped:
|
||||
- - django
|
||||
- django
|
||||
- - '%dir /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info'
|
||||
- '%dir /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses'
|
||||
- '%dir /usr/lib/python3.7/site-packages/django'
|
||||
- '%dir /usr/lib/python3.7/site-packages/django/__pycache__'
|
||||
- '%dir /usr/lib/python3.7/site-packages/django/apps'
|
||||
@ -11349,8 +11351,8 @@ dumped:
|
||||
- '%lang(zh) /usr/lib/python3.7/site-packages/django/contrib/sessions/locale/zh_Hant/LC_MESSAGES/django.mo'
|
||||
- '%lang(zh) /usr/lib/python3.7/site-packages/django/contrib/sites/locale/zh_Hans/LC_MESSAGES/django.mo'
|
||||
- '%lang(zh) /usr/lib/python3.7/site-packages/django/contrib/sites/locale/zh_Hant/LC_MESSAGES/django.mo'
|
||||
- '%license /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/LICENSE'
|
||||
- '%license /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/LICENSE.python'
|
||||
- '%license /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses/LICENSE'
|
||||
- '%license /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/licenses/LICENSE.python'
|
||||
- /usr/bin/django-admin
|
||||
- /usr/bin/django-admin.py
|
||||
- /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/AUTHORS
|
||||
@ -15456,8 +15458,8 @@ metadata:
|
||||
content: |
|
||||
Name: Django
|
||||
Version: 3.0.7
|
||||
License-File: LICENSE
|
||||
License-File: LICENSE.python
|
||||
License-File: licenses/LICENSE
|
||||
License-File: licenses/LICENSE.python
|
||||
Whatever: False data
|
||||
|
||||
records:
|
||||
@ -15751,8 +15753,8 @@ records:
|
||||
../../../bin/django-admin.py,sha256=OOv0QKYqhDD2O4X3HQx3gFFQ-CC7hSLnWuzZnQXeiiA,115
|
||||
Django-3.0.7.dist-info/AUTHORS,sha256=cV29hNQ1SpKhTmZuPff3LWHyQ7mHNBWP7_0JufEUHbs,36806
|
||||
Django-3.0.7.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Django-3.0.7.dist-info/LICENSE,sha256=uEZBXRtRTpwd_xSiLeuQbXlLxUbKYSn5UKGM0JHipmk,1552
|
||||
Django-3.0.7.dist-info/LICENSE.python,sha256=Z-Pr3SuMPxOcaosqZSgr_NAjh2cFRcFyPZjP7nMeQrQ,13231
|
||||
Django-3.0.7.dist-info/licenses/LICENSE,sha256=uEZBXRtRTpwd_xSiLeuQbXlLxUbKYSn5UKGM0JHipmk,1552
|
||||
Django-3.0.7.dist-info/licenses/LICENSE.python,sha256=Z-Pr3SuMPxOcaosqZSgr_NAjh2cFRcFyPZjP7nMeQrQ,13231
|
||||
Django-3.0.7.dist-info/METADATA,sha256=0ZU0N0E-CHKarXMLp4oOYf7EMUHR8eJ79f2yqw2NwoM,3574
|
||||
Django-3.0.7.dist-info/RECORD,,
|
||||
Django-3.0.7.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
|
||||
|
62
tests/python-userpath.spec
Normal file
62
tests/python-userpath.spec
Normal file
@ -0,0 +1,62 @@
|
||||
Name: python-userpath
|
||||
Version: 1.8.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Cross-platform tool for adding locations to the user PATH
|
||||
License: MIT
|
||||
URL: https://github.com/ofek/userpath
|
||||
Source: %{pypi_source userpath}
|
||||
BuildArch: noarch
|
||||
BuildRequires: python3-devel
|
||||
|
||||
# Manually BuildRequire the runtime dependencies until we have a solution
|
||||
# for build backends without prepare_metadata_for_build_wheel():
|
||||
BuildRequires: python3dist(click)
|
||||
|
||||
%description
|
||||
This package uses hatchling as build backend.
|
||||
This package is tested because:
|
||||
|
||||
- the prepare_metadata_for_build_wheel hook does not exist
|
||||
https://github.com/ofek/hatch/issues/128
|
||||
- the licenses are stored in a dist-info subdirectory
|
||||
https://bugzilla.redhat.com/1985340
|
||||
(as of hatchling 0.22.0, not yet marked as License-File)
|
||||
|
||||
|
||||
%package -n python3-userpath
|
||||
Summary: %{summary}
|
||||
|
||||
%description -n python3-userpath
|
||||
...
|
||||
|
||||
|
||||
%if 0%{?fedora} > 35
|
||||
# On Fedora 35 or EPEL, we don't have hatchling yet, so this entire spec file builds nothing
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n userpath-%{version}
|
||||
sed -Ei '/^(coverage)$/d' requirements-dev.txt
|
||||
|
||||
|
||||
%generate_buildrequires
|
||||
# Cannot use -r (the default) with hatchling, must use -R
|
||||
%pyproject_buildrequires requirements-dev.txt -R
|
||||
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%pyproject_save_files userpath
|
||||
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
|
||||
%files -n python3-userpath -f %{pyproject_files}
|
||||
%{_bindir}/userpath
|
||||
|
||||
%endif
|
@ -79,6 +79,9 @@
|
||||
- getmac:
|
||||
dir: .
|
||||
run: ./mocktest.sh python-getmac
|
||||
- userpath:
|
||||
dir: .
|
||||
run: ./mocktest.sh python-userpath
|
||||
- double_install:
|
||||
dir: .
|
||||
run: ./mocktest.sh double-install
|
||||
|
Loading…
Reference in New Issue
Block a user