Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions tools/code_format/header_order.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Enforce header order in a given file. This will only reorder in the first sequence of contiguous
# #include statements, so it will not play well with #ifdef.
Expand All @@ -12,17 +12,15 @@
# enough to handle block splitting and correctly detecting the main header subject to the Envoy
# canonical paths.

from __future__ import print_function

import argparse
import common
import pathlib
import re
import sys


def ReorderHeaders(path):
with open(path, 'r') as f:
source = f.read()
source = pathlib.Path(path).read_text(encoding='utf-8')

all_lines = iter(source.split('\n'))
before_includes_lines = []
Expand Down Expand Up @@ -117,7 +115,6 @@ def regex_filter(regex):
include_dir_order = args.include_dir_order.split(',')
reorderd_source = ReorderHeaders(target_path)
if args.rewrite:
with open(target_path, 'w') as f:
f.write(reorderd_source)
pathlib.Path(target_path).write_text(reorderd_source, encoding='utf-8')
else:
sys.stdout.write(reorderd_source)
sys.stdout.buffer.write(reorderd_source.encode('utf-8'))
4 changes: 2 additions & 2 deletions tools/code_format/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flake8==3.7.8
yapf==0.28.0
flake8==3.8.3
yapf==0.30.0
4 changes: 2 additions & 2 deletions tools/protoxform/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def UpgradeType(match):
# We need to deal with envoy.api.* normalization in the v2 API. We won't
# need this in v3+, so rather than churn docs, we just have this workaround.
type_desc = self._typedb.types[api_v2_type_name]
repl_type = type_desc.next_version_type_name[len(
'envoy.'):] if type_desc.next_version_type_name else normalized_type_name
repl_type = type_desc.next_version_type_name[
len('envoy.'):] if type_desc.next_version_type_name else normalized_type_name
# TODO(htuch): this should really either go through the type database or
# via the descriptor pool and annotations, but there are only two of these
# we need for the initial v2 -> v3 docs cut, so hard coding for now.
Expand Down