forked from FloMPS/tufup-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepo_add_bundle.py
32 lines (24 loc) · 1.06 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
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}')
print("Please wait, this can take a minute or two...")
# 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)
repo.publish_changes(private_key_dirs=[KEYS_DIR])
print('Done.')