diff --git a/dvc/cloud/base.py b/dvc/cloud/base.py index 20f352e98..8f2b3d02d 100644 --- a/dvc/cloud/base.py +++ b/dvc/cloud/base.py @@ -53,7 +53,7 @@ class DataCloudBase(object): if path: Logger.warn('Using obsoleted config format. Consider updating.') else: - path = re.match(Config.SECTION_REMOTE_URL_REGEX, url).group(2) + path = re.match(Config.SECTION_REMOTE_URL_REGEX, url).group('storagepath') return path diff --git a/dvc/cloud/data_cloud.py b/dvc/cloud/data_cloud.py index ded861a63..5770f75a8 100644 --- a/dvc/cloud/data_cloud.py +++ b/dvc/cloud/data_cloud.py @@ -1,10 +1,4 @@ import re - -try: - from urlparse import urlparse -except ImportError: - from urllib.parse import urlparse - from multiprocessing.pool import ThreadPool from dvc.cloud.instance_manager import CloudSettings @@ -32,7 +26,7 @@ class DataCloud(object): SCHEME_MAP = { 's3' : 'aws', 'gs' : 'gcp', - '' : 'local', + None : 'local', } def __init__(self, cache, config): @@ -58,7 +52,11 @@ class DataCloud(object): raise ConfigError("Can't find remote section '{}' in config".format(section)) url = cloud_config[Config.SECTION_REMOTE_URL] - scheme = urlparse(url).scheme + res = re.match(Config.SECTION_REMOTE_URL_REGEX, url) + if not res: + raise ConfigError("Unknown format of url '{}'".format(url)) + + scheme = res.group('scheme') cloud_type = self.SCHEME_MAP.get(scheme, None) if not cloud_type: raise ConfigError("Unsupported scheme '{}' in '{}'".format(scheme, url)) diff --git a/dvc/config.py b/dvc/config.py index 8b9b222bb..99b8bdf96 100644 --- a/dvc/config.py +++ b/dvc/config.py @@ -69,7 +69,7 @@ class Config(object): SECTION_REMOTE_REGEX = r'^\s*remote\s*"(.*)"\s*$' SECTION_REMOTE_FMT = 'remote "{}"' SECTION_REMOTE_URL = 'url' - SECTION_REMOTE_URL_REGEX = r'^\s*(s3://|gs://|/)?(.*)\s*$' + SECTION_REMOTE_URL_REGEX = r'^\s*(((?Ps3|gs|..+):/*)|/*|.\\*)?(?P.*)\s*$' SECTION_REMOTE_SCHEMA = { SECTION_REMOTE_URL: schema.Regex(SECTION_REMOTE_URL_REGEX), schema.Optional(SECTION_AWS_REGION): str,