@@ -59,8 +59,11 @@ def __init__(self, msg):
5959
6060
6161def load (d ):
62- """Parses a python object from a JSON string. Every Object which should be loaded needs a constuctor that doesn't need any Arguments.
63- Arguments: Dict object; the module which contains the class, the parsed object is instance of.
62+ """
63+ Parses a python object from a JSON string.
64+ Every Object which should be loaded needs a constuctor that doesn't need any Arguments.
65+ Arguments: Dict object; the module which contains the class,
66+ the parsed object is instance of.
6467 """
6568
6669 def _load (d1 ):
@@ -610,9 +613,11 @@ def version_compare(
610613 return False
611614 if mae :
612615 if VersionInfo .is_valid (compare_ver ) and VersionInfo .is_valid (mae ):
613- cmp_value = VersionInfo .parse (compare_ver , optional_minor_and_patch = True ).compare (mae )
616+ cmp_value = VersionInfo .parse (
617+ compare_ver , optional_minor_and_patch = True
618+ ).compare (mae )
614619 return cmp_value < 0
615- elif "." not in compare_ver and "." not in mae :
620+ if "." not in compare_ver and "." not in mae :
616621 compare_ver = re .split (r"[+~]" , compare_ver )[0 ]
617622 mae = re .split (r"[+~]" , mae )[0 ]
618623 exnum = list (filter (str .isdigit , compare_ver ))
@@ -651,8 +656,12 @@ def version_compare(
651656 # Perform semver match once we have all the required versions
652657 if compare_ver and min_version and max_version :
653658 if semver_compatible (compare_ver , min_version , max_version ):
654- min_value = VersionInfo .parse (compare_ver , optional_minor_and_patch = True ).compare (min_version )
655- max_value = VersionInfo .parse (compare_ver , optional_minor_and_patch = True ).compare (max_version )
659+ min_value = VersionInfo .parse (
660+ compare_ver , optional_minor_and_patch = True
661+ ).compare (min_version )
662+ max_value = VersionInfo .parse (
663+ compare_ver , optional_minor_and_patch = True
664+ ).compare (max_version )
656665 min_check = min_value > 0 if is_min_exclude else min_value >= 0
657666 max_check = max_value < 0 if is_max_exclude else max_value <= 0
658667 return min_check and max_check
@@ -1099,7 +1108,11 @@ def to_purl_vers(vendor: str, versions: list) -> str:
10991108 else :
11001109 vers_list .append (f">={ version } " )
11011110 if less_than and less_than != "*" and not less_than_or_equal :
1102- vers_list .append (f"<{ less_than } " )
1111+ # Fix for #142
1112+ if version == "0.0.0" and check_hex (less_than ):
1113+ vers_list = [f"<{ less_than } " ]
1114+ else :
1115+ vers_list .append (f"<{ less_than } " )
11031116 if not less_than and less_than_or_equal :
11041117 if less_than_or_equal == "*" :
11051118 vers_list .append ("*" )
@@ -1152,9 +1165,10 @@ def url_to_purl(url: str) -> dict | None:
11521165 url_obj = urlparse (f"https://{ git_repo_name } " )
11531166 # Fix for #112
11541167 pkg_type = "generic"
1155- hostname = url_obj .hostname
1156- if url_obj .hostname in ("github.com" , "gitlab.com" ):
1157- pkg_type = url_obj .hostname .removesuffix (".com" )
1168+ # Fix for #143
1169+ hostname = url_obj .hostname .removeprefix ("www." )
1170+ if hostname in ("github.com" , "gitlab.com" ):
1171+ pkg_type = hostname .removesuffix (".com" )
11581172 git_repo_name = url_obj .path
11591173 hostname = None
11601174 # Filter repo names without a path
0 commit comments