diff --git a/tools/deprecate_features/deprecate_features.py b/tools/deprecate_features/deprecate_features.py index 203d4d2a99dbf..3da00632ba9f5 100644 --- a/tools/deprecate_features/deprecate_features.py +++ b/tools/deprecate_features/deprecate_features.py @@ -1,4 +1,4 @@ -# A simple script to snag deprecated proto fields and add them to runtime_features.h +# A simple script to snag deprecated proto fields and add them to runtime_features.cc from __future__ import print_function import re @@ -16,7 +16,8 @@ def deprecate_proto(): # Compile the set of deprecated fields and the files they're in, deduping via set. deprecated_regex = re.compile(r'.*\/([^\/]*.proto):[^=]* ([^= ]+) =.*') - for line in grep_output.splitlines(): + for byte_line in grep_output.splitlines(): + line = str(byte_line) match = deprecated_regex.match(line) if match: filenames_and_fields.add(tuple([match.group(1), match.group(2)])) @@ -46,46 +47,11 @@ def deprecate_proto(): return email, code -# Sorts out the list of features which should be default enabled and returns a tuple of -# email and code changes. -def flip_runtime_features(): - grep_output = subprocess.check_output('grep -r "envoy.reloadable_features\." source/*', - shell=True) - - features_to_flip = set() - - # Compile the set of features to flip, deduping via set. - deprecated_regex = re.compile(r'.*"(envoy.reloadable_features\.[^"]+)".*') - for line in grep_output.splitlines(): - match = deprecated_regex.match(line) - if match: - features_to_flip.add(match.group(1)) - else: - print('no match in ' + line + ' please address manually!') - - # Exempt the two test flags. - features_to_flip.remove('envoy.reloadable_features.my_feature_name') - features_to_flip.remove('envoy.reloadable_features.test_feature_true') - - code_snippets = [] - email_snippets = [] - for (feature) in features_to_flip: - code_snippets.append(' "' + feature + '",\n') - email_snippets.append(feature + '\n') - code = ''.join(code_snippets) - email = '' - if email_snippets: - email = 'the following features will be defaulted to true:\n' + ''.join(email_snippets) - - return email, code - - # Gather code and suggested email changes. -runtime_email, runtime_features_code = flip_runtime_features() deprecate_email, deprecate_code = deprecate_proto() email = ('The Envoy maintainer team is cutting the next Envoy release. In the new release ' + - runtime_email + deprecate_email) + deprecate_email) print('\n\nSuggested envoy-announce email: \n') print(email) @@ -94,8 +60,6 @@ def flip_runtime_features(): exit(1) for line in fileinput.FileInput('source/common/runtime/runtime_features.cc', inplace=1): - if 'envoy.reloadable_features.test_feature_true' in line: - line = line.replace(line, line + runtime_features_code) if 'envoy.deprecated_features.deprecated.proto:is_deprecated_fatal' in line: line = line.replace(line, line + deprecate_code) print(line, end='') diff --git a/tools/deprecate_features/requirements.txt b/tools/deprecate_features/requirements.txt index dc2a917a768ee..b1013c19345c4 100644 --- a/tools/deprecate_features/requirements.txt +++ b/tools/deprecate_features/requirements.txt @@ -1,2 +1 @@ -GitPython==3.0.0 -PyGithub==1.43.8 +six==1.12.0