]> git.donarmstrong.com Git - kiibohd-kll.git/blobdiff - backends/kiibohd.py
Adding more generation debug output
[kiibohd-kll.git] / backends / kiibohd.py
index c035fb28f39b1fa31bf27b38779966a864c06165..19168a256cc7046dd5f72867a4e8e274a72a3013 100644 (file)
@@ -3,7 +3,7 @@
 #
 # Backend code generator for the Kiibohd Controller firmware.
 #
-# Copyright (C) 2014 by Jacob Alexander
+# Copyright (C) 2014-2015 by Jacob Alexander
 #
 # This file is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@ import os
 import sys
 import re
 
+from datetime import date
+
 # Modifying Python Path, which is dumb, but the only way to import up one directory...
 sys.path.append( os.path.expanduser('..') )
 
@@ -72,6 +74,7 @@ class Backend:
                return "usbKeyOut";
 
 
+       # TODO
        def layerInformation( self, name, date, author ):
                self.fill_dict['Information'] += "//  Name:    {0}\n".format( "TODO" )
                self.fill_dict['Information'] += "//  Version: {0}\n".format( "TODO" )
@@ -80,14 +83,31 @@ class Backend:
 
 
        # Processes content for fill tags and does any needed dataset calculations
-       def process( self, capabilities, macros, variables ):
+       def process( self, capabilities, macros, variables, gitRev, gitChanges ):
+               # Build string list of compiler arguments
+               compilerArgs = ""
+               for arg in sys.argv:
+                       if "--" in arg or ".py" in arg:
+                               compilerArgs += "//    {0}\n".format( arg )
+                       else:
+                               compilerArgs += "//      {0}\n".format( arg )
+
+               # Build a string of modified files, if any
+               gitChangesStr = "\n"
+               if len( gitChanges ) > 0:
+                       for gitFile in gitChanges:
+                               gitChangesStr += "//    {0}\n".format( gitFile )
+               else:
+                       gitChangesStr = "    None\n"
+
                ## Information ##
                # TODO
                self.fill_dict['Information']  = "// This file was generated by the kll compiler, DO NOT EDIT.\n"
-               self.fill_dict['Information'] += "// Generation Date:    {0}\n".format( "TODO" )
-               self.fill_dict['Information'] += "// Compiler arguments: {0}\n".format( "TODO" )
+               self.fill_dict['Information'] += "// Generation Date:    {0}\n".format( date.today() )
                self.fill_dict['Information'] += "// KLL Backend:        {0}\n".format( "kiibohd" )
-               self.fill_dict['Information'] += "// KLL Git Rev:        {0}\n".format( "TODO" )
+               self.fill_dict['Information'] += "// KLL Git Rev:        {0}\n".format( gitRev )
+               self.fill_dict['Information'] += "// KLL Git Changes:{0}".format( gitChangesStr )
+               self.fill_dict['Information'] += "// Compiler arguments:\n{0}".format( compilerArgs )
                self.fill_dict['Information'] += "//\n"
                self.fill_dict['Information'] += "// - Base Layer -\n"
                self.fill_dict['Information'] += "// - Default Layer -\n"