Philipp Hörist pushed to branch gajim_1.3 at gajim / gajim
Commits:
-
748657ce
by lovetox at 2021-01-03T13:29:29+01:00
2 changed files:
Changes:
| 1 |
-#!/usr/bin/env python3
|
|
| 2 |
- |
|
| 3 |
-import os
|
|
| 4 |
-import requests
|
|
| 5 |
- |
|
| 6 |
-webhook_key = os.environ['APPVEYOR_WEBHOOK_KEY']
|
|
| 7 |
-branch = os.environ['CI_COMMIT_BRANCH']
|
|
| 8 |
- |
|
| 9 |
-url = f'https://ci.appveyor.com/api/git/webhook?id={webhook_key}'
|
|
| 10 |
-ref = f'refs/heads/{branch}'
|
|
| 11 |
- |
|
| 12 |
-with open('appveyor.yml', 'r') as file:
|
|
| 13 |
- yaml = file.read()
|
|
| 14 |
- |
|
| 15 |
-payload = {
|
|
| 16 |
- 'ref': ref,
|
|
| 17 |
- 'repository': {'name': 'Gajim'},
|
|
| 18 |
- 'config': yaml
|
|
| 19 |
-}
|
|
| 20 |
- |
|
| 21 |
-req = requests.post(url, json=payload)
|
|
| 22 |
-req.raise_for_status()
|
| 1 |
-#!/usr/bin/env python3
|
|
| 2 |
- |
|
| 3 |
-import os
|
|
| 4 |
-import io
|
|
| 5 |
-import zipfile
|
|
| 6 |
-import subprocess
|
|
| 7 |
-import shutil
|
|
| 8 |
-from pathlib import Path
|
|
| 9 |
-import requests
|
|
| 10 |
- |
|
| 11 |
-PLUGINS = [
|
|
| 12 |
- 'plugin_installer',
|
|
| 13 |
-]
|
|
| 14 |
- |
|
| 15 |
-PLUGINS_BASE_URL = 'https://ftp.gajim.org'
|
|
| 16 |
-PLUGINS_FOLDER = Path('./gajim/data/plugins')
|
|
| 17 |
- |
|
| 18 |
-COMMIT_BRANCH = os.environ['CI_COMMIT_BRANCH']
|
|
| 19 |
- |
|
| 20 |
- |
|
| 21 |
-def get_plugins_folder():
|
|
| 22 |
- if COMMIT_BRANCH == 'master':
|
|
| 23 |
- return 'plugins_master_zip'
|
|
| 24 |
- |
|
| 25 |
- version = COMMIT_BRANCH.split('_')[1]
|
|
| 26 |
- return f'plugins_{version}_zip'
|
|
| 27 |
- |
|
| 28 |
- |
|
| 29 |
-def get_plugins_url(plugin):
|
|
| 30 |
- folder = get_plugins_folder()
|
|
| 31 |
- return f'{PLUGINS_BASE_URL}/{folder}/{plugin}.zip'
|
|
| 32 |
- |
|
| 33 |
- |
|
| 34 |
-def extraxt_zip(zip_bytes, path):
|
|
| 35 |
- print('Extract to', path)
|
|
| 36 |
- with zipfile.ZipFile(io.BytesIO(zip_bytes)) as zip_file:
|
|
| 37 |
- zip_file.extractall(path)
|
|
| 38 |
- |
|
| 39 |
- |
|
| 40 |
-def download_plugins():
|
|
| 41 |
- PLUGINS_FOLDER.mkdir(parents=True)
|
|
| 42 |
- for plugin in PLUGINS:
|
|
| 43 |
- url = get_plugins_url(plugin)
|
|
| 44 |
- print('Download', url)
|
|
| 45 |
- req = requests.get(url)
|
|
| 46 |
- req.raise_for_status()
|
|
| 47 |
- extraxt_zip(req.content, PLUGINS_FOLDER)
|
|
| 48 |
- |
|
| 49 |
- |
|
| 50 |
-def setup():
|
|
| 51 |
- print('Setup')
|
|
| 52 |
- subprocess.call(['python3', 'setup.py', 'sdist'])
|
|
| 53 |
- |
|
| 54 |
- |
|
| 55 |
-def cleanup():
|
|
| 56 |
- print('Cleanup')
|
|
| 57 |
- shutil.rmtree(PLUGINS_FOLDER)
|
|
| 58 |
- |
|
| 59 |
- |
|
| 60 |
-download_plugins()
|
|
| 61 |
-setup()
|
|
| 62 |
-cleanup()
|