Fix invalid backslash characters
* https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
parent
d48699e5fd
commit
c0be0e0b67
@ -119,11 +119,11 @@ def get_deb_url(name):
|
|||||||
content = opened.read()
|
content = opened.read()
|
||||||
|
|
||||||
for link in BeautifulSoup(content, parseOnlyThese=SoupStrainer("a")):
|
for link in BeautifulSoup(content, parseOnlyThese=SoupStrainer("a")):
|
||||||
if re.match("[^\s]+\.debian\.tar\.(?:gz|bz2)", link.text):
|
if re.match(r"[^\s]+\.debian\.tar\.(?:gz|bz2)", link.text):
|
||||||
deb_url = link["href"]
|
deb_url = link["href"]
|
||||||
deb_type = "source"
|
deb_type = "source"
|
||||||
break
|
break
|
||||||
if re.match("[^\s]+\.diff\.gz", link.text):
|
if re.match(r"[^\s]+\.diff\.gz", link.text):
|
||||||
deb_url = link["href"]
|
deb_url = link["href"]
|
||||||
deb_type = "diff"
|
deb_type = "diff"
|
||||||
break
|
break
|
||||||
@ -157,7 +157,7 @@ def patch_metadata(package, watch_data, diff=False):
|
|||||||
for watch_line in watch_data.split("\n"): # there can be multiple lines
|
for watch_line in watch_data.split("\n"): # there can be multiple lines
|
||||||
watch_line = " ".join(watch_line.split()) # remove extra spaces and \n
|
watch_line = " ".join(watch_line.split()) # remove extra spaces and \n
|
||||||
|
|
||||||
version_parse = re.match("version=(\d+?)", watch_line)
|
version_parse = re.match(r"version=(\d+?)", watch_line)
|
||||||
if version_parse:
|
if version_parse:
|
||||||
version = version_parse.group(1)
|
version = version_parse.group(1)
|
||||||
continue
|
continue
|
||||||
|
@ -74,13 +74,13 @@ BRUTEFORCE_BLACKLIST_URLS = [
|
|||||||
ROBOTS_TXT_BLACKLIST_DOMAINS = [
|
ROBOTS_TXT_BLACKLIST_DOMAINS = [
|
||||||
"(.*)sourceforge(.*)",
|
"(.*)sourceforge(.*)",
|
||||||
"(.*)github.com",
|
"(.*)github.com",
|
||||||
"(.*)qt\.nokia\.com(.*)",
|
r"(.*)qt\.nokia\.com(.*)",
|
||||||
"(.*)chromium\.org(.*)",
|
r"(.*)chromium\.org(.*)",
|
||||||
"(.*)nodejs\.org(.*)",
|
r"(.*)nodejs\.org(.*)",
|
||||||
"(.*)download\.mono-project\.com(.*)",
|
r"(.*)download\.mono-project\.com(.*)",
|
||||||
"(.*)fedorahosted\.org(.*)",
|
r"(.*)fedorahosted\.org(.*)",
|
||||||
"(.*)download\.tuxfamily\.org(.*)",
|
r"(.*)download\.tuxfamily\.org(.*)",
|
||||||
"(.*)festvox\.org(.*)",
|
r"(.*)festvox\.org(.*)",
|
||||||
]
|
]
|
||||||
|
|
||||||
from euscan.out import EuscanOutput # noqa: E402
|
from euscan.out import EuscanOutput # noqa: E402
|
||||||
|
@ -122,7 +122,7 @@ def scan_directory_recursive(cp, ver, rev, url, steps, orig_url, options):
|
|||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
if re.search(b"<\s*a\s+[^>]*href", data, re.I):
|
if re.search(rb"<\s*a\s+[^>]*href", data, re.I):
|
||||||
results.extend(scan_html(data, url, pattern))
|
results.extend(scan_html(data, url, pattern))
|
||||||
elif url.startswith("ftp://"):
|
elif url.startswith("ftp://"):
|
||||||
results.extend(scan_ftp(data, url, pattern))
|
results.extend(scan_ftp(data, url, pattern))
|
||||||
|
@ -20,7 +20,7 @@ def can_handle(pkg, url=None):
|
|||||||
|
|
||||||
|
|
||||||
def guess_package_and_channel(cp, url):
|
def guess_package_and_channel(cp, url):
|
||||||
match = re.search("http://(.*)\.php\.net/get/(.*)-(.*).tgz", url)
|
match = re.search(r"http://(.*)\.php\.net/get/(.*)-(.*).tgz", url)
|
||||||
|
|
||||||
if match:
|
if match:
|
||||||
host = match.group(1)
|
host = match.group(1)
|
||||||
|
@ -19,7 +19,7 @@ def can_handle(pkg, url=None):
|
|||||||
|
|
||||||
|
|
||||||
def guess_package(cp, url):
|
def guess_package(cp, url):
|
||||||
match = re.search("mirror://pypi/\w+/(.*)/.*", url)
|
match = re.search(r"mirror://pypi/\w+/(.*)/.*", url)
|
||||||
if match:
|
if match:
|
||||||
return match.group(1)
|
return match.group(1)
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ def can_handle(*args):
|
|||||||
|
|
||||||
|
|
||||||
def handle_directory_patterns(base, file_pattern):
|
def handle_directory_patterns(base, file_pattern):
|
||||||
"""
|
r"""
|
||||||
Directory pattern matching
|
Directory pattern matching
|
||||||
e.g.: base: ftp://ftp.nessus.org/pub/nessus/nessus-([\d\.]+)/src/
|
e.g.: base: ftp://ftp.nessus.org/pub/nessus/nessus-([\d\.]+)/src/
|
||||||
file_pattern: nessus-core-([\d\.]+)\.tar\.gz
|
file_pattern: nessus-core-([\d\.]+)\.tar\.gz
|
||||||
|
@ -383,9 +383,9 @@ def regex_from_template(template):
|
|||||||
regexp = re.escape(template)
|
regexp = re.escape(template)
|
||||||
|
|
||||||
# Unescape specific stuff
|
# Unescape specific stuff
|
||||||
regexp = regexp.replace("\$\{", "${")
|
regexp = regexp.replace(r"\$\{", "${")
|
||||||
regexp = regexp.replace("\}", "}")
|
regexp = regexp.replace(r"\}", "}")
|
||||||
regexp = regexp.replace("}\.$", "}.$")
|
regexp = regexp.replace(r"}\.$", "}.$")
|
||||||
|
|
||||||
# Replace ${\d+}
|
# Replace ${\d+}
|
||||||
# regexp = regexp.replace('${0}', r'([\d]+?)')
|
# regexp = regexp.replace('${0}', r'([\d]+?)')
|
||||||
|
@ -74,7 +74,7 @@ def progress_bar():
|
|||||||
|
|
||||||
def clean_colors(string):
|
def clean_colors(string):
|
||||||
if isinstance(string, str):
|
if isinstance(string, str):
|
||||||
string = re.sub("\033\[[0-9;]+m", "", string)
|
string = re.sub(r"\033\[[0-9;]+m", "", string)
|
||||||
string = re.sub(r"\\u001b\[[0-9;]+m", "", string)
|
string = re.sub(r"\\u001b\[[0-9;]+m", "", string)
|
||||||
string = re.sub(r"\x1b\[[0-9;]+m", "", string)
|
string = re.sub(r"\x1b\[[0-9;]+m", "", string)
|
||||||
return string
|
return string
|
||||||
|
@ -22,7 +22,7 @@ def get_version_type(version):
|
|||||||
if "9999" in version or "99999999" in version:
|
if "9999" in version or "99999999" in version:
|
||||||
return "live"
|
return "live"
|
||||||
|
|
||||||
for token in re.findall("[\._-]([a-zA-Z]+)", version):
|
for token in re.findall(r"[\._-]([a-zA-Z]+)", version):
|
||||||
if token in gentoo_types:
|
if token in gentoo_types:
|
||||||
types.append(token)
|
types.append(token)
|
||||||
if types:
|
if types:
|
||||||
|
Loading…
Reference in New Issue
Block a user