[tor-commits] [trunnel/master] Move version to lib/trunnel/__init__.py; put it in output files.

nickm at torproject.org nickm at torproject.org
Thu Sep 25 16:28:30 UTC 2014


commit d8f214bdb71798d08e66e273cbe39f5db0d5c1c4
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Sep 25 12:27:30 2014 -0400

    Move version to lib/trunnel/__init__.py; put it in output files.
    
    Closes ticket #13244
---
 lib/trunnel/CodeGen.py  |   13 +++++++++----
 lib/trunnel/__init__.py |    3 +++
 setup.py                |    5 ++++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py
index e133747..90178fc 100644
--- a/lib/trunnel/CodeGen.py
+++ b/lib/trunnel/CodeGen.py
@@ -2715,8 +2715,10 @@ class ParseFnGenerator(CodeGenerator):
         self.w('/* Skip to end of union */\n')
         self.w('ptr += remaining; remaining = 0;\n')
 
-HEADER_BOILERPLATE = """
-/* %(h_fname)s -- generated by trunnel. */
+HEADER_BOILERPLATE = """\
+/* %(h_fname)s -- generated by by Trunnel v%(version)s.
+ * https://gitweb.torproject.org/trunnel.git
+ */
 #ifndef %(guard_macro)s
 #define %(guard_macro)s
 
@@ -2730,8 +2732,10 @@ HEADER_FOOTER = """
 #endif
 """
 
-MODULE_BOILERPLATE = """
-/* %(c_fname)s -- generated by trunnel. */
+MODULE_BOILERPLATE = """\
+/* %(c_fname)s -- generated by Trunnel v%(version)s.
+ * https://gitweb.torproject.org/trunnel.git
+ */
 #include <stdlib.h>
 #include "trunnel-impl.h"
 %(expose_definitions)s
@@ -2780,6 +2784,7 @@ def generate_code(input_fname, extra_options=[]):
         'h_fname': os.path.split(h_fname)[1],
         'c_fname': os.path.split(c_fname)[1],
         'expose_definitions': "".join(expose_definitions),
+        'version' : trunnel.__version__
     }
 
     out_h = open(h_fname, 'w')
diff --git a/lib/trunnel/__init__.py b/lib/trunnel/__init__.py
index 7f71a69..0ed28df 100644
--- a/lib/trunnel/__init__.py
+++ b/lib/trunnel/__init__.py
@@ -2,3 +2,6 @@
 # This file must exist so that Python recognizes this directory as holding
 # a package.
 #
+
+__version__ = "1.1-dev"
+
diff --git a/setup.py b/setup.py
index f426af2..6d10939 100644
--- a/setup.py
+++ b/setup.py
@@ -1,8 +1,11 @@
 
 from distutils.core import setup
 
+namespace = {}
+exec(open("./lib/trunnel/__init__.py").read(), namespace)
+
 setup(name='Trunnel',
-      version='1.1',
+      version=namespace['__version__'],
       description='Trunnel binary format parser',
       author='Nick Mathewson',
       author_email='nickm at torproject.org',



More information about the tor-commits mailing list