File size: 1,074 Bytes
78494de
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Build the Canvas source ZIP after provisioning, excluding private files."""
from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile

ROOT = Path(__file__).resolve().parents[1]
OUTPUT = ROOT / 'SecureMed.zip'
INCLUDE = ['Dockerfile', 'docker-compose.yml', '.env.example', 'README.md',
           'hands_on.md', 'checklist.py', 'submission.json',
           'securemed-diagnosis.tar', 'api/app.py', 'api/index.html',
           'api/requirements.txt', 'scripts/provision_grading_accounts.py',
           'scripts/seed_accounts.py', 'scripts/package.py']


def main():
    missing = [name for name in INCLUDE if not (ROOT / name).is_file()]
    if missing:
        raise SystemExit('Missing required submission files: ' + ', '.join(missing))
    with ZipFile(OUTPUT, 'w', ZIP_DEFLATED, compresslevel=2, allowZip64=True) as archive:
        for name in INCLUDE:
            archive.write(ROOT / name, arcname=name)
    print(f'Created {OUTPUT}. Private .env and private_accounts.json were excluded.')


if __name__ == '__main__':
    main()