Skip to content

Commit bb50b29

Browse files
author
2Cas
committed
Bug fixes
Major bug fix for windows release. Better cross-compatability.
1 parent 5209d9b commit bb50b29

File tree

6 files changed

+69
-52
lines changed

6 files changed

+69
-52
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ MANIFEST.in
114114
execute.py
115115
avr-gcc/
116116

117+
q2k/BUILD EXEC.lnk

bin/Win/q2k_util.exe

-2.15 KB
Binary file not shown.

q2k/BUILD EXEC.lnk

68 Bytes
Binary file not shown.

q2k/core.py

+23-13
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ def __init__(self, kbo, dirs, console):
277277

278278
def __preproc(self, kblibs, arg_list, DEBUG=False):
279279
# Setting up -I and custom define options
280-
qdir = os.path.join(self.__dirs['QMK dir'], 'keyboards')
281-
kb = self.__kb.name
280+
qdir = os.path.join(self.__dirs['QMK dir'], 'keyboards')
281+
kb = self.__kb.name
282282
if platform.system() == 'Linux':
283-
cc = ['avr-gcc', '-E']
283+
cc = ['avr-gcc', '-E']
284284
elif platform.system() == 'Windows':
285-
avr_gcc = os.path.join(defaults.src, 'avr-gcc', 'bin', 'avr-gcc.exe')
286-
cc = [avr_gcc, '-E']
287-
kbdefine = 'KEYBOARD_'+'_'.join(kblibs)
285+
avr_gcc = os.path.join(defaults.src, 'avr-gcc', 'bin', 'avr-gcc.exe')
286+
cc = [avr_gcc, '-E']
287+
kbdefine = 'KEYBOARD_'+'_'.join(kblibs)
288288
QMK_KEYBOARD_H = 'QMK_KEYBOARD_H=\"'+kb+'.h\"'
289289
libs = ['-D', kbdefine, '-D', QMK_KEYBOARD_H, '-I'+self.__dirs['Local libs']]
290290
path = qdir
@@ -342,6 +342,7 @@ def preproc_keymap(self):
342342
# ===========================================================================================
343343
# KB Information
344344
# ===========================================================================================
345+
345346
class kb_info:
346347

347348
def __init__(self, n=''):
@@ -372,7 +373,7 @@ def get_rev_info(self, rev):
372373
return r
373374
if r.name == 'n/a':
374375
return r
375-
#───────────────────────────────────────────────────────────────────────────────────────────
376+
# ===========================================================================================
376377
# KB and revision Information
377378
# ===========================================================================================
378379
class rev_info:
@@ -802,9 +803,7 @@ def __find_layout_names(self, kbo):
802803

803804
def __save_cache(self):
804805
path = os.path.split(self.__loc)[0]
805-
print(self.__loc)
806-
print(path)
807-
#======================================================================================================================
806+
808807
if not os.path.exists(path):
809808
try:
810809
os.makedirs(path)
@@ -910,12 +909,19 @@ def __set_dirs(self):
910909
with open(pref_yaml, 'r') as f:
911910
self.dirs = yaml.load(f)
912911

913-
self.console.note(['─────────────────────────────────────────────────────────────────', 'Using preferences from '+pref_yaml, '--reset to reset to defaults'])
912+
for key, value in self.dirs.items():
913+
self.dirs[key] = os.path.normpath(value)
914+
915+
if platform.system() == 'Linux':
916+
lines = '─────────────────────────────────────────────────────────────────'
917+
elif platform.system() == 'Windows':
918+
lines = '───────────────────────────────────────────────────────'
919+
self.console.note([lines, 'Using preferences from '+pref_yaml, '--reset to reset to defaults'])
914920

915921
except FileNotFoundError:
916922
self.__generate_dirs()
917923

918-
except AttributeError:
924+
except AttributeError:
919925
self.__generate_dirs()
920926

921927
def __generate_dirs(self):
@@ -933,7 +939,11 @@ def __generate_dirs(self):
933939
with open(pref_yaml, 'w') as f:
934940
f.write('# Q2K Folder Locations\n')
935941
yaml.dump(dirs, f, default_flow_style = False)
936-
self.console.note(['─────────────────────────────────────────────────────────────────', 'New pref.yaml generated @ '+pref_yaml])
942+
if platform.system() == 'Linux':
943+
lines = '─────────────────────────────────────────────────────────────────'
944+
elif platform.system() == 'Windows':
945+
lines = '───────────────────────────────────────────────────────'
946+
self.console.note([lines, 'New pref.yaml generated @ '+pref_yaml])
937947

938948
except FileNotFoundError:
939949
self.console.error(['Failed to generate '+pref_yaml])

0 commit comments

Comments
 (0)