def update_runtime(set_status): logger.debug("Updating runtime") remote_version = get_remote_version() local_version = get_local_version() if remote_version <= local_version: logger.debug("Runtime already up to date") return runtime32_file = "lutris-runtime-i386.tar.gz" runtime64_file = "lutris-runtime-amd64.tar.gz" set_status("Updating Runtime") runtime32_path = os.path.join(settings.RUNTIME_DIR, runtime32_file) http.download_asset(settings.RUNTIME_URL + runtime32_file, runtime32_path, overwrite=True) runtime64_path = os.path.join(settings.RUNTIME_DIR, runtime64_file) http.download_asset(settings.RUNTIME_URL + runtime64_file, runtime64_path, overwrite=True) system.remove_folder(os.path.join(settings.RUNTIME_DIR, 'lib32')) system.remove_folder(os.path.join(settings.RUNTIME_DIR, 'lib64')) extract.extract_archive(runtime32_path, settings.RUNTIME_DIR, merge_single=False) extract.extract_archive(runtime64_path, settings.RUNTIME_DIR, merge_single=False) os.unlink(runtime32_path) os.unlink(runtime64_path) with open(LOCAL_VERSION_PATH, 'w') as version_file: version_file.write(str(remote_version)) set_status("Runtime updated") logger.debug("Runtime updated")
def update_runtime(): remote_version = get_remote_version() local_version = get_local_version() if remote_version <= local_version: return runtime32_file = "lutris-runtime-i386.tar.gz" runtime64_file = "lutris-runtime-amd64.tar.gz" runtime32_path = os.path.join(settings.RUNTIME_DIR, runtime32_file) http.download_asset(settings.RUNTIME_URL + runtime32_file, runtime32_path, overwrite=True) runtime64_path = os.path.join(settings.RUNTIME_DIR, runtime64_file) http.download_asset(settings.RUNTIME_URL + runtime64_file, runtime64_path, overwrite=True) extract.extract_archive(runtime32_path, settings.RUNTIME_DIR, merge_single=False) extract.extract_archive(runtime64_path, settings.RUNTIME_DIR, merge_single=False) os.unlink(runtime32_path) os.unlink(runtime64_path) with open(LOCAL_VERSION_PATH, 'w') as version_file: version_file.write(str(remote_version))
def download_icon(game, icon_type, overwrite=False, callback=None): icon_url = get_icon_url(game, icon_type) icon_path = get_icon_path(game, icon_type) icon_downloaded = http.download_asset(icon_url, icon_path, overwrite) if icon_downloaded and callback: logger.debug("Downloaded %s for %s" % (icon_type, game)) callback(game)
def download_banner(game, overwrite=False, callback=None): banner_url = settings.INSTALLER_URL + '%s.jpg' % game banner_path = get_banner_path(game) cover_downloaded = http.download_asset(banner_url, banner_path, overwrite) if cover_downloaded and callback: logger.debug("Icon downloaded for %s", game) callback(game)
def download_icon(game_slug, icon_type, overwrite=False, callback=None, stop_request=None, game_id=None): icon_url = get_icon_url(game_slug, icon_type) icon_path = get_icon_path(game_slug, icon_type) icon_downloaded = http.download_asset(icon_url, icon_path, overwrite, stop_request=stop_request) if icon_downloaded and callback: logger.debug("Downloaded %s for %s" % (icon_type, game_slug)) callback(game_id)
def update_runtime(set_status): logger.debug("Updating runtime") remote_version = get_remote_version() local_version = get_local_version() if remote_version <= local_version: logger.debug("Runtime already up to date") return runtime32_file = "steam-runtime_32.tar.gz" runtime64_file = "steam-runtime_64.tar.gz" # Download set_status("Updating Runtime") runtime32_path = os.path.join(RUNTIME_DIR, runtime32_file) http.download_asset(RUNTIME_URL + runtime32_file, runtime32_path, overwrite=True) runtime64_path = os.path.join(RUNTIME_DIR, runtime64_file) http.download_asset(RUNTIME_URL + runtime64_file, runtime64_path, overwrite=True) # Remove current system.remove_folder(os.path.join(RUNTIME_DIR, 'steam')) # Remove legacy folders system.remove_folder(os.path.join(RUNTIME_DIR, 'lib32')) system.remove_folder(os.path.join(RUNTIME_DIR, 'lib64')) # Extract extract.extract_archive(runtime32_path, RUNTIME_DIR, merge_single=False) extract.extract_archive(runtime64_path, RUNTIME_DIR, merge_single=False) os.unlink(runtime32_path) os.unlink(runtime64_path) with open(LOCAL_VERSION_PATH, 'w') as version_file: version_file.write(str(remote_version)) set_status("Runtime updated") logger.debug("Runtime updated")
def test_download_asset(): http.download_asset(TEST_URL, "/tmp/test-asset", overwrite=True)