1 # Copyright 2020 The Pigweed Authors
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 # use this file except in compliance with the License. You may obtain a copy of
7 # https://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations under
14 """Emits an error when using a protobuf library that is not generated"""
21 parser = argparse.ArgumentParser(description=__doc__)
22 parser.add_argument('--library',
24 help='The protobuf library being built')
25 parser.add_argument('--generator',
27 help='The protobuf generator requested')
28 return parser.parse_args()
31 def main(library: str, generator: str):
32 print(f'ERROR: Attempting to build protobuf library {library}, but the '
33 f'{generator} protobuf generator is not in use.')
34 print(f'To use {generator} protobufs, list "{generator}" in '
35 'pw_protobuf_GENERATORS.')
39 if __name__ == '__main__':
40 main(**vars(parse_args()))