mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 23:10:42 +01:00
config: schema: support windows paths
Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
+1
-1
@@ -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*(((?P<scheme>s3|gs|..+):/*)|/*|.\\*)?(?P<storagepath>.*)\s*$'
|
||||
SECTION_REMOTE_SCHEMA = {
|
||||
SECTION_REMOTE_URL: schema.Regex(SECTION_REMOTE_URL_REGEX),
|
||||
schema.Optional(SECTION_AWS_REGION): str,
|
||||
|
||||
Reference in New Issue
Block a user