From 31994c8dcc6f91e76eb937d7316557592acac45c Mon Sep 17 00:00:00 2001 From: Justin Kim Date: Fri, 19 Jun 2026 21:15:18 +0900 Subject: [PATCH 1/2] chore(license): add SPDX identifiers to all source files PyreWire is dual-licensed (Apache-2.0 OR GPL-3.0-or-later) and declares this at the package level in pyproject.toml, but no source file carried a per-file SPDX tag. Add # SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later to every .py file under src/, tests/, examples/, scripts/ and setup.py (after the shebang where present), making the license machine-discoverable for REUSE/SPDX tooling and downstream redistribution. Add tests/test_spdx_headers.py as a contract test that fails the build if any source file is missing the tag or declares a different expression, so the headers cannot silently drift. --- examples/01_simple.py | 1 + examples/02_reachability.py | 1 + examples/03_bitwise.py | 1 + examples/04_hash_functions.py | 1 + examples/05_crc32_checksum.py | 1 + examples/06_timestamp_lww.py | 1 + examples/07_multi_source_analysis.py | 1 + examples/08_delta_queries.py | 1 + examples/10_recursive_under_update.py | 1 + examples/11_time_evolution.py | 1 + examples/12_batch_vs_session.py | 1 + examples/12_snapshot_vs_delta.py | 1 + examples/csv_adapter_reachability.py | 1 + examples/retraction_basics.py | 1 + scripts/bundle_libwirelog.py | 1 + scripts/ci/check_dynamic_link.py | 1 + scripts/ci/extract_changelog_section.py | 1 + setup.py | 1 + src/pyrewire/__init__.py | 1 + src/pyrewire/_core/__init__.py | 1 + src/pyrewire/_core/_libc.py | 1 + src/pyrewire/_core/callbacks.py | 1 + src/pyrewire/_core/errors.py | 1 + src/pyrewire/_core/intern.py | 1 + src/pyrewire/_core/stdcapture.py | 1 + src/pyrewire/_ffi/__init__.py | 1 + src/pyrewire/_ffi/_advanced.py | 1 + src/pyrewire/_ffi/_easy.py | 1 + src/pyrewire/_ffi/_enums.py | 1 + src/pyrewire/_ffi/_executor.py | 1 + src/pyrewire/_ffi/_io.py | 1 + src/pyrewire/_ffi/_ir.py | 1 + src/pyrewire/_ffi/_loader.py | 1 + src/pyrewire/_ffi/_parser.py | 1 + src/pyrewire/_ffi/_types.py | 1 + src/pyrewire/_ffi/_util.py | 1 + src/pyrewire/_lib/__init__.py | 1 + src/pyrewire/asyncio_session.py | 1 + src/pyrewire/batch.py | 1 + src/pyrewire/compound.py | 1 + src/pyrewire/helpers.py | 1 + src/pyrewire/io_adapter.py | 1 + src/pyrewire/ir.py | 1 + src/pyrewire/program.py | 1 + src/pyrewire/session.py | 1 + tests/__init__.py | 1 + tests/docs/test_api_stability_contract.py | 1 + tests/docs/test_doc_examples_executable.py | 1 + tests/docs/test_mkdocs_build.py | 1 + .../docs/test_release_candidate_checklist.py | 1 + tests/docs/test_semantics_executable.py | 1 + tests/docs/test_support_matrix.py | 1 + tests/docs/test_versioning_contract.py | 1 + tests/integration/__init__.py | 1 + tests/integration/test_examples.py | 1 + tests/integration/test_retraction_basics.py | 1 + tests/integration/test_wheel_install.py | 1 + tests/test_abi_smoke.py | 1 + tests/test_advanced_ffi.py | 1 + tests/test_async.py | 1 + tests/test_batch.py | 1 + tests/test_batch_loadfacts.py | 1 + tests/test_callbacks.py | 1 + tests/test_changelog_format.py | 1 + tests/test_check_dynamic_link.py | 1 + tests/test_ci_workflow.py | 1 + tests/test_compound.py | 1 + tests/test_dependabot_config.py | 1 + tests/test_easy_deltas.py | 1 + tests/test_easy_ffi.py | 1 + tests/test_easy_insert_sym.py | 1 + tests/test_easy_session.py | 1 + tests/test_easy_step_monkeypatched.py | 1 + tests/test_easy_step_snapshot.py | 1 + tests/test_errors.py | 1 + tests/test_executor_ffi.py | 1 + tests/test_extract_changelog_section.py | 1 + tests/test_ffi_types.py | 1 + tests/test_helpers.py | 1 + tests/test_install_test_workflow.py | 1 + tests/test_intern.py | 1 + tests/test_io_adapter.py | 1 + tests/test_io_ffi.py | 1 + tests/test_ir.py | 1 + tests/test_ir_ffi.py | 1 + tests/test_libc.py | 1 + tests/test_loader.py | 1 + tests/test_nightly_workflow.py | 1 + tests/test_numpy_batch.py | 1 + tests/test_parser_ffi.py | 1 + tests/test_pep561_packaging.py | 1 + tests/test_preview_inline_facts.py | 1 + tests/test_program.py | 1 + tests/test_program_facts.py | 1 + tests/test_program_relation_ir.py | 1 + tests/test_release_metadata.py | 1 + tests/test_release_workflow_yaml.py | 1 + tests/test_schema_for.py | 1 + tests/test_sdist_contents.py | 1 + tests/test_session_advanced.py | 1 + tests/test_snapshot_arrays.py | 1 + tests/test_spdx_headers.py | 57 +++++++++++++++++++ tests/test_stdcapture.py | 1 + tests/test_util.py | 1 + tests/test_wheels_config.py | 1 + 105 files changed, 161 insertions(+) create mode 100644 tests/test_spdx_headers.py diff --git a/examples/01_simple.py b/examples/01_simple.py index dc77aa1..f1f967c 100644 --- a/examples/01_simple.py +++ b/examples/01_simple.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/01-simple` to PyreWire. Inline EDB facts + a single recursive rule. Uses diff --git a/examples/02_reachability.py b/examples/02_reachability.py index 216546f..345676a 100644 --- a/examples/02_reachability.py +++ b/examples/02_reachability.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/02-graph-reachability` to PyreWire. Transitive closure over a directed graph encoded as inline `edge` diff --git a/examples/03_bitwise.py b/examples/03_bitwise.py index d3b7b7c..a555faf 100644 --- a/examples/03_bitwise.py +++ b/examples/03_bitwise.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/03-bitwise-operations` to PyreWire. Demonstrates wirelog's built-in bitwise functors: `band` / `bor` / diff --git a/examples/04_hash_functions.py b/examples/04_hash_functions.py index 21c2f9e..b3a616e 100644 --- a/examples/04_hash_functions.py +++ b/examples/04_hash_functions.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/04-hash-functions` to PyreWire. Demonstrates wirelog's built-in `hash()` functor for the three tasks diff --git a/examples/05_crc32_checksum.py b/examples/05_crc32_checksum.py index b2fa098..5574c12 100644 --- a/examples/05_crc32_checksum.py +++ b/examples/05_crc32_checksum.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/05-crc32-checksum` to PyreWire. Demonstrates wirelog's `crc32_ethernet()` built-in by validating frame diff --git a/examples/06_timestamp_lww.py b/examples/06_timestamp_lww.py index fdddc10..c3ebe86 100644 --- a/examples/06_timestamp_lww.py +++ b/examples/06_timestamp_lww.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/06-timestamp-lww` to PyreWire. Last-Writer-Wins via the `max()` aggregate: for each key, keep the diff --git a/examples/07_multi_source_analysis.py b/examples/07_multi_source_analysis.py index 34ad257..32d44de 100644 --- a/examples/07_multi_source_analysis.py +++ b/examples/07_multi_source_analysis.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/07-multi-source-analysis` to PyreWire. Two CRM sources (`src_a`, `src_b`) supply customer records. The diff --git a/examples/08_delta_queries.py b/examples/08_delta_queries.py index ca34759..1049cd7 100644 --- a/examples/08_delta_queries.py +++ b/examples/08_delta_queries.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/08-delta-queries` to PyreWire. Demonstrates wirelog's delta-callback pipeline through `EasySession.step`. diff --git a/examples/10_recursive_under_update.py b/examples/10_recursive_under_update.py index 5d8bb1d..5f772f5 100644 --- a/examples/10_recursive_under_update.py +++ b/examples/10_recursive_under_update.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/10-recursive-under-update` to PyreWire. Demonstrates that wirelog correctly maintains a RECURSIVE rule under diff --git a/examples/11_time_evolution.py b/examples/11_time_evolution.py index ae24abe..bf125dd 100644 --- a/examples/11_time_evolution.py +++ b/examples/11_time_evolution.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/11-time-evolution` to PyreWire. Each `EasySession.step()` is a discrete time epoch — the delta diff --git a/examples/12_batch_vs_session.py b/examples/12_batch_vs_session.py index 1bfacc9..12c333d 100644 --- a/examples/12_batch_vs_session.py +++ b/examples/12_batch_vs_session.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """PyreWire-flavoured port of the spirit of wirelog `examples/12-snapshot-vs-delta`. diff --git a/examples/12_snapshot_vs_delta.py b/examples/12_snapshot_vs_delta.py index f65a385..feea6a4 100644 --- a/examples/12_snapshot_vs_delta.py +++ b/examples/12_snapshot_vs_delta.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/12-snapshot-vs-delta` to PyreWire. Compares the two read paths exposed by `EasySession`: diff --git a/examples/csv_adapter_reachability.py b/examples/csv_adapter_reachability.py index 89e28cc..ab48bb6 100644 --- a/examples/csv_adapter_reachability.py +++ b/examples/csv_adapter_reachability.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Self-contained `.input` example backed by a Python IO adapter. The upstream wirelog examples often load EDB relations from CSV files. diff --git a/examples/retraction_basics.py b/examples/retraction_basics.py index cb1ca7e..bbf8855 100644 --- a/examples/retraction_basics.py +++ b/examples/retraction_basics.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Port of wirelog `examples/09-retraction-basics` to PyreWire. Demonstrates z-set retraction semantics through `EasySession.step`: diff --git a/scripts/bundle_libwirelog.py b/scripts/bundle_libwirelog.py index 732c6fe..bcb4196 100644 --- a/scripts/bundle_libwirelog.py +++ b/scripts/bundle_libwirelog.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Copy the built wirelog library into `src/pyrewire/_lib` before wheel build.""" from __future__ import annotations diff --git a/scripts/ci/check_dynamic_link.py b/scripts/ci/check_dynamic_link.py index f8a0092..844e681 100755 --- a/scripts/ci/check_dynamic_link.py +++ b/scripts/ci/check_dynamic_link.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Verify every PyreWire wheel ships libwirelog *dynamically* (#32). Run after the wheel build matrix from #30; takes wheel paths on the diff --git a/scripts/ci/extract_changelog_section.py b/scripts/ci/extract_changelog_section.py index 4d2526c..f85a549 100644 --- a/scripts/ci/extract_changelog_section.py +++ b/scripts/ci/extract_changelog_section.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Extract one released changelog section into a standalone notes file.""" from __future__ import annotations diff --git a/setup.py b/setup.py index 07cc9a6..1591700 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Build shim that forces a platform-specific wheel.""" from __future__ import annotations diff --git a/src/pyrewire/__init__.py b/src/pyrewire/__init__.py index 61c4ef2..b2da51a 100644 --- a/src/pyrewire/__init__.py +++ b/src/pyrewire/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """PyreWire - Python wrapper for wirelog declarative dataflow analysis.""" __version__ = "1.0.1" diff --git a/src/pyrewire/_core/__init__.py b/src/pyrewire/_core/__init__.py index 888a81b..3b1806a 100644 --- a/src/pyrewire/_core/__init__.py +++ b/src/pyrewire/_core/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Internal helpers shared across PyreWire's high-level wrappers. Like `pyrewire._ffi`, this package is private. Public symbols are diff --git a/src/pyrewire/_core/_libc.py b/src/pyrewire/_core/_libc.py index 74d8059..92cf3c2 100644 --- a/src/pyrewire/_core/_libc.py +++ b/src/pyrewire/_core/_libc.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Lazy, platform-aware libc `malloc`/`free` helper. Several FFI consumers (parser fact extraction, IR string accessor, IO diff --git a/src/pyrewire/_core/callbacks.py b/src/pyrewire/_core/callbacks.py index 2287d28..a431c0a 100644 --- a/src/pyrewire/_core/callbacks.py +++ b/src/pyrewire/_core/callbacks.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Process-wide registry of callback trampolines. wirelog invokes user callbacks from its own worker threads. Two diff --git a/src/pyrewire/_core/errors.py b/src/pyrewire/_core/errors.py index a446df8..01fe570 100644 --- a/src/pyrewire/_core/errors.py +++ b/src/pyrewire/_core/errors.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Typed exception hierarchy for wirelog error codes. Every wirelog C entry point that can fail returns `wirelog_error_t` diff --git a/src/pyrewire/_core/intern.py b/src/pyrewire/_core/intern.py index d095bd8..0bb74b2 100644 --- a/src/pyrewire/_core/intern.py +++ b/src/pyrewire/_core/intern.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Bidirectional `str` ↔ wirelog intern-id cache. wirelog represents every `STRING` column value as an `int64` id assigned diff --git a/src/pyrewire/_core/stdcapture.py b/src/pyrewire/_core/stdcapture.py index bf650d9..e751fe3 100644 --- a/src/pyrewire/_core/stdcapture.py +++ b/src/pyrewire/_core/stdcapture.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Capture C-level stdout (file descriptor 1) into a Python `BytesIO`. Several wirelog entry points (`wirelog_optimizer_debug`, diff --git a/src/pyrewire/_ffi/__init__.py b/src/pyrewire/_ffi/__init__.py index b25270b..3d1e727 100644 --- a/src/pyrewire/_ffi/__init__.py +++ b/src/pyrewire/_ffi/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Internal FFI layer for PyreWire. This package is private to PyreWire (note the leading underscore). User code diff --git a/src/pyrewire/_ffi/_advanced.py b/src/pyrewire/_ffi/_advanced.py index 5f6da59..903e05c 100644 --- a/src/pyrewire/_ffi/_advanced.py +++ b/src/pyrewire/_ffi/_advanced.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for the wirelog advanced session API (#20). Covers 8 entry points from `wirelog/wirelog-advanced.h`: diff --git a/src/pyrewire/_ffi/_easy.py b/src/pyrewire/_ffi/_easy.py index 9bc0b25..4bae202 100644 --- a/src/pyrewire/_ffi/_easy.py +++ b/src/pyrewire/_ffi/_easy.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for `wirelog_easy_*` (the easy facade). This module mirrors `wirelog/wirelog-easy.h` 1:1 — every function's diff --git a/src/pyrewire/_ffi/_enums.py b/src/pyrewire/_ffi/_enums.py index 0c3687c..5834287 100644 --- a/src/pyrewire/_ffi/_enums.py +++ b/src/pyrewire/_ffi/_enums.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Enums mirroring wirelog public C enums. Values match `wirelog/wirelog.h` and `wirelog/wirelog-types.h` byte-for-byte. diff --git a/src/pyrewire/_ffi/_executor.py b/src/pyrewire/_ffi/_executor.py index 665d6d6..ce0ef3c 100644 --- a/src/pyrewire/_ffi/_executor.py +++ b/src/pyrewire/_ffi/_executor.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for wirelog's batch-executor surface (#16). Covers: diff --git a/src/pyrewire/_ffi/_io.py b/src/pyrewire/_ffi/_io.py index 29d873c..202dae3 100644 --- a/src/pyrewire/_ffi/_io.py +++ b/src/pyrewire/_ffi/_io.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for wirelog's IO-adapter ABI (#26). Covers: diff --git a/src/pyrewire/_ffi/_ir.py b/src/pyrewire/_ffi/_ir.py index 4f96021..993276e 100644 --- a/src/pyrewire/_ffi/_ir.py +++ b/src/pyrewire/_ffi/_ir.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for wirelog's IR-inspection entry points. Six functions from `wirelog/wirelog-ir.h`: diff --git a/src/pyrewire/_ffi/_loader.py b/src/pyrewire/_ffi/_loader.py index 22da74a..374d3e2 100644 --- a/src/pyrewire/_ffi/_loader.py +++ b/src/pyrewire/_ffi/_loader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """libwirelog discovery, loading, and runtime version verification. PyreWire and wirelog version independently. PyreWire declares the oldest diff --git a/src/pyrewire/_ffi/_parser.py b/src/pyrewire/_ffi/_parser.py index a3dab58..4c7aef6 100644 --- a/src/pyrewire/_ffi/_parser.py +++ b/src/pyrewire/_ffi/_parser.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Raw ctypes bindings for wirelog's parser, program introspection, and optimizer / fact-loading entry points. diff --git a/src/pyrewire/_ffi/_types.py b/src/pyrewire/_ffi/_types.py index 8bc2a41..3c4b67d 100644 --- a/src/pyrewire/_ffi/_types.py +++ b/src/pyrewire/_ffi/_types.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """ctypes structures and callback function-pointer types mirroring wirelog's public C ABI. diff --git a/src/pyrewire/_ffi/_util.py b/src/pyrewire/_ffi/_util.py index 70acf31..1623219 100644 --- a/src/pyrewire/_ffi/_util.py +++ b/src/pyrewire/_ffi/_util.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Wrappers for wirelog utility entry points (version, error_string, config probes, enum-to-string converters). diff --git a/src/pyrewire/_lib/__init__.py b/src/pyrewire/_lib/__init__.py index bef5256..9896a89 100644 --- a/src/pyrewire/_lib/__init__.py +++ b/src/pyrewire/_lib/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Wheel-bundled shared libraries live in this package.""" from __future__ import annotations diff --git a/src/pyrewire/asyncio_session.py b/src/pyrewire/asyncio_session.py index 9bbcfab..129152b 100644 --- a/src/pyrewire/asyncio_session.py +++ b/src/pyrewire/asyncio_session.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Asyncio-friendly proxies around the synchronous wirelog session APIs (#29). wirelog sessions are not thread-safe; running every call from one diff --git a/src/pyrewire/batch.py b/src/pyrewire/batch.py index de99d9f..6e53695 100644 --- a/src/pyrewire/batch.py +++ b/src/pyrewire/batch.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """High-level batch pipeline: Program → optimize → evaluate → Result (#17 / #18). `BatchProgram` is the simplest way to compute the full IDB closure of a diff --git a/src/pyrewire/compound.py b/src/pyrewire/compound.py index 8435460..c373332 100644 --- a/src/pyrewire/compound.py +++ b/src/pyrewire/compound.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Session-local compound handles (#23). `wirelog_session_make_compound` and `wirelog_easy_make_compound` return diff --git a/src/pyrewire/helpers.py b/src/pyrewire/helpers.py index c390249..61a80ab 100644 --- a/src/pyrewire/helpers.py +++ b/src/pyrewire/helpers.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """User-facing helpers that mirror or replace unsafe wirelog C utilities. This module is **process-safe**: every helper degrades gracefully on diff --git a/src/pyrewire/io_adapter.py b/src/pyrewire/io_adapter.py index 7ea2faf..cbef07f 100644 --- a/src/pyrewire/io_adapter.py +++ b/src/pyrewire/io_adapter.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """`@register_adapter` decorator for wirelog IO adapters (#27). Lets Python classes serve as the source for `.input Rel(IO="scheme", …)` diff --git a/src/pyrewire/ir.py b/src/pyrewire/ir.py index 92efad2..4cf48dd 100644 --- a/src/pyrewire/ir.py +++ b/src/pyrewire/ir.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Lazy Python wrapper around a `wirelog_ir_node_t *` (#25). `IRNode` does not own the C pointer — the IR tree lives inside the diff --git a/src/pyrewire/program.py b/src/pyrewire/program.py index 8efe1e3..6e709df 100644 --- a/src/pyrewire/program.py +++ b/src/pyrewire/program.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """High-level wrapper around a parsed wirelog program. `Program` owns a `wirelog_program_t*` and exposes typed introspection: diff --git a/src/pyrewire/session.py b/src/pyrewire/session.py index 615e1bd..3565d35 100644 --- a/src/pyrewire/session.py +++ b/src/pyrewire/session.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """High-level session wrappers over wirelog's facade APIs. `EasySession` (#9) wraps `wirelog_easy_*`. `Session` (#21) wraps the diff --git a/tests/__init__.py b/tests/__init__.py index c012ad3..672b847 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1,2 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for PyreWire.""" diff --git a/tests/docs/test_api_stability_contract.py b/tests/docs/test_api_stability_contract.py index 7cd82ca..2df9c66 100644 --- a/tests/docs/test_api_stability_contract.py +++ b/tests/docs/test_api_stability_contract.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for the documented v1.0 public API policy.""" from __future__ import annotations diff --git a/tests/docs/test_doc_examples_executable.py b/tests/docs/test_doc_examples_executable.py index 6dc25ec..1c8ee48 100644 --- a/tests/docs/test_doc_examples_executable.py +++ b/tests/docs/test_doc_examples_executable.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: every Python code block in `README.md` and `docs/quickstart.md` must run cleanly (#122). diff --git a/tests/docs/test_mkdocs_build.py b/tests/docs/test_mkdocs_build.py index f3b7fc6..8b883b0 100644 --- a/tests/docs/test_mkdocs_build.py +++ b/tests/docs/test_mkdocs_build.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: `mkdocs build --strict` must succeed (#34). Strict mode fails on stale cross-references caused by renamed or diff --git a/tests/docs/test_release_candidate_checklist.py b/tests/docs/test_release_candidate_checklist.py index bff0f5b..8888ff1 100644 --- a/tests/docs/test_release_candidate_checklist.py +++ b/tests/docs/test_release_candidate_checklist.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for the v1.0.0 release candidate checklist.""" from __future__ import annotations diff --git a/tests/docs/test_semantics_executable.py b/tests/docs/test_semantics_executable.py index fa80e8b..8965805 100644 --- a/tests/docs/test_semantics_executable.py +++ b/tests/docs/test_semantics_executable.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: every Python code block in `docs/semantics/*.md` must run. Pages annotated with `# expected: ` are allowed to raise diff --git a/tests/docs/test_support_matrix.py b/tests/docs/test_support_matrix.py index a7dfb0b..ed6a518 100644 --- a/tests/docs/test_support_matrix.py +++ b/tests/docs/test_support_matrix.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for the documented v1.0 support matrix.""" from __future__ import annotations diff --git a/tests/docs/test_versioning_contract.py b/tests/docs/test_versioning_contract.py index 1ba2577..d835339 100644 --- a/tests/docs/test_versioning_contract.py +++ b/tests/docs/test_versioning_contract.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for the documented PyreWire/wirelog compatibility contract.""" from __future__ import annotations diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py index e69de29..17bf1ac 100644 --- a/tests/integration/__init__.py +++ b/tests/integration/__init__.py @@ -0,0 +1 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later diff --git a/tests/integration/test_examples.py b/tests/integration/test_examples.py index 2fbf33b..7a69c39 100644 --- a/tests/integration/test_examples.py +++ b/tests/integration/test_examples.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Run every ported example and assert the result is well-formed (#35). We don't pin specific row contents because some examples include diff --git a/tests/integration/test_retraction_basics.py b/tests/integration/test_retraction_basics.py index 1d90bc9..6b2925c 100644 --- a/tests/integration/test_retraction_basics.py +++ b/tests/integration/test_retraction_basics.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Integration test mirroring wirelog `examples/09-retraction-basics` (#12). Drives `EasySession.step()` through the three retraction phases: diff --git a/tests/integration/test_wheel_install.py b/tests/integration/test_wheel_install.py index ea90c43..414abef 100644 --- a/tests/integration/test_wheel_install.py +++ b/tests/integration/test_wheel_install.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Integration test against an installed PyreWire wheel (#33). Runs in the `install_test` job of `.github/workflows/wheels.yml` diff --git a/tests/test_abi_smoke.py b/tests/test_abi_smoke.py index 81cd5e2..fb12645 100644 --- a/tests/test_abi_smoke.py +++ b/tests/test_abi_smoke.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """ABI smoke test: every public wirelog symbol must resolve at runtime. The canonical manifest lives at `tests/data/wirelog_abi.txt`. When wirelog diff --git a/tests/test_advanced_ffi.py b/tests/test_advanced_ffi.py index 95d47ba..d04c08f 100644 --- a/tests/test_advanced_ffi.py +++ b/tests/test_advanced_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._advanced` (#20).""" from __future__ import annotations diff --git a/tests/test_async.py b/tests/test_async.py index b07ac3a..87749d8 100644 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.asyncio_session` (#29).""" from __future__ import annotations diff --git a/tests/test_batch.py b/tests/test_batch.py index 1afa90b..251b4c8 100644 --- a/tests/test_batch.py +++ b/tests/test_batch.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.batch.BatchProgram` and `Result` (#17 + #18).""" from __future__ import annotations diff --git a/tests/test_batch_loadfacts.py b/tests/test_batch_loadfacts.py index a315214..994a8fb 100644 --- a/tests/test_batch_loadfacts.py +++ b/tests/test_batch_loadfacts.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `BatchProgram.load_all_facts` / `load_input_files` / `optimizer_debug` (#19).""" diff --git a/tests/test_callbacks.py b/tests/test_callbacks.py index 7762432..46b3415 100644 --- a/tests/test_callbacks.py +++ b/tests/test_callbacks.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._core.callbacks`.""" from __future__ import annotations diff --git a/tests/test_changelog_format.py b/tests/test_changelog_format.py index 2992204..59b59a2 100644 --- a/tests/test_changelog_format.py +++ b/tests/test_changelog_format.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: `CHANGELOG.md` must stay in sync with the project version (#37). A release is "ready" when the topmost dated section in `CHANGELOG.md` diff --git a/tests/test_check_dynamic_link.py b/tests/test_check_dynamic_link.py index abf3ca6..3ca8bb3 100644 --- a/tests/test_check_dynamic_link.py +++ b/tests/test_check_dynamic_link.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `scripts/ci/check_dynamic_link.py` (#32).""" from __future__ import annotations diff --git a/tests/test_ci_workflow.py b/tests/test_ci_workflow.py index 7afce5e..e85435f 100644 --- a/tests/test_ci_workflow.py +++ b/tests/test_ci_workflow.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for the main CI workflow.""" from __future__ import annotations diff --git a/tests/test_compound.py b/tests/test_compound.py index e4eb9aa..4f01fd7 100644 --- a/tests/test_compound.py +++ b/tests/test_compound.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.compound` (#23).""" from __future__ import annotations diff --git a/tests/test_dependabot_config.py b/tests/test_dependabot_config.py index f9a6bd5..768ac30 100644 --- a/tests/test_dependabot_config.py +++ b/tests/test_dependabot_config.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression coverage for Dependabot configuration in this repository.""" from __future__ import annotations diff --git a/tests/test_easy_deltas.py b/tests/test_easy_deltas.py index b23ba04..a2814aa 100644 --- a/tests/test_easy_deltas.py +++ b/tests/test_easy_deltas.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Additional EasySession delta tests (originally from PR #71). PR #97 shipped `EasySession.step / snapshot / set_delta_callback` on a diff --git a/tests/test_easy_ffi.py b/tests/test_easy_ffi.py index 7b26eba..3a12bf2 100644 --- a/tests/test_easy_ffi.py +++ b/tests/test_easy_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Smoke tests for `pyrewire._ffi._easy` bindings. Verifies that the easy facade's 14 entry points are reachable and that diff --git a/tests/test_easy_insert_sym.py b/tests/test_easy_insert_sym.py index 8def0c8..9b7e3fc 100644 --- a/tests/test_easy_insert_sym.py +++ b/tests/test_easy_insert_sym.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `EasySession.insert_sym` / `remove_sym` (#44).""" from __future__ import annotations diff --git a/tests/test_easy_session.py b/tests/test_easy_session.py index a19a47a..bddafe9 100644 --- a/tests/test_easy_session.py +++ b/tests/test_easy_session.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `EasySession` lifecycle, intern, insert, remove (#9).""" from __future__ import annotations diff --git a/tests/test_easy_step_monkeypatched.py b/tests/test_easy_step_monkeypatched.py index 2fdd69c..b6bd160 100644 --- a/tests/test_easy_step_monkeypatched.py +++ b/tests/test_easy_step_monkeypatched.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Monkey-patched tests for `EasySession.step` / `snapshot` / `set_delta_callback` (#10 + #11). diff --git a/tests/test_easy_step_snapshot.py b/tests/test_easy_step_snapshot.py index d25e2c5..945d59c 100644 --- a/tests/test_easy_step_snapshot.py +++ b/tests/test_easy_step_snapshot.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `EasySession.step` / `set_delta_callback` / `snapshot` (#10 + #11). The delta-mode machinery requires the wirelog#852 recursive-aggregation diff --git a/tests/test_errors.py b/tests/test_errors.py index 166cc37..4c927c7 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._core.errors`.""" from __future__ import annotations diff --git a/tests/test_executor_ffi.py b/tests/test_executor_ffi.py index 92e2b57..a649406 100644 --- a/tests/test_executor_ffi.py +++ b/tests/test_executor_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._executor` bindings (#16).""" from __future__ import annotations diff --git a/tests/test_extract_changelog_section.py b/tests/test_extract_changelog_section.py index beff247..05212b4 100644 --- a/tests/test_extract_changelog_section.py +++ b/tests/test_extract_changelog_section.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later from __future__ import annotations import importlib.util diff --git a/tests/test_ffi_types.py b/tests/test_ffi_types.py index 61cfd2f..d694b3a 100644 --- a/tests/test_ffi_types.py +++ b/tests/test_ffi_types.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._enums` and `pyrewire._ffi._types`. Per project convention, tests should consume the public API only. These diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 95a3b0c..8c990f5 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.helpers` (#46).""" from __future__ import annotations diff --git a/tests/test_install_test_workflow.py b/tests/test_install_test_workflow.py index a0b397f..af1082d 100644 --- a/tests/test_install_test_workflow.py +++ b/tests/test_install_test_workflow.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: the `install_test` job in wheels.yml stays wired (#33).""" from __future__ import annotations diff --git a/tests/test_intern.py b/tests/test_intern.py index d6f4a9a..f38f50a 100644 --- a/tests/test_intern.py +++ b/tests/test_intern.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._core.intern`.""" from __future__ import annotations diff --git a/tests/test_io_adapter.py b/tests/test_io_adapter.py index 63691fc..f7f8b3e 100644 --- a/tests/test_io_adapter.py +++ b/tests/test_io_adapter.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.io_adapter` (#27).""" from __future__ import annotations diff --git a/tests/test_io_ffi.py b/tests/test_io_ffi.py index 6645060..ad3264c 100644 --- a/tests/test_io_ffi.py +++ b/tests/test_io_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._io` bindings (#26).""" from __future__ import annotations diff --git a/tests/test_ir.py b/tests/test_ir.py index 00b875e..6f899b9 100644 --- a/tests/test_ir.py +++ b/tests/test_ir.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.ir.IRNode` (#25). The acceptance criterion calls for walking a real IR tree, but no public diff --git a/tests/test_ir_ffi.py b/tests/test_ir_ffi.py index a1febcc..15ced57 100644 --- a/tests/test_ir_ffi.py +++ b/tests/test_ir_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._ir` bindings (#24).""" from __future__ import annotations diff --git a/tests/test_libc.py b/tests/test_libc.py index 3ef82da..a808405 100644 --- a/tests/test_libc.py +++ b/tests/test_libc.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._core._libc`.""" from __future__ import annotations diff --git a/tests/test_loader.py b/tests/test_loader.py index bf0c90f..a731c9f 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for the libwirelog loader. This test module is one of the two files allowed (by project convention) to diff --git a/tests/test_nightly_workflow.py b/tests/test_nightly_workflow.py index d5eb8f0..8040962 100644 --- a/tests/test_nightly_workflow.py +++ b/tests/test_nightly_workflow.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: `.github/workflows/nightly.yml` keeps required pieces (#52). The nightly job is the early-warning system for wirelog ABI drift, so diff --git a/tests/test_numpy_batch.py b/tests/test_numpy_batch.py index 9dd8b0a..2d1cc6e 100644 --- a/tests/test_numpy_batch.py +++ b/tests/test_numpy_batch.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `Session.insert_batch` / `remove_batch` (#22).""" from __future__ import annotations diff --git a/tests/test_parser_ffi.py b/tests/test_parser_ffi.py index 2d0c75e..1903f58 100644 --- a/tests/test_parser_ffi.py +++ b/tests/test_parser_ffi.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._parser` bindings.""" from __future__ import annotations diff --git a/tests/test_pep561_packaging.py b/tests/test_pep561_packaging.py index 24c3355..211bab8 100644 --- a/tests/test_pep561_packaging.py +++ b/tests/test_pep561_packaging.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression tests for the PEP 561 typing marker shipped in distributions.""" from __future__ import annotations diff --git a/tests/test_preview_inline_facts.py b/tests/test_preview_inline_facts.py index f3d2a69..40368ee 100644 --- a/tests/test_preview_inline_facts.py +++ b/tests/test_preview_inline_facts.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `preview_inline_facts` and `insert_with_dedupe` (#47).""" from __future__ import annotations diff --git a/tests/test_program.py b/tests/test_program.py index a25700e..3fda27b 100644 --- a/tests/test_program.py +++ b/tests/test_program.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.Program` and its dataclass companions.""" from __future__ import annotations diff --git a/tests/test_program_facts.py b/tests/test_program_facts.py index 11fe531..cbb9580 100644 --- a/tests/test_program_facts.py +++ b/tests/test_program_facts.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `Program.facts_raw` / `Program.facts` (issue #15).""" from __future__ import annotations diff --git a/tests/test_program_relation_ir.py b/tests/test_program_relation_ir.py index df7b4ff..1389415 100644 --- a/tests/test_program_relation_ir.py +++ b/tests/test_program_relation_ir.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `Program.relation_ir` (#49 / wirelog#860). `wirelog_program_get_relation_ir` is a post-wirelog#860 accessor. diff --git a/tests/test_release_metadata.py b/tests/test_release_metadata.py index e36a373..e9bba86 100644 --- a/tests/test_release_metadata.py +++ b/tests/test_release_metadata.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression tests for PyreWire release metadata (#121).""" from __future__ import annotations diff --git a/tests/test_release_workflow_yaml.py b/tests/test_release_workflow_yaml.py index f99dc22..d966098 100644 --- a/tests/test_release_workflow_yaml.py +++ b/tests/test_release_workflow_yaml.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: `.github/workflows/release.yml` keeps the required steps (#37). A release pipeline must: diff --git a/tests/test_schema_for.py b/tests/test_schema_for.py index 7703aa1..3d6c159 100644 --- a/tests/test_schema_for.py +++ b/tests/test_schema_for.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `EasySession._schema_for` and the schema cache (#43).""" from __future__ import annotations diff --git a/tests/test_sdist_contents.py b/tests/test_sdist_contents.py index 10a4c86..df0b1be 100644 --- a/tests/test_sdist_contents.py +++ b/tests/test_sdist_contents.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: PyreWire sdist must never ship a wirelog binary. The dual-license boundary requires that the wirelog shared library is diff --git a/tests/test_session_advanced.py b/tests/test_session_advanced.py index 0043310..5ebf52e 100644 --- a/tests/test_session_advanced.py +++ b/tests/test_session_advanced.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire.session.Session` (#21). The advanced API binds to wirelog's lower-level surface. Step/snapshot diff --git a/tests/test_snapshot_arrays.py b/tests/test_snapshot_arrays.py index 652a09a..3a4ecec 100644 --- a/tests/test_snapshot_arrays.py +++ b/tests/test_snapshot_arrays.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `Session.snapshot_arrays` (#28). `EasySession.snapshot_array` adds the same shape on the easy session diff --git a/tests/test_spdx_headers.py b/tests/test_spdx_headers.py new file mode 100644 index 0000000..204b26b --- /dev/null +++ b/tests/test_spdx_headers.py @@ -0,0 +1,57 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later +"""Every Python source file must carry an SPDX license identifier. + +PyreWire is dual-licensed (Apache-2.0 OR GPL-3.0-or-later); pyproject.toml +declares this at the package level, but per-file SPDX tags are what make the +license machine-discoverable (REUSE/SPDX tooling, downstream redistribution). +This contract test fails the build if any source file is missing the tag or +declares a different expression, so the headers cannot silently drift. +""" + +from __future__ import annotations + +from pathlib import Path + +import pytest + +SPDX_TAG = "SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later" + +_REPO_ROOT = Path(__file__).resolve().parent.parent + +# Source roots that ship or build the project. A filesystem walk from the repo +# root would also sweep build artifacts (build/, dist/, *.egg-info, .venv), so +# enumerate the source trees explicitly. +_SOURCE_ROOTS = ("src", "tests", "examples", "scripts") +_TOP_LEVEL_FILES = ("setup.py",) + + +def _python_sources() -> list[Path]: + files: list[Path] = [] + for root in _SOURCE_ROOTS: + files.extend((_REPO_ROOT / root).rglob("*.py")) + for name in _TOP_LEVEL_FILES: + path = _REPO_ROOT / name + if path.is_file(): + files.append(path) + return sorted(files) + + +def test_source_files_discovered(): + # Guard against the glob silently matching nothing (e.g. a moved tree), + # which would make the per-file test vacuously pass. + assert len(_python_sources()) >= 50 + + +@pytest.mark.parametrize( + "path", + _python_sources(), + ids=lambda p: str(p.relative_to(_REPO_ROOT)), +) +def test_file_has_spdx_identifier(path: Path): + # SPDX must appear in the header block (after an optional shebang), + # not buried somewhere in the body. + head = path.read_text(encoding="utf-8").splitlines()[:5] + assert any(SPDX_TAG in line for line in head), ( + f"{path.relative_to(_REPO_ROOT)} is missing the SPDX header " + f"'# {SPDX_TAG}'" + ) diff --git a/tests/test_stdcapture.py b/tests/test_stdcapture.py index ae0d334..431b7f0 100644 --- a/tests/test_stdcapture.py +++ b/tests/test_stdcapture.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._core.stdcapture.capture_c_stdout` (#19).""" from __future__ import annotations diff --git a/tests/test_util.py b/tests/test_util.py index 43d4235..afc9014 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Tests for `pyrewire._ffi._util`.""" from __future__ import annotations diff --git a/tests/test_wheels_config.py b/tests/test_wheels_config.py index 800c8f4..0087f91 100644 --- a/tests/test_wheels_config.py +++ b/tests/test_wheels_config.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: Apache-2.0 OR GPL-3.0-or-later """Regression: cibuildwheel matrix and supporting scripts stay wired (#30 + #31). The wheel build is what makes `pip install pyrewire` work without a From e32ef912a3177574078ebb1cd067ea9d9fcd686e Mon Sep 17 00:00:00 2001 From: Justin Kim Date: Fri, 19 Jun 2026 21:17:49 +0900 Subject: [PATCH 2/2] style: black-format SPDX header test --- tests/test_spdx_headers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_spdx_headers.py b/tests/test_spdx_headers.py index 204b26b..d76b692 100644 --- a/tests/test_spdx_headers.py +++ b/tests/test_spdx_headers.py @@ -52,6 +52,5 @@ def test_file_has_spdx_identifier(path: Path): # not buried somewhere in the body. head = path.read_text(encoding="utf-8").splitlines()[:5] assert any(SPDX_TAG in line for line in head), ( - f"{path.relative_to(_REPO_ROOT)} is missing the SPDX header " - f"'# {SPDX_TAG}'" + f"{path.relative_to(_REPO_ROOT)} is missing the SPDX header " f"'# {SPDX_TAG}'" )