Пример #1
0
 def upload(self, src, dst):
     if isinstance(src, RemotePath):
         raise TypeError("src of upload cannot be %r" % (src,))
     if isinstance(dst, LocalPath):
         raise TypeError("dst of upload cannot be %r" % (dst,))
     if isinstance(dst, RemotePath) and dst.remote != self:
         raise TypeError("dst %r points to a different remote machine" % (dst,))
     return self._upload(src if isinstance(src, LocalPath) else LocalPath(src),
         dst if isinstance(dst, RemotePath) else self.path(dst))
Пример #2
0
 def path(self, *parts):
     """A factory for :class:`LocalPaths <plumbum.path.local.LocalPath>`.
     Usage: ``p = local.path("/usr", "lib", "python2.7")``
     """
     parts2 = [str(self.cwd)]
     for p in parts:
         if isinstance(p, RemotePath):
             raise TypeError("Cannot construct LocalPath from %r" % (p,))
         parts2.append(self.env.expanduser(str(p)))
     return LocalPath(os.path.join(*parts2))
Пример #3
0
 def upload(self, src, dst):
     if isinstance(src, RemotePath):
         raise TypeError(f"src of upload cannot be {src!r}")
     if isinstance(dst, LocalPath):
         raise TypeError(f"dst of upload cannot be {dst!r}")
     if isinstance(dst, RemotePath) and dst.remote != self:
         raise TypeError(f"dst {dst!r} points to a different remote machine")
     return self._upload(
         src if isinstance(src, LocalPath) else LocalPath(src),
         dst if isinstance(dst, RemotePath) else self.path(dst),
     )
Пример #4
0
 def download(self, src, dst):
     if isinstance(src, LocalPath):
         raise TypeError("src of download cannot be {!r}".format(src))
     if isinstance(src, RemotePath) and src.remote != self:
         raise TypeError(
             "src {!r} points to a different remote machine".format(src))
     if isinstance(dst, RemotePath):
         raise TypeError("dst of download cannot be {!r}".format(dst))
     return self._download(
         src if isinstance(src, RemotePath) else self.path(src),
         dst if isinstance(dst, LocalPath) else LocalPath(dst),
     )
Пример #5
0
def rel(path: LocalPath):
    return path.relative_to(local.path('.'))
Пример #6
0
 def _teardown(self, name: str):
     if LocalPath('gen/%s-dc.yml' % name).exists():
         self.tools_dc(name, 'down')
Пример #7
0
 def _collect_logs(self, name: str):
     if LocalPath('gen/%s-dc.yml' % name).exists():
         self.tools_dc('collect_logs', name,
                       self.artifacts / 'logs' / 'docker')