Skip to main content

Module spdx

Module spdx 

Source
Expand description

Vendored SPDX license-expression grammar + id check.

Validates the contract’s license field against a bundled SPDX id set so license validity is deterministic and offline (no network, no pip). A direct port of check-oss-release.py’s spdx_valid / _valid_license_id: a real grammar check, not a string match.

Grammar: expr := term ((AND|OR) term)* ; term := '(' expr ')' | id ['WITH' exception]. Operators are matched case-insensitively. Exception ids after WITH are accepted on shape (the exception list is not vendored).

Functions§

spdx_valid
Whether expr is a syntactically valid SPDX license expression whose license ids are all recognized.