Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-dev-tools
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
Container registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-dev-tools
Commits
f4aa2de0
Commit
f4aa2de0
authored
4 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: use term 'edit' instead of 'fix'.
parent
da126dc0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
utils_maintenance/code_clean.py
+13
-13
13 additions, 13 deletions
utils_maintenance/code_clean.py
with
13 additions
and
13 deletions
utils_maintenance/code_clean.py
+
13
−
13
View file @
f4aa2de0
...
...
@@ -348,7 +348,7 @@ def test_edit(source, output, output_bytes, build_args, data, data_test, keep_ed
# -----------------------------------------------------------------------------
# List Fix Functions
def
fix
_function_get_all
():
def
edit
_function_get_all
():
fixes
=
[]
for
name
in
globals
().
keys
():
if
name
.
startswith
(
"
edit_list_from_file__
"
):
...
...
@@ -358,7 +358,7 @@ def fix_function_get_all():
return
fixes
def
fix
_function_get_from_id
(
name
):
def
edit
_function_get_from_id
(
name
):
return
globals
().
get
(
"
edit_list_from_file__
"
+
name
)
...
...
@@ -384,11 +384,11 @@ def apply_edit(data, text_to_replace, start, end, *, verbose):
def
wash_source_with_edits
(
arg_group
):
(
source
,
output
,
build_args
,
fix
_to_apply
,
skip_test
)
=
arg_group
(
source
,
output
,
build_args
,
edit
_to_apply
,
skip_test
)
=
arg_group
# build_args = build_args + " -Werror=duplicate-decl-specifier"
with
open
(
source
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
fh
:
data
=
fh
.
read
()
edit_list_from_file_fn
=
fix
_function_get_from_id
(
fix
_to_apply
)
edit_list_from_file_fn
=
edit
_function_get_from_id
(
edit
_to_apply
)
edits
=
edit_list_from_file_fn
(
source
,
data
)
edits
.
sort
(
reverse
=
True
)
if
not
edits
:
...
...
@@ -434,7 +434,7 @@ def wash_source_with_edits(arg_group):
# -----------------------------------------------------------------------------
# Edit Source Code From Args
def
header_clean_all
(
build_dir
,
regex_list
,
fix
_to_apply
,
skip_test
=
False
):
def
header_clean_all
(
build_dir
,
regex_list
,
edit
_to_apply
,
skip_test
=
False
):
# currently only supports ninja or makefiles
build_file_ninja
=
os
.
path
.
join
(
build_dir
,
"
build.ninja
"
)
build_file_make
=
os
.
path
.
join
(
build_dir
,
"
Makefile
"
)
...
...
@@ -495,7 +495,7 @@ def header_clean_all(build_dir, regex_list, fix_to_apply, skip_test=False):
if
USE_MULTIPROCESS
:
args
=
[
(
c
,
output_from_build_args
(
build_args
),
build_args
,
fix
_to_apply
,
skip_test
)
(
c
,
output_from_build_args
(
build_args
),
build_args
,
edit
_to_apply
,
skip_test
)
for
(
c
,
build_args
)
in
args
]
import
multiprocessing
...
...
@@ -506,7 +506,7 @@ def header_clean_all(build_dir, regex_list, fix_to_apply, skip_test=False):
# now we have commands
for
i
,
(
c
,
build_args
)
in
enumerate
(
args
):
wash_source_with_edits
(
(
c
,
output_from_build_args
(
build_args
),
build_args
,
fix
_to_apply
,
skip_test
)
(
c
,
output_from_build_args
(
build_args
),
build_args
,
edit
_to_apply
,
skip_test
)
)
print
(
"
\n
"
"
Exit without errors
"
)
...
...
@@ -514,7 +514,7 @@ def header_clean_all(build_dir, regex_list, fix_to_apply, skip_test=False):
def
create_parser
():
fixe
s_all
=
fix
_function_get_all
()
edit
s_all
=
edit
_function_get_all
()
import
argparse
parser
=
argparse
.
ArgumentParser
(
...
...
@@ -533,11 +533,11 @@ def create_parser():
help
=
"
Match file paths against this expression
"
,
)
parser
.
add_argument
(
"
--
fix
"
,
dest
=
"
fix
"
,
choices
=
fixe
s_all
,
"
--
edit
"
,
dest
=
"
edit
"
,
choices
=
edit
s_all
,
help
=
(
"
Specify the
fix to perform
.
"
"
Specify the
edit preset to run
.
"
),
required
=
True
,
)
...
...
@@ -570,7 +570,7 @@ def main():
print
(
f
"
Error in expression:
{
expr
}
\n
{
ex
}
"
)
return
1
return
header_clean_all
(
build_dir
,
regex_list
,
args
.
fix
,
args
.
skip_test
)
return
header_clean_all
(
build_dir
,
regex_list
,
args
.
edit
,
args
.
skip_test
)
if
__name__
==
"
__main__
"
:
...
...
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