Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils-sfg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils-sfg
Commits
f8065ea3
Commit
f8065ea3
authored
1 year ago
by
Frederik Hennig
Browse files
Options
Downloads
Patches
Plain Diff
moved clang-format binary check to post-init of config
parent
adafdfab
No related branches found
No related tags found
No related merge requests found
Pipeline
#58189
passed
1 year ago
Stage: pretest
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pystencilssfg/configuration.py
+9
-0
9 additions, 0 deletions
src/pystencilssfg/configuration.py
src/pystencilssfg/emission/clang_format.py
+2
-5
2 additions, 5 deletions
src/pystencilssfg/emission/clang_format.py
with
11 additions
and
5 deletions
src/pystencilssfg/configuration.py
+
9
−
0
View file @
f8065ea3
...
...
@@ -85,6 +85,15 @@ class SfgCodeStyle:
prefix
=
"
"
*
self
.
indent_width
return
indent
(
s
,
prefix
)
def
__post__init__
(
self
):
if
self
.
force_clang_format
:
import
shutil
if
not
shutil
.
which
(
self
.
clang_format_binary
):
raise
SfgException
(
"
`force_clang_format` set to true in code style, but clang-format binary not found.
"
)
@dataclass
class
SfgOutputSpec
:
...
...
This diff is collapsed.
Click to expand it.
src/pystencilssfg/emission/clang_format.py
+
2
−
5
View file @
f8065ea3
...
...
@@ -8,11 +8,8 @@ from ..exceptions import SfgException
def
invoke_clang_format
(
code
:
str
,
codestyle
:
SfgCodeStyle
)
->
str
:
args
=
[
codestyle
.
clang_format_binary
,
f
"
--style=
{
codestyle
.
code_style
}
"
]
if
not
shutil
.
which
(
"
clang-format
"
):
if
codestyle
.
force_clang_format
:
raise
SfgException
(
"
Could not find clang-format binary.
"
)
else
:
return
code
if
not
shutil
.
which
(
codestyle
.
clang_format_binary
):
return
code
result
=
subprocess
.
run
(
args
,
input
=
code
,
capture_output
=
True
,
text
=
True
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment