From fa49bf2efbcb01e9b80a592d24073e1afa6acd0c Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Wed, 3 Aug 2022 13:18:44 +0200 Subject: [PATCH] Don't fail %pyproject_save_files '*' if no modules are present Users invoking %pyproject_save_files with glob: '*' don't care about the files in the Python package, hence it shouldn't error when no modules are detected. There may be legitimate reasons to create a package without Python modules in it, hence we shouldn't be blocking this possibility. --- pyproject-rpm-macros.spec | 7 ++++-- pyproject_save_files.py | 6 +++++ pyproject_save_files_test_data.yaml | 37 +++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 1864315..4e493f7 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -10,8 +10,8 @@ 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.3.2 -Release: 2%{?dist} +Version: 1.3.3 +Release: 1%{?dist} # Macro files Source001: macros.pyproject @@ -127,6 +127,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Tue Aug 09 2022 Karolina Surma - 1.3.3-1 +- Don't fail %%pyproject_save_files '*' if no modules are detected + * Fri Jul 22 2022 Fedora Release Engineering - 1.3.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 4f9cb37..18925f1 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -485,6 +485,12 @@ def generate_file_list(paths_dict, module_globs, include_others=False): done_modules.add(name) done_globs.add(glob) + # Users using '*' don't care about the files in the package, so it's ok + # not to fail the build when no modules are detected + # There can be legitimate reasons to create a package without Python modules + if not modules and fnmatch.fnmatchcase("", glob): + done_globs.add(glob) + missed = module_globs - done_globs if missed: missed_text = ", ".join(sorted(missed)) diff --git a/pyproject_save_files_test_data.yaml b/pyproject_save_files_test_data.yaml index d4c2087..c6d2291 100644 --- a/pyproject_save_files_test_data.yaml +++ b/pyproject_save_files_test_data.yaml @@ -409,6 +409,22 @@ classified: other: files: - /usr/lib/python3.7/site-packages/zope.event-4.4-py3.7-nspkg.pth + comic2pdf: + metadata: + dirs: + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info + docs: [] + files: + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/METADATA + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/WHEEL + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/entry_points.txt + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/top_level.txt + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/zip-safe + licenses: [] + modules: [] + other: + files: + - /usr/bin/comic2pdf.py django: metadata: dirs: @@ -7764,6 +7780,16 @@ dumped: - zope.event - zope.event.classhandler - zope.event.tests +- - comic2pdf + - '*' + - - '%dir /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info' + - /usr/bin/comic2pdf.py + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/METADATA + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/WHEEL + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/entry_points.txt + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/top_level.txt + - /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/zip-safe + - [] - - django - django - - '%dir /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info' @@ -15745,6 +15771,17 @@ records: zope/event/classhandler.py,sha256=CEx6issKWSia0Wruob_jIQI2EfYX45krokoTHyVsJFQ,1816 zope/event/tests.py,sha256=bvEzvOmPoQETMqYiqsR9EeVsC8Dzy-HOclfpQFVjDhE,1871 + comic2pdf: + path: /usr/lib/python3.7/site-packages/comic2pdf-3.1.0.dist-info/RECORD + content: | + ../../../bin/comic2pdf.py,sha256=ad0XbWxj2fzn_oYi1h-usY8jsxAvfpYA1aaify1Ym88,3266 + comic2pdf-3.1.0.dist-info/METADATA,sha256=qMVNbSPY02NdWfGex5yWNxoK1d96ereES-XoKxshVEA,3195 + comic2pdf-3.1.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92 + comic2pdf-3.1.0.dist-info/entry_points.txt,sha256=uORK0FJD-i46W74x2mNHfloSPS4QElN3-Y0vKQZ7svw,46 + comic2pdf-3.1.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 + comic2pdf-3.1.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 + comic2pdf-3.1.0.dist-info/RECORD,, + django: path: /usr/lib/python3.7/site-packages/Django-3.0.7.dist-info/RECORD content: |