Lines Matching +full:compile +full:- +full:time
3 # SPDX-License-Identifier: Apache-2.0
10 Converts a character to an SPDX-ID-safe character.
13 - c: character to test
14 Returns: c if it is SPDX-ID-safe (letter, number, '-' or '.');
15 '-' otherwise
17 if c.isalpha() or c.isdigit() or c == "-" or c == ".":
19 return "-"
24 Converts a filename or other string to only SPDX-ID-safe characters.
30 - s: string to be converted.
31 Returns: string with all non-safe characters replaced with dashes.
41 - filenameOnly: filename only (directories omitted) seeking ID.
42 - timesSeen: dict of all filename-only to number of times seen.
47 spdxID = f"SPDXRef-File-{converted}"
53 spdxID += f"-{filenameTimesSeen}"
55 # first time seeing this filename
56 # edge case: if the filename itself ends in "-{number}", then we
57 # need to add a "-1" to it, so that we don't end up overlapping
58 # with an appended number from a similarly-named file.
59 p = re.compile(r"-\d+$")
61 spdxID += "-1"