Include git in the list of valid schemas to determine whether a string is a url, then remove all custom is_url implementations.
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]> --- client/cmdparser.py | 8 ++------ client/shared/base_packages.py | 7 +------ client/shared/base_utils.py | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/client/cmdparser.py b/client/cmdparser.py index f69a200..b8e66a8 100644 --- a/client/cmdparser.py +++ b/client/cmdparser.py @@ -5,7 +5,7 @@ Autotest command parser """ import os, re, sys -from autotest.client import os_dep +from autotest.client import os_dep, utils from autotest.client.shared import global_config from autotest.client.shared import base_packages, packages @@ -77,10 +77,6 @@ class CommandParser(object): pipe.write(' %-50s %s\n' % (text, desc)) - def is_url(self, url): - """Return true if path looks like a URL""" - return url.startswith('http://') or url.startswith('git://') - def fetch(self, args): """ fetch a remote control file or packages @@ -90,7 +86,7 @@ class CommandParser(object): self.help() url = args.pop(0) - if not self.is_url(url): + if not utils.is_url(url): print "Not a remote url, nothing to fetch (%s)" % url self.help() diff --git a/client/shared/base_packages.py b/client/shared/base_packages.py index df770cc..49c889e 100644 --- a/client/shared/base_packages.py +++ b/client/shared/base_packages.py @@ -965,11 +965,6 @@ class BasePackageManager(object): return name, pkg_type - def is_url(self, url): - """Return true if path looks like a URL""" - return url.startswith('http://') - - def get_package_name(self, url, pkg_type): ''' Extract the group and test name for the url. This method is currently @@ -983,7 +978,7 @@ class BasePackageManager(object): def _get_package_name(self, url, regex): - if not self.is_url(url): + if not utils.is_url(url): if url.endswith('.tar.bz2'): testname = url.replace('.tar.bz2', '') testname = re.sub(r'(\d*)\.', '', testname) diff --git a/client/shared/base_utils.py b/client/shared/base_utils.py index 8c23c8e..ccab35f 100644 --- a/client/shared/base_utils.py +++ b/client/shared/base_utils.py @@ -650,7 +650,7 @@ def is_url(path): """Return true if path looks like a URL""" # for now, just handle http and ftp url_parts = urlparse.urlparse(path) - return (url_parts[0] in ('http', 'ftp')) + return (url_parts[0] in ('http', 'ftp', 'git')) def urlopen(url, data=None, timeout=5): -- 1.7.10.4 _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
