summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-04-18 15:40:40 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2014-04-18 15:40:40 +0300
commite6a57e512fb7ca0198ae2bb95616284387c7e4f9 (patch)
tree28cf352c0e45255976647c9436eb82d67ea5ccc2
parentd177af163995c8663991e000f129327cb4dc2505 (diff)
Add option to not add timestamps to .pb.h and .pb.c preambles.
Patch by rusnakp. Update issue 115 Status: FixedInGit
-rwxr-xr-xgenerator/nanopb_generator.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 7b6f0ba9..4d8d733f 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -707,7 +707,10 @@ def generate_header(dependencies, headername, enums, messages, extensions, optio
'''
yield '/* Automatically generated nanopb header */\n'
- yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime())
+ if options.notimestamp:
+ yield '/* Generated by %s */\n\n' % (nanopb_version)
+ else:
+ yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime())
symbol = make_identifier(headername)
yield '#ifndef _PB_%s_\n' % symbol
@@ -780,7 +783,10 @@ def generate_source(headername, enums, messages, extensions, options):
'''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())
+ if options.notimestamp:
+ yield '/* Generated by %s */\n\n' % (nanopb_version)
+ else:
+ yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime())
yield options.genformat % (headername)
yield '\n'
@@ -963,6 +969,8 @@ optparser.add_option("-Q", "--generated-include-format", dest="genformat",
optparser.add_option("-L", "--library-include-format", dest="libformat",
metavar="FORMAT", default='#include <%s>\n',
help="Set format string to use for including the nanopb pb.h header. [default: %default]")
+optparser.add_option("-T", "--no-timestamp", dest="notimestamp", action="store_true", default=False,
+ help="Don't add timestamp to .pb.h and .pb.c preambles")
optparser.add_option("-q", "--quiet", dest="quiet", action="store_true", default=False,
help="Don't print anything except errors.")
optparser.add_option("-v", "--verbose", dest="verbose", action="store_true", default=False,