forked from spdx/tools-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnippet.py
More file actions
38 lines (34 loc) · 1.33 KB
/
Copy pathsnippet.py
File metadata and controls
38 lines (34 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# SPDX-FileCopyrightText: 2023 spdx contributors
#
# SPDX-License-Identifier: Apache-2.0
from spdx3.bump_from_spdx2.message import print_missing_conversion
from spdx3.model.creation_information import CreationInformation
from spdx3.model.software.snippet import Snippet
from spdx3.payload import Payload
from spdx.model.snippet import Snippet as Spdx2_Snippet
def bump_snippet(
spdx2_snippet: Spdx2_Snippet, payload: Payload, creation_information: CreationInformation, document_namespace: str
):
spdx_id = "#".join([document_namespace, spdx2_snippet.spdx_id])
print_missing_conversion("snippet.file_spdx_id", 0)
byte_range = spdx2_snippet.byte_range
line_range = spdx2_snippet.line_range
print_missing_conversion(
"snippet.concluded_license, snippet.license_info_in_snippet, snippet.license_comment,"
"snippet.copyright_text",
0,
"missing definitions for license profile",
)
comment = spdx2_snippet.comment
name = spdx2_snippet.name
print_missing_conversion("snippet.attribution_texts", 0, "missing definitions for license profile")
payload.add_element(
Snippet(
spdx_id=spdx_id,
creation_info=creation_information,
byte_range=byte_range,
line_range=line_range,
comment=comment,
name=name,
)
)