Exemplo n.º 1
0
    def __init__(self, src_uri, dst_uri):
        # store uri and scheme
        self.src_uri = src_uri
        self.dst_uri = dst_uri
        self.src_scheme = get_scheme(src_uri)
        self.dst_scheme = get_scheme(dst_uri)

        # get the original error objects and find the error reason
        orig = sys.exc_info()
        self.reason = self._get_reason(str(orig[1]), self.src_uri,
                                       self.dst_uri, self.src_scheme,
                                       self.dst_scheme)

        # add the error reason to the message
        msg = "{} ({}: {})".format(orig[1], self.__class__.__name__,
                                   self.reason)

        # bypass the GFALOperationError init
        RetryException.__init__(self, msg=msg, orig=orig)
Exemplo n.º 2
0
 def prepare_input(tpl):
     # consider strings to be the base filename and use an identical source with no options
     if isinstance(tpl, six.string_types):
         tpl = (os.path.basename(tpl), tpl, "")
     path, src, opts = (tpl + ("", ""))[:3]
     path = self.postfix_file(path, postfix)
     if src and get_scheme(src) in ("file", None):
         src = self.provide_input(os.path.abspath(src), postfix, c.dir, render_variables)
         if not c.absolute_paths:
             src = os.path.basename(src)
             if src == path:
                 src = ""
     return (path, src, opts) if opts else (path, src)
Exemplo n.º 3
0
    def __init__(self, uri):
        # store uri and scheme
        self.uri = uri
        self.scheme = get_scheme(uri)

        # get the original error objects and find the error reason
        orig = sys.exc_info()
        self.reason = self._get_reason(str(orig[1]), self.uri, self.scheme)

        # add the error reason to the message
        msg = "{} ({}: {})".format(orig[1], self.__class__.__name__,
                                   self.reason)

        super(GFALOperationError, self).__init__(msg=msg, orig=orig)
Exemplo n.º 4
0
 def _unscheme(self, path):
     return remove_scheme(path) if get_scheme(path) == "file" else path
Exemplo n.º 5
0
 def abspath(self, path):
     # due to the dynamic definition of remote bases, path is supposed to be already absolute
     # just handle leading and trailing slashes when there is not scheme
     return ("/" + path.strip("/")) if not get_scheme(path) else path
Exemplo n.º 6
0
 def is_local(self, path):
     return get_scheme(path) == "file"
Exemplo n.º 7
0
Arquivo: base.py Projeto: riga/law
 def is_remote(self):
     return get_scheme(self.path) not in ("file", None)