From cee9b7f13d54f5979bd0411e2632f84439567876 Mon Sep 17 00:00:00 2001
From: "SND\\EreTIk_cp" <SND\EreTIk_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Mon, 16 Jan 2012 13:31:04 +0000
Subject: [PATCH] [0.1.x] + version string

git-svn-id: https://pykd.svn.codeplex.com/svn@73229 9b283d60-5439-405e-af05-b73fd8c4d996
---
 pykd/dbgext.cpp          | 7 +++++++
 pykd/pykd.rc             | 5 +++--
 pykd/pykd_2008.vcproj    | 4 ++++
 pykd/pykdver.h           | 9 +++++++++
 test/scripts/pykdtest.py | 6 +++++-
 5 files changed, 28 insertions(+), 3 deletions(-)
 create mode 100644 pykd/pykdver.h

diff --git a/pykd/dbgext.cpp b/pykd/dbgext.cpp
index d246b88..429661c 100644
--- a/pykd/dbgext.cpp
+++ b/pykd/dbgext.cpp
@@ -18,11 +18,16 @@
 #include "dbgmem.h"
 #include "intbase.h"
 #include "process.h"
+#include "pykdver.h"
 
 using namespace pykd;
 
 ////////////////////////////////////////////////////////////////////////////////
 
+static const std::string pykdVersion = PYKD_VERSION_BUILD;
+
+////////////////////////////////////////////////////////////////////////////////
+
 BOOL WINAPI DllMain(
   __in  HINSTANCE /*hinstDLL*/,
   __in  DWORD fdwReason,
@@ -99,6 +104,8 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS( pyDia_Symbol_findChildrenEx, pyDia::Symb
 
 BOOST_PYTHON_MODULE( pykd )
 {
+    python::scope().attr("version") = pykdVersion;
+
     python::class_<intBase>( "intBase", "intBase", python::no_init )
         .def( python::init<python::object&>() )
         .def( "__eq__", &intBase::eq )
diff --git a/pykd/pykd.rc b/pykd/pykd.rc
index a4287e7..6fa5ca1 100644
--- a/pykd/pykd.rc
+++ b/pykd/pykd.rc
@@ -8,6 +8,7 @@
 // Generated from the TEXTINCLUDE 2 resource.
 //
 #include "afxres.h"
+#include "pykdver.h"
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
@@ -70,11 +71,11 @@ BEGIN
         BLOCK "041904b0"
         BEGIN
             VALUE "FileDescription", "pykd - python extension for windbg"
-            VALUE "FileVersion", "0, 1, 0, 5"
+            VALUE "FileVersion", PYKD_VERSION_BUILD
             VALUE "InternalName", "pykd"
             VALUE "OriginalFilename", "pykd.dll"
             VALUE "ProductName", "pykd  - python extension for windbg"
-            VALUE "ProductVersion", "0, 1, 0, 5"
+            VALUE "ProductVersion", PYKD_VERSION_BUILD
         END
     END
     BLOCK "VarFileInfo"
diff --git a/pykd/pykd_2008.vcproj b/pykd/pykd_2008.vcproj
index 41a976e..9ae61f6 100644
--- a/pykd/pykd_2008.vcproj
+++ b/pykd/pykd_2008.vcproj
@@ -563,6 +563,10 @@
 				RelativePath=".\pyaux.h"
 				>
 			</File>
+			<File
+				RelativePath=".\pykdver.h"
+				>
+			</File>
 			<File
 				RelativePath=".\resource.h"
 				>
diff --git a/pykd/pykdver.h b/pykd/pykdver.h
new file mode 100644
index 0000000..c660330
--- /dev/null
+++ b/pykd/pykdver.h
@@ -0,0 +1,9 @@
+
+#define __VER_STR2__(x) #x
+#define __VER_STR1__(x) __VER_STR2__(x)
+
+#define PYKD_VERSION_MAJOR  1
+#define PYKD_VERSION_MINOR  5
+
+#define PYKD_VERSION_BUILD  \
+    "0." __VER_STR1__(PYKD_VERSION_MAJOR) ".0." __VER_STR1__(PYKD_VERSION_MINOR)
diff --git a/test/scripts/pykdtest.py b/test/scripts/pykdtest.py
index 35adcd6..621f8f5 100644
--- a/test/scripts/pykdtest.py
+++ b/test/scripts/pykdtest.py
@@ -51,10 +51,12 @@ def getTestSuite( singleName = "" ):
 
 if __name__ == "__main__":
 
+    print "\nTesting PyKd " + pykd.version
+
     target.appPath = sys.argv[1]
 
     target.moduleName = os.path.splitext(os.path.basename(target.appPath))[0]
-    print "\nTest module: %s" % target.appPath
+    print "Test module: %s" % target.appPath
 
     pykd.startProcess( target.appPath )
 
@@ -63,6 +65,8 @@ if __name__ == "__main__":
 
     pykd.go()
 
+    print ""
+
     suite = getTestSuite()
     #suite = getTestSuite( "typedvar.TypedVarTest.testBitField" )
     #suite = getTestSuite( "typeinfo.TypeInfoTest.testBitField" )