def pull(self): if common.isurl(self.source): self.download() else: shutil.copy2(self.source, self.source_dir) self.provision(self.source_dir)
def _get_source_type_from_uri(source, ignore_errors=False): # noqa: C901 source_type = '' if source.startswith('bzr:') or source.startswith('lp:'): source_type = 'bzr' elif source.startswith('git:') or source.startswith('git@') or \ source.endswith('.git'): source_type = 'git' elif source.startswith('svn:'): source_type = 'subversion' elif _tar_type_regex.match(source): source_type = 'tar' elif source.endswith('.zip'): source_type = 'zip' elif source.endswith('deb'): source_type = 'deb' elif source.endswith('rpm'): source_type = 'rpm' elif source.endswith('7z'): source_type = '7z' elif common.isurl(source) and not ignore_errors: raise ValueError('no handler to manage source ({})'.format(source)) elif not os.path.isdir(source) and not ignore_errors: raise ValueError('local source ({}) is not a directory'.format(source)) return source_type
def _get_source_type_from_uri(source, ignore_errors=False): source_type = '' if source.startswith('bzr:') or source.startswith('lp:'): source_type = 'bzr' elif source.startswith('git:') or source.startswith('git@') or \ source.endswith('.git'): source_type = 'git' elif _tar_type_regex.match(source): source_type = 'tar' elif common.isurl(source) and not ignore_errors: raise ValueError('no handler to manage source') elif not os.path.isdir(source) and not ignore_errors: raise ValueError('local source is not a directory') return source_type
def test_isurl(self): self.assertTrue(common.isurl('git://')) self.assertTrue(common.isurl('bzr://')) self.assertFalse(common.isurl('./')) self.assertFalse(common.isurl('/foo')) self.assertFalse(common.isurl('/fo:o'))
def test_isurl(self): self.assertTrue(common.isurl("git://")) self.assertTrue(common.isurl("bzr://")) self.assertFalse(common.isurl("./")) self.assertFalse(common.isurl("/foo")) self.assertFalse(common.isurl("/fo:o"))
def test_isurl(self): self.assertTrue(common.isurl("git://")) self.assertTrue(common.isurl("bzr://")) self.assertFalse(common.isurl("./")) self.assertFalse(common.isurl("/foo")) self.assertFalse(common.isurl("/foo:o"))
def test_isurl(): assert common.isurl("git://") is True assert common.isurl("bzr://") is True assert common.isurl("./") is False assert common.isurl("/foo") is False assert common.isurl("/foo:o") is False