Ejemplo n.º 1
0
    def _bootstrap_ivy(self, bootstrap_jar_path):
        options = self._ivy_subsystem.get_options()
        if not os.path.exists(bootstrap_jar_path):
            with temporary_file() as bootstrap_jar:
                fetcher = Fetcher(get_buildroot())
                checksummer = fetcher.ChecksumListener(digest=hashlib.sha1())
                try:
                    logger.info('\nDownloading {}'.format(
                        options.bootstrap_jar_url))
                    # TODO: Capture the stdout of the fetcher, instead of letting it output
                    # to the console directly.
                    fetcher.download(
                        options.bootstrap_jar_url,
                        listener=fetcher.ProgressListener().wrap(checksummer),
                        path_or_fd=bootstrap_jar,
                        timeout_secs=options.bootstrap_fetch_timeout_secs)
                    logger.info('sha1: {}'.format(checksummer.checksum))
                    bootstrap_jar.close()
                    touch(bootstrap_jar_path)
                    shutil.move(bootstrap_jar.name, bootstrap_jar_path)
                except fetcher.Error as e:
                    raise self.Error(
                        'Problem fetching the ivy bootstrap jar! {}'.format(e))

        return Ivy(bootstrap_jar_path,
                   ivy_settings=options.bootstrap_ivy_settings
                   or options.ivy_settings,
                   ivy_resolution_cache_dir=self._ivy_subsystem.
                   resolution_cache_dir(),
                   extra_jvm_options=self._ivy_subsystem.extra_jvm_options())
Ejemplo n.º 2
0
    def _bootstrap_ivy(self, bootstrap_jar_path):
        if not os.path.exists(bootstrap_jar_path):
            with temporary_file() as bootstrap_jar:
                fetcher = Fetcher()
                checksummer = fetcher.ChecksumListener(digest=hashlib.sha1())
                try:
                    log.info('\nDownloading %s' % self._bootstrap_jar_url)
                    # TODO: Capture the stdout of the fetcher, instead of letting it output
                    # to the console directly.
                    fetcher.download(
                        self._bootstrap_jar_url,
                        listener=fetcher.ProgressListener().wrap(checksummer),
                        path_or_fd=bootstrap_jar,
                        timeout_secs=self._timeout_secs)
                    log.info('sha1: %s' % checksummer.checksum)
                    bootstrap_jar.close()
                    touch(bootstrap_jar_path)
                    shutil.move(bootstrap_jar.name, bootstrap_jar_path)
                except fetcher.Error as e:
                    raise self.Error(
                        'Problem fetching the ivy bootstrap jar! %s' % e)

        return Ivy(bootstrap_jar_path,
                   ivy_settings=self._ivy_settings,
                   ivy_cache_dir=self.ivy_cache_dir)
Ejemplo n.º 3
0
 def _bootstrap_ivy(self):
     options = self._ivy_subsystem.get_options()
     return Ivy(self._ivy_subsystem.select(),
                ivy_settings=options.bootstrap_ivy_settings
                or options.ivy_settings,
                ivy_resolution_cache_dir=self._ivy_subsystem.
                resolution_cache_dir(),
                extra_jvm_options=self._ivy_subsystem.extra_jvm_options())
Ejemplo n.º 4
0
    def ivy(self, bootstrap_workunit_factory=None):
        """Returns an ivy instance bootstrapped by this bootstrapper.

    :param bootstrap_workunit_factory: the optional workunit to bootstrap under.
    :raises: Bootstrapper.Error if ivy could not be bootstrapped
    """
        return Ivy(self._get_classpath(bootstrap_workunit_factory),
                   ivy_settings=self._ivy_settings,
                   ivy_cache_dir=self.ivy_cache_dir)
Ejemplo n.º 5
0
  def ivy(self, bootstrap_workunit_factory=None):
    """Returns an ivy instance bootstrapped by this bootstrapper.

    :param bootstrap_workunit_factory: the optional workunit to bootstrap under.
    :raises: Bootstrapper.Error if ivy could not be bootstrapped
    """
    return Ivy(self._get_classpath(bootstrap_workunit_factory),
               ivy_settings=self._ivy_subsystem.get_options().ivy_settings,
               ivy_resolution_cache_dir=self._ivy_subsystem.resolution_cache_dir(),
               extra_jvm_options=self._ivy_subsystem.extra_jvm_options())