diff options
author | lovetox <philipp@hoerist.com> | 2021-01-02 15:48:17 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2021-01-02 16:03:30 +0300 |
commit | aec8af588c943c1f7e40ad435193292b8d95e0f4 (patch) | |
tree | 6549152a9164e0521a156ef98c819f26c66700c6 /scripts | |
parent | 6b7a88496007727735ee8a61029586ba1fc77dfc (diff) |
Update CI
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ci/pylint.sh (renamed from scripts/dev/pylint-ci.sh) | 0 | ||||
-rwxr-xr-x | scripts/ci/sdist.py | 62 |
2 files changed, 62 insertions, 0 deletions
diff --git a/scripts/dev/pylint-ci.sh b/scripts/ci/pylint.sh index 593c6b05f..593c6b05f 100755 --- a/scripts/dev/pylint-ci.sh +++ b/scripts/ci/pylint.sh diff --git a/scripts/ci/sdist.py b/scripts/ci/sdist.py new file mode 100755 index 000000000..985880c0f --- /dev/null +++ b/scripts/ci/sdist.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +import os +import io +import zipfile +import subprocess +import shutil +from pathlib import Path +import requests + +PLUGINS = [ + 'plugin_installer', +] + +PLUGINS_BASE_URL = 'https://ftp.gajim.org' +PLUGINS_FOLDER = Path('./gajim/data/plugins') + +COMMIT_BRANCH = os.environ['CI_COMMIT_BRANCH'] + + +def get_plugins_folder(): + if COMMIT_BRANCH == 'master': + return 'plugins_master_zip' + + version = COMMIT_BRANCH.split('_')[1] + return f'plugins_{version}_zip' + + +def get_plugins_url(plugin): + folder = get_plugins_folder() + return f'{PLUGINS_BASE_URL}/{folder}/{plugin}.zip' + + +def extraxt_zip(zip_bytes, path): + print('Extract to', path) + with zipfile.ZipFile(io.BytesIO(zip_bytes)) as zip_file: + zip_file.extractall(path) + + +def download_plugins(): + PLUGINS_FOLDER.mkdir(parents=True) + for plugin in PLUGINS: + url = get_plugins_url(plugin) + print('Download', url) + req = requests.get(url) + req.raise_for_status() + extraxt_zip(req.content, PLUGINS_FOLDER) + + +def setup(): + print('Setup') + subprocess.call(['python3', 'setup.py', 'sdist']) + + +def cleanup(): + print('Cleanup') + shutil.rmtree(PLUGINS_FOLDER) + + +download_plugins() +setup() +cleanup() |