-
Notifications
You must be signed in to change notification settings - Fork 0
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
rendergraph: Port perl script to Python and add pre-commit hook #18
rendergraph: Port perl script to Python and add pre-commit hook #18
Conversation
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.
Thanks for looking into this! The python version is definitely more beefy but also should support wider system setup, as well as provide logging a command usage.
if in_shader_block == 2: | ||
if re.match(r"^\*\*", line): | ||
ok = True | ||
else: | ||
if not comment_added and not re.match(r"^#", line): | ||
yield "//// GENERATED - EDITS WILL BE OVERWRITTEN" | ||
comment_added = True | ||
if line: | ||
if buffered_blank_line: | ||
yield "" | ||
buffered_blank_line = False | ||
yield line | ||
else: | ||
buffered_blank_line = True | ||
elif in_shader_block == 1: | ||
if line.rstrip() == "Contents:": | ||
in_shader_block = 2 | ||
else: | ||
if line.rstrip() == "Shader 1: GLSL 120 [Standard]": | ||
in_shader_block = 1 |
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.
Very naive suggestion here, to help flattening the nested logic
if in_shader_block == 2: | |
if re.match(r"^\*\*", line): | |
ok = True | |
else: | |
if not comment_added and not re.match(r"^#", line): | |
yield "//// GENERATED - EDITS WILL BE OVERWRITTEN" | |
comment_added = True | |
if line: | |
if buffered_blank_line: | |
yield "" | |
buffered_blank_line = False | |
yield line | |
else: | |
buffered_blank_line = True | |
elif in_shader_block == 1: | |
if line.rstrip() == "Contents:": | |
in_shader_block = 2 | |
else: | |
if line.rstrip() == "Shader 1: GLSL 120 [Standard]": | |
in_shader_block = 1 | |
if in_shader_block == 2: | |
if re.match(r"^\*\*", line): | |
ok = True | |
else: | |
if not comment_added and not re.match(r"^#", line): | |
yield "//// GENERATED - EDITS WILL BE OVERWRITTEN" | |
comment_added = True | |
if line: | |
if buffered_blank_line: | |
yield "" | |
buffered_blank_line = False | |
yield line | |
else: | |
buffered_blank_line = True | |
elif in_shader_block == 1 and line.rstrip() == "Contents:": | |
in_shader_block = 2 | |
elif line.rstrip() == "Shader 1: GLSL 120 [Standard]": | |
in_shader_block = 1 |
additional_paths=[ | ||
"/usr/lib/qt6/bin", | ||
"/lib/qt6/bin", | ||
"/usr/local/lib/qt6/bin", | ||
], |
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.
Should we use $PATH
as well?
additional_paths=[ | |
"/usr/lib/qt6/bin", | |
"/lib/qt6/bin", | |
"/usr/local/lib/qt6/bin", | |
], | |
additional_paths=[ | |
"/usr/lib/qt6/bin", | |
"/lib/qt6/bin", | |
"/usr/local/lib/qt6/bin", | |
] + [os.getenv("PATH", "").split(":")], |
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.
We call shutil.which
up to two times in the funtion, the first time without setting the path argument which implicitly defaults to $PATH
. So yeah, that is already supported.
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.
Ah good to know. Thanks for the lesson!
Thanks @Holzhaus ! |
No description provided.