summaryrefslogtreecommitdiff
path: root/grpc/tools/buildgen/build_cleaner.py
diff options
context:
space:
mode:
Diffstat (limited to 'grpc/tools/buildgen/build_cleaner.py')
-rwxr-xr-xgrpc/tools/buildgen/build_cleaner.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/grpc/tools/buildgen/build_cleaner.py b/grpc/tools/buildgen/build_cleaner.py
index b044cb7d..19bcee63 100755
--- a/grpc/tools/buildgen/build_cleaner.py
+++ b/grpc/tools/buildgen/build_cleaner.py
@@ -48,15 +48,18 @@ def _rebuild_as_ordered_dict(indict, special_keys):
if key in indict:
outdict[key] = indict[key]
for key in sorted(indict.keys()):
- if key in special_keys: continue
- if '#' in key: continue
+ if key in special_keys:
+ continue
+ if '#' in key:
+ continue
outdict[key] = indict[key]
return outdict
def _clean_elem(indict):
for name in ['public_headers', 'headers', 'src']:
- if name not in indict: continue
+ if name not in indict:
+ continue
inlist = indict[name]
protos = list(x for x in inlist if os.path.splitext(x)[1] == '.proto')
others = set(x for x in inlist if x not in protos)
@@ -68,7 +71,8 @@ def cleaned_build_yaml_dict_as_string(indict):
"""Takes dictionary which represents yaml file and returns the cleaned-up yaml string"""
js = _rebuild_as_ordered_dict(indict, _TOP_LEVEL_KEYS)
for grp in ['filegroups', 'libs', 'targets']:
- if grp not in js: continue
+ if grp not in js:
+ continue
js[grp] = sorted([_clean_elem(x) for x in js[grp]],
key=lambda x: (x.get('language', '_'), x['name']))
output = yaml.dump(js, indent=2, width=80, default_flow_style=False)