From 08391f35eeeac9583c9ae5010e5e37ca2a5bc0a4 Mon Sep 17 00:00:00 2001 From: Petteri Aimonen Date: Mon, 29 Oct 2012 19:15:34 +0200 Subject: Add nanopb version number to generated files. tools/set_version.sh is used to update the values. Update issue 36 Status: FixedInGit --- generator/nanopb_generator.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'generator') diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py index bd164e03..dadad646 100644 --- a/generator/nanopb_generator.py +++ b/generator/nanopb_generator.py @@ -1,4 +1,5 @@ '''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.''' +nanopb_version = "nanopb-0.1.7-dev" try: import google.protobuf.descriptor_pb2 as descriptor @@ -31,7 +32,7 @@ except: # Generation of single fields # --------------------------------------------------------------------------- - +import time import os.path # Values are tuple (c type, pb ltype) @@ -429,6 +430,7 @@ def generate_header(dependencies, headername, enums, messages): ''' yield '/* Automatically generated nanopb header */\n' + yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime()) symbol = headername.replace('.', '_').upper() yield '#ifndef _PB_%s_\n' % symbol @@ -516,6 +518,7 @@ def generate_source(headername, enums, messages): '''Generate content for a source file.''' yield '/* Automatically generated nanopb constant definitions */\n' + yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime()) yield '#include "%s"\n\n' % headername for msg in messages: -- cgit 1.2.3-korg