diff --git a/addons/source-python/packages/source-python/core/update.py b/addons/source-python/packages/source-python/core/update.py index c9da3f9a3..2dc86fe91 100644 --- a/addons/source-python/packages/source-python/core/update.py +++ b/addons/source-python/packages/source-python/core/update.py @@ -64,10 +64,13 @@ LOADER_UPDATE_FILE = UPDATE_PATH / 'addons' / f'source-python.{BINARY_EXT}' VDF_UPDATE_FILE = UPDATE_PATH / 'addons' / 'source-python.vdf' -CHECKSUM_URL = 'http://data.sourcepython.com/checksum.txt' -DATA_URL = 'http://data.sourcepython.com/source-python-data.zip' -ARTIFACTS_URL = 'http://builds.sourcepython.com/job/Source.Python/lastSuccessfulBuild/api/json?tree=artifacts[relativePath]' -BASE_DOWNLOAD_URL = 'http://builds.sourcepython.com/job/Source.Python/lastSuccessfulBuild/artifact/' +BASE_DATA_URL = 'http://data.sourcepython.com' +CHECKSUM_URL = f'{BASE_DATA_URL}/checksum.txt' +DATA_URL = f'{BASE_DATA_URL}/source-python-data.zip' + +BASE_DOWNLOAD_URL = 'http://downloads.sourcepython.com' +ARTIFACTS_URL = f'{BASE_DOWNLOAD_URL}/artifacts.txt' + DEFAULT_TIMEOUT = 3 #: Indicates, whether an update is in progress (stage 1 has been applied). @@ -140,9 +143,7 @@ def get_build_artifacts(timeout=DEFAULT_TIMEOUT): """ update_logger.log_debug('Getting artifacts...') with urlopen(ARTIFACTS_URL, timeout=timeout) as url: - data = json.loads(url.read()) - for d in data['artifacts']: - yield d['relativePath'] + return url.read().decode('utf-8').split('\n') def get_download_url(game=SOURCE_ENGINE_BRANCH, timeout=DEFAULT_TIMEOUT): """Get the latest Source.Python download URL for a specific game. @@ -157,7 +158,7 @@ def get_download_url(game=SOURCE_ENGINE_BRANCH, timeout=DEFAULT_TIMEOUT): """ for relative_path in get_build_artifacts(timeout): if f'-{game}-' in relative_path: - return BASE_DOWNLOAD_URL + relative_path + return f'{BASE_DOWNLOAD_URL}/{relative_path}' raise ValueError(f'Unable to find a download URL for game "{game}".') diff --git a/addons/source-python/packages/source-python/core/version.py b/addons/source-python/packages/source-python/core/version.py index 251acd2a5..a2ff96b09 100644 --- a/addons/source-python/packages/source-python/core/version.py +++ b/addons/source-python/packages/source-python/core/version.py @@ -32,8 +32,7 @@ GIT_COMMIT = None LAST_SUCCESSFUL_BUILD_NUMBER_URL = ( - 'http://builds.sourcepython.com/job/Source.Python' + - '/api/xml?xpath=/freeStyleProject/lastSuccessfulBuild/number') + 'http://downloads.sourcepython.com/version.txt') # ============================================================================= @@ -53,9 +52,7 @@ def get_last_successful_build_number(timeout=3): :rtype: int """ with urlopen(LAST_SUCCESSFUL_BUILD_NUMBER_URL, timeout=timeout) as url: - # Remove the tags, so we just have the build number - return int(url.read()[8:-9]) - + return int(url.read().decode('utf-8')) def is_unversioned(): """Return ``True`` if this Source.Python installation has no version.