- Enables support for running both kll 0.3d and 0.5c at the same time - Adds output support for generatedPixelmap.c - Adds a --version to 0.3ddev
### Imports ### | ### Imports ### | ||||
import copy | |||||
import re | import re | ||||
# 2) | # 2) | ||||
#TODO | #TODO | ||||
print("YAY") | |||||
print( scan_code_lookup ) | |||||
#print("YAY") | |||||
#print( scan_code_lookup ) | |||||
class AnimationData( Data ): | class AnimationData( Data ): |
TextEmitter.__init__( self ) | TextEmitter.__init__( self ) | ||||
# Defaults | # Defaults | ||||
self.map_template = "templates/kiibohdKeymap.h" | |||||
self.def_template = "templates/kiibohdDefs.h" | |||||
self.map_output = "generatedKeymap.h" | |||||
self.def_output = "kll_defs.h" | |||||
self.map_template = "templates/kiibohdKeymap.h" | |||||
self.pixel_template = "templates/kiibohdPixelmap.c" | |||||
self.def_template = "templates/kiibohdDefs.h" | |||||
self.map_output = "generatedKeymap.h" | |||||
self.pixel_output = "generatedPixelmap.c" | |||||
self.def_output = "kll_defs.h" | |||||
self.fill_dict = {} | self.fill_dict = {} | ||||
''' | ''' | ||||
self.def_template = args.def_template | self.def_template = args.def_template | ||||
self.map_template = args.map_template | self.map_template = args.map_template | ||||
self.pixel_template = args.pixel_template | |||||
self.def_output = args.def_output | self.def_output = args.def_output | ||||
self.map_output = args.map_output | self.map_output = args.map_output | ||||
self.pixel_output = args.pixel_output | |||||
def command_line_flags( self, parser ): | def command_line_flags( self, parser ): | ||||
''' | ''' | ||||
help="Specify KLL map .h file template.\n" | help="Specify KLL map .h file template.\n" | ||||
"\033[1mDefault\033[0m: {0}\n".format( self.map_template ) | "\033[1mDefault\033[0m: {0}\n".format( self.map_template ) | ||||
) | ) | ||||
group.add_argument( '--pixel-template', type=str, default=self.pixel_template, | |||||
help="Specify KLL pixel map .c file template.\n" | |||||
"\033[1mDefault\033[0m: {0}\n".format( self.pixel_template ) | |||||
) | |||||
group.add_argument( '--def-output', type=str, default=self.def_output, | group.add_argument( '--def-output', type=str, default=self.def_output, | ||||
help="Specify KLL define .h file output.\n" | help="Specify KLL define .h file output.\n" | ||||
"\033[1mDefault\033[0m: {0}\n".format( self.def_output ) | "\033[1mDefault\033[0m: {0}\n".format( self.def_output ) | ||||
help="Specify KLL map .h file output.\n" | help="Specify KLL map .h file output.\n" | ||||
"\033[1mDefault\033[0m: {0}\n".format( self.map_output ) | "\033[1mDefault\033[0m: {0}\n".format( self.map_output ) | ||||
) | ) | ||||
group.add_argument( '--pixel-output', type=str, default=self.pixel_output, | |||||
help="Specify KLL map .h file output.\n" | |||||
"\033[1mDefault\033[0m: {0}\n".format( self.pixel_output ) | |||||
) | |||||
def output( self ): | def output( self ): | ||||
''' | ''' | ||||
self.generate( self.def_output ) | self.generate( self.def_output ) | ||||
# Load keymap template and generate | # Load keymap template and generate | ||||
self.load_template( self.map_template ) | |||||
self.generate( self.map_output ) | |||||
# TODO | |||||
#self.load_template( self.map_template ) | |||||
#self.generate( self.map_output ) | |||||
# Load pixelmap template and generate | |||||
self.load_template( self.pixel_template ) | |||||
self.generate( self.pixel_output ) | |||||
def process( self ): | def process( self ): | ||||
''' | ''' |
"Default: <backend specific>" ) | "Default: <backend specific>" ) | ||||
pArgs.add_argument( '-h', '--help', action="help", | pArgs.add_argument( '-h', '--help', action="help", | ||||
help="This message." ) | help="This message." ) | ||||
pArgs.add_argument( | |||||
'-v', '--version', | |||||
action="version", | |||||
version="%(prog)s {0}".format( version ), | |||||
help="Show program's version number and exit" | |||||
) | |||||
# Process Arguments | # Process Arguments | ||||
args = pArgs.parse_args() | args = pArgs.parse_args() | ||||
# Get list of files that have changed since the commit | # Get list of files that have changed since the commit | ||||
changed = subprocess.check_output( ['git', 'diff-index', '--name-only', 'HEAD', '--'] ).decode().splitlines() | changed = subprocess.check_output( ['git', 'diff-index', '--name-only', 'HEAD', '--'] ).decode().splitlines() | ||||
# Get commit date | |||||
date = subprocess.check_output( ['git', 'show', '-s', '--format=%ci'] ).decode()[:-1] | |||||
except: | except: | ||||
revision = "<no git>" | revision = "<no git>" | ||||
changed = [] | changed = [] | ||||
date = "<no date>" | |||||
# Change back to the old working directory | # Change back to the old working directory | ||||
os.chdir( origPath ) | os.chdir( origPath ) | ||||
return revision, changed | |||||
return revision, changed, date | |||||
### Main Entry Point ### | ### Main Entry Point ### | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
(baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs() | |||||
# Look up git information on the compiler | # Look up git information on the compiler | ||||
gitRev, gitChanges = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) ) | |||||
gitRev, gitChanges, gitDate = gitRevision( os.path.dirname( os.path.realpath( __file__ ) ) ) | |||||
global version | |||||
version = "BACKPORT 0.3d.{0} - {1}".format( gitRev, gitDate ) | |||||
(baseFiles, defaultFiles, partialFileSets, backend_name, templates, outputs) = processCommandLineArgs() | |||||
# Load backend module | # Load backend module | ||||
global backend | global backend |
/* Copyright (C) 2016 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 | |||||
* the Free Software Foundation, either version 3 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* This file is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with this file. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
<|Information|> | |||||
#pragma once | |||||
// ----- Includes ----- | |||||
// KLL Include | |||||
// TODO | |||||