コード例 #1
0
 def download_driver(self, driver):
     cached_binary = self.get_cached_binary(driver)
     if cached_binary:
         return cached_binary
     zip_file = self._download_file(driver)
     files = archive.unpack(zip_file)
     return Binary(os.path.join(os.path.dirname(zip_file.name), files[0]))
コード例 #2
0
 def download_driver(self, driver, path=None):
     # type: (Driver) -> Binary
     if path is not None:
         path = os.path.abspath(path)
     cached_binary = self.get_cached_binary(driver, path)
     if cached_binary:
         return cached_binary
     zip_file = self._download_file(driver, path)
     files = archive.unpack(zip_file)
     return Binary(os.path.join(os.path.dirname(zip_file.name), files[0]))
コード例 #3
0
    def __extract_phantomjs_bin(self, zip_file):
        files = archive.unpack(zip_file)

        phantom_js = self.__get_phantom_bin(files)

        from_dest = os.path.join(os.path.dirname(zip_file.name), phantom_js)
        to_dest = os.path.join(os.path.dirname(zip_file.name),
                               os.path.basename(phantom_js))

        copyfile(from_dest, to_dest)
        return to_dest