diff --git a/Makefile b/Makefile index c680427..94c2493 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,6 @@ test: build: pip install -e . python scripts/generate_from_specs.py - pre-commit run --all-files || true release: clean build python setup.py sdist diff --git a/js/package.json b/js/package.json index fc6481b..74c3684 100644 --- a/js/package.json +++ b/js/package.json @@ -27,5 +27,5 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, - "version": "0.2.0" + "version": "0.2.2" } \ No newline at end of file diff --git a/le_utils/constants/format_presets.py b/le_utils/constants/format_presets.py index df20260..119fc3a 100644 --- a/le_utils/constants/format_presets.py +++ b/le_utils/constants/format_presets.py @@ -72,6 +72,9 @@ QTI_THUMBNAIL = "qti_thumbnail" QTI_THUMBNAIL_READABLE = "QTI Thumbnail" +IMSCP_ZIP = "imscp_zip" +IMSCP_ZIP_READABLE = "IMSCP Zip" + SLIDESHOW_IMAGE = "slideshow_image" SLIDESHOW_IMAGE_READABLE = "Slideshow Image" @@ -114,6 +117,7 @@ (SLIDESHOW_IMAGE, SLIDESHOW_IMAGE_READABLE), (SLIDESHOW_THUMBNAIL, SLIDESHOW_THUMBNAIL_READABLE), (SLIDESHOW_MANIFEST, SLIDESHOW_MANIFEST_READABLE), + (IMSCP_ZIP, IMSCP_ZIP_READABLE), ) diff --git a/le_utils/resources/presetlookup.json b/le_utils/resources/presetlookup.json index a16c80a..5e8e027 100644 --- a/le_utils/resources/presetlookup.json +++ b/le_utils/resources/presetlookup.json @@ -239,6 +239,18 @@ "allowed_formats": ["png", "jpg", "jpeg"], "convertible_formats": [] }, + "imscp_zip": { + "readable_name": "IMSCP Zip", + "multi_language": false, + "supplementary": false, + "thumbnail": false, + "subtitle": false, + "display": true, + "order": 1, + "kind": "html5", + "allowed_formats": ["zip"], + "convertible_formats": [] + }, "h5p": { "readable_name": "H5P", "multi_language": false, diff --git a/scripts/generate_from_specs.py b/scripts/generate_from_specs.py index 88d50a8..8032f58 100644 --- a/scripts/generate_from_specs.py +++ b/scripts/generate_from_specs.py @@ -8,6 +8,7 @@ import os import re import string +import subprocess import sys from collections import OrderedDict from glob import glob @@ -238,26 +239,34 @@ def write_js_file(output_file, name, ordered_output, schema=None): def write_labels_src_files(label_outputs): + output_files = [] for label_type, ordered_output in label_outputs.items(): py_output_file = os.path.join( py_labels_output_dir, "{}.py".format(pascal_to_snake(label_type)) ) write_python_file(py_output_file, label_type, ordered_output) + output_files.append(py_output_file) js_output_file = os.path.join(js_labels_output_dir, "{}.js".format(label_type)) write_js_file(js_output_file, label_type, ordered_output) + output_files.append(js_output_file) + return output_files def write_constants_src_files(constants_outputs, schemas): + output_files = [] for constant_type, ordered_output in constants_outputs.items(): py_output_file = os.path.join( py_output_dir, "{}.py".format(pascal_to_snake(constant_type)) ) schema = schemas.get(constant_type) write_python_file(py_output_file, constant_type, ordered_output, schema=schema) + output_files.append(py_output_file) js_output_file = os.path.join(js_output_dir, "{}.js".format(constant_type)) write_js_file(js_output_file, constant_type, ordered_output, schema=schema) + output_files.append(js_output_file) + return output_files def set_package_json_version(): @@ -279,6 +288,7 @@ def set_package_json_version(): else: f.write("\n") f.write(line.rstrip()) + return [package_json] if __name__ == "__main__": @@ -289,8 +299,12 @@ def set_package_json_version(): schemas_to_write, schema_constants_to_write = read_schema_specs() constants_to_write.update(schema_constants_to_write) - write_labels_src_files(labels_to_write) + output_files = [] - write_constants_src_files(constants_to_write, schemas_to_write) + output_files += write_labels_src_files(labels_to_write) - set_package_json_version() + output_files += write_constants_src_files(constants_to_write, schemas_to_write) + + output_files += set_package_json_version() + + subprocess.call(["pre-commit", "run", "--files"] + output_files) diff --git a/setup.py b/setup.py index 7eae16a..ce37712 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ setup( name="le-utils", packages=find_packages(), - version="0.2.1", + version="0.2.2", description="LE-Utils contains shared constants used in Kolibri, Ricecooker, and Kolibri Studio.", long_description=long_description, long_description_content_type="text/markdown",