-
Notifications
You must be signed in to change notification settings - Fork 9
/
repo_add_bundle.py
35 lines (27 loc) · 1.16 KB
/
repo_add_bundle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import logging
import sys
from tufup.repo import Repository
from repo_settings import DIST_DIR, KEYS_DIR
logger = logging.getLogger(__name__)
if __name__ == '__main__':
# create archive from latest pyinstaller bundle (assuming we have already
# created a pyinstaller bundle, and there is only one)
try:
bundle_dirs = [path for path in DIST_DIR.iterdir() if path.is_dir()]
except FileNotFoundError:
sys.exit(f'Directory not found: {DIST_DIR}\nDid you run pyinstaller?')
if len(bundle_dirs) != 1:
sys.exit(f'Expected one bundle, found {len(bundle_dirs)}.')
bundle_dir = bundle_dirs[0]
print(f'Adding bundle: {bundle_dir}')
# Create repository instance from config file (assuming the repository
# has already been initialized)
repo = Repository.from_config()
# Add new app bundle to repository (automatically reads myapp.__version__)
repo.add_bundle(
new_bundle_dir=bundle_dir,
# [optional] custom metadata can be any dict (default is None)
custom_metadata={'changes': ['new feature x added', 'bug y fixed']},
)
repo.publish_changes(private_key_dirs=[KEYS_DIR])
print('Done.')