-
Notifications
You must be signed in to change notification settings - Fork 35
Imscp preset #115
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
Merged
Merged
Imscp preset #115
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
|
Member
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 |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not a huge fan of the recursion through
pre-committhat I think is happening with these changes.So to make sure I understand, you added to the pre-commit config to run
make buildwhen the source files run, and thereby removed this part ofmake buildwhere it runspre-commit, which I recall was added to reformat the generated files in a consistent manner. But then inscripts/generate_from_specs.py, you added a call to runpre-commitbut only on the output files:So technically the new
pre-commithook shouldn't run against the output files because they shouldn't match the regex, thereby not triggeringmake buildagain, but still the new hook would takepre-committhroughmake,python, then back topre-commitagain. I think I had brought up potentially havingpython scripts/generate_from_specs.pyoutput the list of files forpre-commit.