def install(self): dest = os.path.dirname(os.path.dirname(os.path.expanduser(self.tool_path))) dest = os.path.abspath(dest) self.log.info("Will try to install Gatling into %s", dest) # download gatling downloader = FancyURLopener() gatling_zip_file = tempfile.NamedTemporaryFile(suffix=".zip", delete=True) self.download_link = self.download_link.format(version=self.version) self.log.info("Downloading %s", self.download_link) # TODO: check archive checksum/hash before unzip and run try: downloader.retrieve(self.download_link, gatling_zip_file.name, download_progress_hook) except BaseException as exc: self.log.error("Error while downloading %s", self.download_link) raise exc self.log.info("Unzipping %s", gatling_zip_file.name) unzip(gatling_zip_file.name, dest, 'gatling-charts-highcharts-bundle-' + self.version) gatling_zip_file.close() os.chmod(os.path.expanduser(self.tool_path), 0o755) self.log.info("Installed Gatling successfully") if not self.check_if_installed(): raise RuntimeError("Unable to run %s after installation!" % self.tool_name)
def install(self): try: if not os.path.exists(os.path.dirname(self.tool_path)): os.makedirs(os.path.dirname(self.tool_path)) downloader = FancyURLopener() downloader.retrieve(self.download_link, self.tool_path, download_progress_hook) if self.check_if_installed(): return self.tool_path else: raise RuntimeError("Unable to run %s after installation!" % self.tool_name) except BaseException as exc: raise exc
def install(self): dest = os.path.dirname(os.path.dirname(os.path.expanduser(self.tool_path))) dest = os.path.abspath(dest) downloader = FancyURLopener() grinder_zip_file = tempfile.NamedTemporaryFile(suffix=".zip", delete=True) self.download_link = self.download_link.format(version=self.version) self.log.info("Downloading %s", self.download_link) try: downloader.retrieve(self.download_link, grinder_zip_file.name, download_progress_hook) except BaseException as exc: self.log.error("Error while downloading %s", self.download_link) raise exc self.log.info("Unzipping %s", grinder_zip_file.name) unzip(grinder_zip_file.name, dest, 'grinder-' + self.version) grinder_zip_file.close() self.log.info("Installed grinder successfully") if not self.check_if_installed(): raise RuntimeError("Unable to run %s after installation!" % self.tool_name)