-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.py
executable file
·30 lines (20 loc) · 968 Bytes
/
build.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
#!/usr/bin/env python3
# This file is part of the QuestionPy SDK. (https://questionpy.org)
# The QuestionPy SDK is free software released under terms of the MIT license. See LICENSE.md.
# (c) Technische Universität Berlin, innoCampus <[email protected]>
import zipfile
from pathlib import Path
from typing import Any
from questionpy_sdk.resources import EXAMPLE_PACKAGE
COMPRESS_TYPE = zipfile.ZIP_DEFLATED
def create_example_zip() -> None:
"""Creates the minimal_example.zip required by the `create` command."""
minimal_example = Path(__file__).parent / "examples" / "minimal"
with zipfile.ZipFile(EXAMPLE_PACKAGE, "w", COMPRESS_TYPE) as zip_file:
for file in minimal_example.rglob("*"):
if "__pycache__" not in file.parts:
zip_file.write(file, file.relative_to(minimal_example), COMPRESS_TYPE)
def build(_setup_kwargs: Any) -> None:
create_example_zip()
if __name__ == "__main__":
build({})