mirror of
https://github.com/bdring/Grbl_Esp32.git
synced 2025-08-18 12:21:39 +02:00
Merge pull request #360 from odaki/travis-ci-with-platformio
add the define to enable if it was not found in the block
This commit is contained in:
@@ -72,7 +72,7 @@ def parseArgs(defaultConfigPath):
|
|||||||
|
|
||||||
def isValidFeature(feature):
|
def isValidFeature(feature):
|
||||||
if feature:
|
if feature:
|
||||||
if feature.upper() in validFeatureList:
|
if feature in validFeatureList:
|
||||||
return True #valid
|
return True #valid
|
||||||
return False #invalid
|
return False #invalid
|
||||||
|
|
||||||
@@ -136,6 +136,9 @@ def writeConfig(path, buf):
|
|||||||
|
|
||||||
def changeConfig(src, enabled, disabled, verbose=False):
|
def changeConfig(src, enabled, disabled, verbose=False):
|
||||||
dst = ""
|
dst = ""
|
||||||
|
numEnabledDic = {}
|
||||||
|
for name in enabled:
|
||||||
|
numEnabledDic[name] = 0
|
||||||
regstart = re.compile(r'^\s*//\s*' + eyecatchBeginString)
|
regstart = re.compile(r'^\s*//\s*' + eyecatchBeginString)
|
||||||
regend = re.compile(r'^\s*//\s*' + eyecatchEndString)
|
regend = re.compile(r'^\s*//\s*' + eyecatchEndString)
|
||||||
state = 0;
|
state = 0;
|
||||||
@@ -149,6 +152,10 @@ def changeConfig(src, enabled, disabled, verbose=False):
|
|||||||
# in the defines block to modify
|
# in the defines block to modify
|
||||||
if regend.match(line):
|
if regend.match(line):
|
||||||
# end of block found
|
# end of block found
|
||||||
|
for name in enabled:
|
||||||
|
# add the define to enable if it was not found in the block
|
||||||
|
if numEnabledDic[name] == 0:
|
||||||
|
dst += "#define " + enablePrefix + name + '\n'
|
||||||
state = 2
|
state = 2
|
||||||
dst += line
|
dst += line
|
||||||
else:
|
else:
|
||||||
@@ -159,6 +166,7 @@ def changeConfig(src, enabled, disabled, verbose=False):
|
|||||||
m = re.match(r'^s*//\s*#define\s+(' + s + r'.*)$', line)
|
m = re.match(r'^s*//\s*#define\s+(' + s + r'.*)$', line)
|
||||||
if m:
|
if m:
|
||||||
dstLine = "#define " + m.group(1) + '\n'
|
dstLine = "#define " + m.group(1) + '\n'
|
||||||
|
numEnabledDic[name] += 1
|
||||||
break
|
break
|
||||||
if len(disabled) > 0:
|
if len(disabled) > 0:
|
||||||
for name in disabled:
|
for name in disabled:
|
||||||
|
Reference in New Issue
Block a user