Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ports/stm32/boards/plli2svalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Those processors are listed below in the mcu_support_plli2s[] list.
"""

import gzip
import re
from collections import namedtuple

Expand Down Expand Up @@ -129,7 +130,7 @@ def generate_c_table(plli2s_table, hse, pllm):
def search_header(filename, re_define, lookup):
regex_define = re.compile(re_define)
val = None
with open(filename) as f:
with gzip.open(filename, "rt") as f:
for line in f:
line = line.strip()
m = regex_define.match(line)
Expand Down
3 changes: 2 additions & 1 deletion ports/stm32/boards/pllvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
for the machine.freq() function.
"""

import gzip
import re


Expand Down Expand Up @@ -231,7 +232,7 @@ def search_header_for_hsx_values(filename):
regex_def = re.compile(
r"static.* +(micropy_hw_hs[ei]_value) = +([0-9 +-/\*()]+);",
)
with open(filename) as f:
with gzip.open(filename, "rt") as f:
for line in f:
line = line.strip()
m = regex_def.match(line)
Expand Down
6 changes: 3 additions & 3 deletions py/makeqstrdefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
This script works with Python 3.3+.
"""

import io
import gzip
import os
import re
import subprocess
Expand Down Expand Up @@ -71,7 +71,7 @@ def run(files):
except NotImplementedError:
cpus = 1
p = multiprocessing.dummy.Pool(cpus)
with open(args.output[0], "wb") as out_file:
with gzip.open(args.output[0], "wb", compresslevel=1) as out_file:
for flags, sources in (
(args.cflags, csources),
(args.cxxflags, cxxsources),
Expand Down Expand Up @@ -230,7 +230,7 @@ class Args:
pass

if args.command == "split":
with io.open(args.input_filename, encoding="utf-8") as infile:
with gzip.open(args.input_filename, "rt", encoding="utf-8") as infile:
process_file(infile)

if args.command == "cat":
Expand Down
Loading