diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 877615b..880ffa1 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -170,6 +170,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 * Thu Oct 16 2025 Miro Hrončok - 1.18.5-1 - %%pyproject_extras_subpkg: Only %%ghost the dist-info directory, not the content - That way, accidentally unpackaged files within are reported as errors +- %%pyproject_save_files: Also save top level typing stub files (.pyi) * Mon Sep 01 2025 Miro Hrončok - 1.18.4-1 - Don't exit from pyproject-srpm-macros implementation of %%pyproject_buildrequires diff --git a/pyproject_save_files.py b/pyproject_save_files.py index 7ae4193..dcc53e4 100644 --- a/pyproject_save_files.py +++ b/pyproject_save_files.py @@ -395,6 +395,9 @@ def classify_paths( # extension modules can have 2 suffixes name = BuildrootPath(path.stem).stem add_file_to_module(paths, name, "extension", "files", path) + elif path.suffix == ".pyi": + name = path.stem + add_file_to_module(paths, name, "stub", "files", path) elif path.suffix == ".py": name = path.stem # we add the .pyc files, but not top-level __pycache__ diff --git a/pyproject_save_files_test_data.yaml b/pyproject_save_files_test_data.yaml index a3dd24f..82d47ac 100644 --- a/pyproject_save_files_test_data.yaml +++ b/pyproject_save_files_test_data.yaml @@ -213,6 +213,10 @@ classified: - /usr/lib/python3.7/site-packages/__pycache__/tldr.cpython-37{,.opt-?}.pyc dirs: [] type: script + - files: + - /usr/lib/python3.7/site-packages/tldr.pyi + dirs: [] + type: stub other: files: - /usr/bin/tldr @@ -7572,6 +7576,7 @@ dumped: - /usr/lib/python3.7/site-packages/tldr-0.5.dist-info/WHEEL - /usr/lib/python3.7/site-packages/tldr-0.5.dist-info/top_level.txt - /usr/lib/python3.7/site-packages/tldr.py + - /usr/lib/python3.7/site-packages/tldr.pyi - /usr/share/man/man1/tldr* - - tldr - - mistune @@ -15665,6 +15670,7 @@ records: tldr-0.5.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92 tldr-0.5.dist-info/top_level.txt,sha256=xHSI9WD6Y-_hONbi2b_9RIn9oiO7RBGHU3A8geJq3mI,5 tldr.py,sha256=aJlA3tIz4QYYy8e7DZUhPyLCqTwnfFjA7Nubwm9bPe0,12779 + tldr.pyi,sha256=GxQ4ZGLPQObN92QW_Hb8IJPEuYINNn186FjrRovM09g,13 mistune: path: /usr/lib64/python3.7/site-packages/mistune-0.8.3.dist-info/RECORD diff --git a/test_RECORD b/test_RECORD index e917ce9..cfc31d7 100644 --- a/test_RECORD +++ b/test_RECORD @@ -9,3 +9,4 @@ tldr-0.5.dist-info/RECORD,, tldr-0.5.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92 tldr-0.5.dist-info/top_level.txt,sha256=xHSI9WD6Y-_hONbi2b_9RIn9oiO7RBGHU3A8geJq3mI,5 tldr.py,sha256=aJlA3tIz4QYYy8e7DZUhPyLCqTwnfFjA7Nubwm9bPe0,12779 +tldr.pyi,sha256=GxQ4ZGLPQObN92QW_Hb8IJPEuYINNn186FjrRovM09g,13 diff --git a/test_pyproject_save_files.py b/test_pyproject_save_files.py index 46aa230..5ee5893 100755 --- a/test_pyproject_save_files.py +++ b/test_pyproject_save_files.py @@ -103,6 +103,7 @@ def test_parse_record_tldr(): str(SITELIB / "tldr-0.5.dist-info/WHEEL"), str(SITELIB / "tldr-0.5.dist-info/top_level.txt"), str(SITELIB / "tldr.py"), + str(SITELIB / "tldr.pyi"), ] assert output == expected