-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Imscp preset #115
Imscp preset #115
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ test: | |
build: | ||
pip install -e . | ||
python scripts/generate_from_specs.py | ||
pre-commit run --all-files || true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a huge fan of the recursion through So to make sure I understand, you added to the pre-commit config to run subprocess.call(["pre-commit", "run", "--files"] + output_files) So technically the new |
||
|
||
release: clean build | ||
python setup.py sdist | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,5 @@ | |
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"version": "0.2.0" | ||
"version": "0.2.2" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diff is straightforward here and love calling pre-commit after generation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this run
make build
whenever we runpre-commit run
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but only if any of the spec JSON files or setup.py have been modified (as per the regex below).