Skip to content

Commit a358bce

Browse files
committed
boards.txt.py: fix extra newline at the end of JSON output
1 parent f0787e7 commit a358bce

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

package/package_esp8266com_index.template.json

-1
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,3 @@
261261
}
262262
]
263263
}
264-

tools/boards.txt.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -1190,14 +1190,10 @@ def package ():
11901190
newfilestr = re.sub(r'"boards":[^\]]*\],', substitution, filestr, re.MULTILINE)
11911191

11921192
if packagegen:
1193-
realstdout = sys.stdout
1194-
sys.stdout = open(pkgfname, 'w')
1195-
1196-
print newfilestr
1197-
1198-
if packagegen:
1199-
sys.stdout.close()
1200-
sys.stdout = realstdout
1193+
with open(pkgfname, 'w') as package_file:
1194+
package_file.write(newfilestr)
1195+
else:
1196+
sys.stdout.write(newfilestr)
12011197

12021198
################################################################
12031199

0 commit comments

Comments
 (0)