コード例 #1
0
ファイル: base_install.py プロジェクト: hshah19/anvil
    def download(self):
        """Download sources needed to build the component, if any."""
        target_dir = self.get_option('app_dir')
        download_cfg = utils.load_yaml(self._origins_fn).get(self.name, {})
        if not target_dir or not download_cfg:
            return []

        uri = download_cfg.pop('repo', None)
        if not uri:
            raise ValueError(
                ("Could not find repo uri for %r component from the %r "
                 "config file." % (self.name, self._origins_fn)))

        uris = [uri]
        utils.log_iterable(uris,
                           logger=LOG,
                           header="Downloading from %s uris" % (len(uris)))
        sh.mkdirslist(target_dir, tracewriter=self.tracewriter)
        # This is used to delete what is downloaded (done before
        # fetching to ensure its cleaned up even on download failures)
        self.tracewriter.download_happened(target_dir, uri)
        down.GitDownloader(uri, target_dir, **download_cfg).download()
        return uris
コード例 #2
0
 def test_constructor_sha1(self):
     d = downloader.GitDownloader(self._uri, self._dst, sha1=self._sha1)
     self.assertEqual(d._tag, None)
     self.assertEqual(d._sha1, self._sha1)
コード例 #3
0
 def test_constructor_float_tag(self):
     tag = 2013.2
     d = downloader.GitDownloader(self._uri, self._dst, tag=tag)
     self.assertEqual(d._tag, str(tag))
     self.assertEqual(d._sha1, None)
コード例 #4
0
 def test_constructor_string_tag(self):
     d = downloader.GitDownloader(self._uri, self._dst, tag=self._tag)
     self.assertEqual(d._tag, self._tag)
     self.assertEqual(d._sha1, None)
コード例 #5
0
 def test_constructor_branch(self):
     branch = 'stable/havana'
     d = downloader.GitDownloader(self._uri, self._dst, branch=branch)
     self.assertEqual(d._branch, branch)
     self.assertEqual(d._tag, None)
     self.assertEqual(d._sha1, None)