Browse Source
When support for SPDX 2.3 was added, it effectively dropped support for SPDX 2.2, which in retrospect was a bad idea since SPDX 2.2 is the version that is the current ISO/IEC standard. This commit adds a `--spdx-version` option to the `west spdx` command so that users can generate SPDX 2.2 documents if they want. Default is 2.3 given that's effectively what shipped for a few releases now, including latest LTS. Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>pull/89372/merge
5 changed files with 68 additions and 18 deletions
@ -0,0 +1,20 @@
@@ -0,0 +1,20 @@
|
||||
# Copyright (c) 2025 The Linux Foundation |
||||
# |
||||
# SPDX-License-Identifier: Apache-2.0 |
||||
|
||||
from packaging.version import Version |
||||
|
||||
SPDX_VERSION_2_2 = Version("2.2") |
||||
SPDX_VERSION_2_3 = Version("2.3") |
||||
|
||||
SUPPORTED_SPDX_VERSIONS = [ |
||||
SPDX_VERSION_2_2, |
||||
SPDX_VERSION_2_3, |
||||
] |
||||
|
||||
|
||||
def parse(version_str): |
||||
v = Version(version_str) |
||||
if v not in SUPPORTED_SPDX_VERSIONS: |
||||
raise ValueError(f"Unsupported SPDX version: {version_str}") |
||||
return v |
Loading…
Reference in new issue