[oe-commits] [bitbake] 01/02: fetch2/wget.py: _check_latest_version_by_dir use group names

git at git.openembedded.org git at git.openembedded.org
Sat Mar 26 08:28:35 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit e8ea15eeb1857ed4bb6337836bd2fb1f5dbb1bdf
Author: Aníbal Limón <limon.anibal at gmail.com>
AuthorDate: Thu Mar 24 12:08:18 2016 -0600

    fetch2/wget.py: _check_latest_version_by_dir use group names
    
    Little improvement for reference tokens by names instead of index.
    
    Signed-off-by: Aníbal Limón <limon.anibal at gmail.com>
    Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/wget.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 202ed0b..ffae540 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -420,10 +420,10 @@ class Wget(FetchMethod):
         version_dir = ['', '', '']
         version = ['', '', '']
 
-        dirver_regex = re.compile("(\D*)((\d+[\.\-_])+(\d+))")
+        dirver_regex = re.compile("(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])+(\d+))")
         s = dirver_regex.search(dirver)
         if s:
-            version_dir[1] = s.group(2)
+            version_dir[1] = s.group('ver')
         else:
             version_dir[1] = dirver
 
@@ -438,9 +438,9 @@ class Wget(FetchMethod):
         for line in soup.find_all('a', href=True):
             s = dirver_regex.search(line['href'].strip("/"))
             if s:
-                version_dir_new = ['', s.group(2), '']
+                version_dir_new = ['', s.group('ver'), '']
                 if self._vercmp(version_dir, version_dir_new) <= 0:
-                    dirver_new = s.group(1) + s.group(2)
+                    dirver_new = s.group('pfx') + s.group('ver')
                     path = ud.path.replace(dirver, dirver_new, True) \
                         .split(package)[0]
                     uri = bb.fetch.encodeurl([ud.type, ud.host, path,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list