aboutsummaryrefslogtreecommitdiff
path: root/pym
diff options
context:
space:
mode:
authorvolpino <fox91@anche.no>2012-07-25 10:44:15 +0200
committerCorentin Chary <corentin.chary@gmail.com>2012-07-25 16:53:17 +0200
commit112313ab7f9b5e7230cbf4c867c5b8a89604ac44 (patch)
tree5ef20601059ee25f6ad33a2eda95654fef1d7053 /pym
parenteuscanwww: Removing useless stuff while creating watch tag (diff)
downloadeuscan-112313ab7f9b5e7230cbf4c867c5b8a89604ac44.tar.gz
euscan-112313ab7f9b5e7230cbf4c867c5b8a89604ac44.tar.bz2
euscan-112313ab7f9b5e7230cbf4c867c5b8a89604ac44.zip
euscan: generic handler fixes
* urljoin was broken with dirs ("http://site.com/lol" joined with "wat" produces http://site.com/wat) * fixed _v regex, don't match what is not needed Signed-off-by: volpino <fox91@anche.no>
Diffstat (limited to 'pym')
-rw-r--r--pym/euscan/handlers/generic.py13
-rw-r--r--pym/euscan/helpers.py4
2 files changed, 12 insertions, 5 deletions
diff --git a/pym/euscan/handlers/generic.py b/pym/euscan/handlers/generic.py
index 831dfce..12c4a99 100644
--- a/pym/euscan/handlers/generic.py
+++ b/pym/euscan/handlers/generic.py
@@ -35,7 +35,10 @@ def scan_html(data, url, pattern):
match = re.match(pattern, href, re.I)
if match:
- results.append((".".join(match.groups()), match.group(0)))
+ results.append(
+ (".".join([x for x in match.groups() if x is not None]),
+ match.group(0))
+ )
return results
@@ -47,8 +50,10 @@ def scan_ftp(data, url, pattern):
line = line.replace("\n", "").replace("\r", "")
match = re.search(pattern, line, re.I)
if match:
- results.append((".".join(match.groups()), match.group(0)))
-
+ results.append(
+ (".".join([x for x in match.groups() if x is not None]),
+ match.group(0))
+ )
return results
@@ -88,6 +93,8 @@ def scan_directory_recursive(cp, ver, rev, url, steps, orig_url):
pv = helpers.gentoo_mangle_version(up_pv)
if helpers.version_filtered(cp, ver, pv):
continue
+ if not url.endswith("/"):
+ url = url + "/"
path = urljoin(url, path)
if not steps and path not in orig_url:
diff --git a/pym/euscan/helpers.py b/pym/euscan/helpers.py
index 6582393..ec721b7 100644
--- a/pym/euscan/helpers.py
+++ b/pym/euscan/helpers.py
@@ -30,8 +30,8 @@ VERSION_CMP_PACKAGE_QUIRKS = {
'sys-process/htop': htop_vercmp
}
-_v_end = '((-|_)(pre|p|beta|b|alpha|a|rc|r)\d*)'
-_v = r'((\d+)((\.\d+)*)([a-zA-Z]*?)(' + _v_end + '*))'
+_v_end = r'(?:(?:-|_)(?:pre|p|beta|b|alpha|a|rc|r)\d*)'
+_v = r'((?:\d+)(?:(?:\.\d+)*)(?:[a-zA-Z]*?)(?:' + _v_end + '*))'
# Stolen from g-pypi