Skip to content

Commit b3c1eb0

Browse files
committed
Reduce the amount of messages output when normal
1 parent 043b820 commit b3c1eb0

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ install:
1212
- pip install -U platformio
1313

1414
script:
15-
- ./configure-features.py -e WIFI -d BLUETOOTH
15+
- ./configure-features.py -e WIFI -d BLUETOOTH -v
1616
- ./build-machine.py test_drive.h
17-
- ./configure-features.py -e BLUETOOTH -d WIFI
17+
- ./configure-features.py -e BLUETOOTH -d WIFI -v
1818
- ./build-machine.py test_drive.h
19-
- ./configure-features.py -e BLUETOOTH WIFI
19+
- ./configure-features.py -e BLUETOOTH WIFI -v
2020
- ./build-all.py
2121

2222
notifications:

configure-features.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ def checkFeatureList(optname, features, verbose=False):
8080
if features:
8181
for n in features:
8282
if isValidFeature(n) is True:
83-
if verbose:
84-
print("valid " + optname + " feature: " + n)
83+
#if verbose:
84+
# print("valid " + optname + " feature: " + n)
85+
pass
8586
else:
8687
print("unknown " + optname + " feature: " + n)
8788
return -1
8889
else:
89-
if verbose:
90-
print(optname + " is not specified")
90+
#if verbose:
91+
# print(optname + " is not specified")
9192
return 0
9293

9394
return len(features)
@@ -133,7 +134,7 @@ def writeConfig(path, buf):
133134
else:
134135
f.close()
135136

136-
def changeConfig(src, enabled, disabled):
137+
def changeConfig(src, enabled, disabled, verbose=False):
137138
dst = ""
138139
regstart = re.compile(r'^\s*//\s*' + eyecatchBeginString)
139140
regend = re.compile(r'^\s*//\s*' + eyecatchEndString)
@@ -168,10 +169,12 @@ def changeConfig(src, enabled, disabled):
168169
break
169170
if len(dstLine) != 0:
170171
dst += dstLine
171-
print(dstLine.rstrip())
172+
if verbose:
173+
print(dstLine.rstrip())
172174
else:
173175
dst += line
174-
print(line.rstrip())
176+
if verbose:
177+
print(line.rstrip())
175178
elif state == 2:
176179
dst += line
177180
if state != 2:
@@ -205,12 +208,12 @@ def main():
205208
# Verification (whether or not to use "choice" with argparse)
206209
numEnables = checkFeatureList("-e", enabledFeatures, verbose)
207210
numDisables = checkFeatureList("-d", disabledFeatures, verbose)
208-
if verbose:
209-
print("enables: ", numEnables)
210-
print(enabledFeatures)
211-
print("disables: ", numDisables)
212-
print(disabledFeatures)
213-
print("config file: " + configFilePath)
211+
#if verbose:
212+
# print("enables: ", numEnables)
213+
# print(enabledFeatures)
214+
# print("disables: ", numDisables)
215+
# print(disabledFeatures)
216+
# print("config file: " + configFilePath)
214217

215218
# Final checking about args
216219
if numEnables < 0 or numDisables < 0 or (numEnables == 0 and numDisables == 0):
@@ -219,7 +222,8 @@ def main():
219222
# Check if the target file exists
220223
configFilePathAbs = os.path.abspath(configFilePath)
221224
if verbose:
222-
print("full path: " + configFilePathAbs)
225+
print("Config path: " + configFilePathAbs)
226+
print()
223227
if not os.path.isfile(configFilePathAbs):
224228
print("config file not found: " + configFilePathAbs)
225229
sys.exit(255)
@@ -228,7 +232,7 @@ def main():
228232
src = readConfig(configFilePathAbs)
229233

230234
# Change the specified settings
231-
dst = changeConfig(src, enabledFeatures, disabledFeatures)
235+
dst = changeConfig(src, enabledFeatures, disabledFeatures, verbose)
232236

233237
# Write back
234238
writeConfig(configFilePathAbs, dst)

0 commit comments

Comments
 (0)