From: Roland Häder Date: Sat, 27 May 2023 09:59:06 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3706f39b2d2dccba312029812c95685f9e0ceb79;p=fba.git Continued: - also check for version numbers if no dot is in --- diff --git a/fba.py b/fba.py index bc972f3..2d8baa4 100644 --- a/fba.py +++ b/fba.py @@ -95,7 +95,7 @@ patterns = [ re.compile("^(?Pv|V{0,1})(\.{0,1})(?P0|[1-9]\d*)\.(?P0+|[1-9]\d*)(\.(?P0+|[1-9]\d*)(?:-(?P(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)?$"), # non-sematic, e.g. 1.2.3.4 re.compile("^(?Pv|V{0,1})(\.{0,1})(?P0|[1-9]\d*)\.(?P0+|[1-9]\d*)(\.(?P0+|[1-9]\d*)(\.(?P0|[1-9]\d*))?)$"), - # non-sematic, e.g. 2023-05 + # non-sematic, e.g. 2023-05[-dev] re.compile("^(?P[1-9]{1}[0-9]{3})\.(?P[0-9]{2})(-dev){0,1}$"), # non-semantic, e.g. abcdef0 re.compile("^[a-f0-9]{7}$"), @@ -103,7 +103,7 @@ patterns = [ def remove_version(software: str) -> str: # NOISY-DEBUG: print(f"DEBUG: software='{software}' - CALLED!") - if not "." in software: + if not "." in software and " " not in software: print(f"WARNING: software='{software}' does not contain a version number.") return software @@ -558,7 +558,7 @@ def fetch_generator_from_path(domain: str, path: str = "/") -> str: if type(software) is str and software == "": # NOISY-DEBUG: print(f"DEBUG: Corrected empty string to None for software of domain='{domain}'") software = None - elif type(software) is str and "." in software: + elif type(software) is str and ("." in software or " " in software): # NOISY-DEBUG: print(f"DEBUG: software='{software}' may contain a version number, domain='{domain}', removing it ...") software = remove_version(software) @@ -637,7 +637,7 @@ def determine_software(domain: str) -> str: if str(software) == "": # NOISY-DEBUG: print(f"DEBUG: software for '{domain}' was not detected, trying generator ...") software = fetch_generator_from_path(domain) - elif len(str(software)) > 0 and "." in software: + elif len(str(software)) > 0 and ("." in software or " " in software): # NOISY-DEBUG: print(f"DEBUG: software='{software}' may contain a version number, domain='{domain}', removing it ...") software = remove_version(software)