Skip to content

Commit

Permalink
Merge pull request #167 from fosslight/dev_license_split_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinWonjaePark authored Jul 15, 2024
2 parents 41d4083 + 711f0c4 commit 02f6ccf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/fosslight_source/_parsing_scancode_file_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
KEYWORD_DOWNLOAD_LOC = r'DownloadLocation\s*[\S]+'
KEYWORD_SCANCODE_UNKNOWN = "unknown-spdx"
SPDX_REPLACE_WORDS = ["(", ")"]
KEY_AND = "and"
KEY_OR = "or"
KEY_AND = r"(?<=\s)and(?=\s)"
KEY_OR = r"(?<=\s)or(?=\s)"


def get_error_from_header(header_item):
Expand Down Expand Up @@ -182,8 +182,7 @@ def split_spdx_expression(spdx_string):
license = []
for replace in SPDX_REPLACE_WORDS:
spdx_string = spdx_string.replace(replace, "")
spdx_string = spdx_string.replace(KEY_OR, KEY_AND)
license = spdx_string.split(KEY_AND)
license = re.split(KEY_AND + "|" + KEY_OR, spdx_string)
return license


Expand Down

0 comments on commit 02f6ccf

Please sign in to comment.