Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
Major bug fix for windows release. Better cross-compatability.
  • Loading branch information
2Cas committed Apr 23, 2018
1 parent 5209d9b commit bb50b29
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 52 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ MANIFEST.in
execute.py
avr-gcc/

q2k/BUILD EXEC.lnk
Binary file modified bin/Win/q2k_util.exe
Binary file not shown.
Binary file modified q2k/BUILD EXEC.lnk
Binary file not shown.
36 changes: 23 additions & 13 deletions q2k/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ def __init__(self, kbo, dirs, console):

def __preproc(self, kblibs, arg_list, DEBUG=False):
# Setting up -I and custom define options
qdir = os.path.join(self.__dirs['QMK dir'], 'keyboards')
kb = self.__kb.name
qdir = os.path.join(self.__dirs['QMK dir'], 'keyboards')
kb = self.__kb.name
if platform.system() == 'Linux':
cc = ['avr-gcc', '-E']
cc = ['avr-gcc', '-E']
elif platform.system() == 'Windows':
avr_gcc = os.path.join(defaults.src, 'avr-gcc', 'bin', 'avr-gcc.exe')
cc = [avr_gcc, '-E']
kbdefine = 'KEYBOARD_'+'_'.join(kblibs)
avr_gcc = os.path.join(defaults.src, 'avr-gcc', 'bin', 'avr-gcc.exe')
cc = [avr_gcc, '-E']
kbdefine = 'KEYBOARD_'+'_'.join(kblibs)
QMK_KEYBOARD_H = 'QMK_KEYBOARD_H=\"'+kb+'.h\"'
libs = ['-D', kbdefine, '-D', QMK_KEYBOARD_H, '-I'+self.__dirs['Local libs']]
path = qdir
Expand Down Expand Up @@ -342,6 +342,7 @@ def preproc_keymap(self):
# ===========================================================================================
# KB Information
# ===========================================================================================

class kb_info:

def __init__(self, n=''):
Expand Down Expand Up @@ -372,7 +373,7 @@ def get_rev_info(self, rev):
return r
if r.name == 'n/a':
return r
#───────────────────────────────────────────────────────────────────────────────────────────
# ===========================================================================================
# KB and revision Information
# ===========================================================================================
class rev_info:
Expand Down Expand Up @@ -802,9 +803,7 @@ def __find_layout_names(self, kbo):

def __save_cache(self):
path = os.path.split(self.__loc)[0]
print(self.__loc)
print(path)
#======================================================================================================================

if not os.path.exists(path):
try:
os.makedirs(path)
Expand Down Expand Up @@ -910,12 +909,19 @@ def __set_dirs(self):
with open(pref_yaml, 'r') as f:
self.dirs = yaml.load(f)

self.console.note(['─────────────────────────────────────────────────────────────────', 'Using preferences from '+pref_yaml, '--reset to reset to defaults'])
for key, value in self.dirs.items():
self.dirs[key] = os.path.normpath(value)

if platform.system() == 'Linux':
lines = '─────────────────────────────────────────────────────────────────'
elif platform.system() == 'Windows':
lines = '───────────────────────────────────────────────────────'
self.console.note([lines, 'Using preferences from '+pref_yaml, '--reset to reset to defaults'])

except FileNotFoundError:
self.__generate_dirs()

except AttributeError:
except AttributeError:
self.__generate_dirs()

def __generate_dirs(self):
Expand All @@ -933,7 +939,11 @@ def __generate_dirs(self):
with open(pref_yaml, 'w') as f:
f.write('# Q2K Folder Locations\n')
yaml.dump(dirs, f, default_flow_style = False)
self.console.note(['─────────────────────────────────────────────────────────────────', 'New pref.yaml generated @ '+pref_yaml])
if platform.system() == 'Linux':
lines = '─────────────────────────────────────────────────────────────────'
elif platform.system() == 'Windows':
lines = '───────────────────────────────────────────────────────'
self.console.note([lines, 'New pref.yaml generated @ '+pref_yaml])

except FileNotFoundError:
self.console.error(['Failed to generate '+pref_yaml])
Expand Down
Loading

0 comments on commit bb50b29

Please sign in to comment.