Skip to content

Commit

Permalink
Python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypoulter committed Oct 21, 2019
1 parent ef4995d commit 56c5766
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/extra_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_c_name(source_file):

def text_to_header(source_file):
with open(source_file) as source_fh:
original = source_fh.read().decode('utf-8')
original = source_fh.read()
filename = get_c_name(source_file)
output = "static const char CONTENT_{}[] PROGMEM = ".format(filename)
for line in original.splitlines():
Expand All @@ -38,7 +38,7 @@ def binary_to_header(source_file):

with open(source_file, "rb") as source_fh:
byte = source_fh.read(1)
while byte != "":
while byte != b"":
output += "0x{:02x}, ".format(ord(byte))
count += 1
if 16 == count:
Expand All @@ -62,7 +62,7 @@ def data_to_header(env, target, source):
target_file = target[0].get_abspath()
print("Generating {}".format(target_file))
with open(target_file, "w") as output_file:
output_file.write(output.encode('utf-8'))
output_file.write(output)

def make_static(env, target, source):
output = ""
Expand Down Expand Up @@ -103,7 +103,7 @@ def make_static(env, target, source):
target_file = target[0].get_abspath()
print("Generating {}".format(target_file))
with open(target_file, "w") as output_file:
output_file.write(output.encode('utf-8'))
output_file.write(output)

def process_html_app(source, dest, env):
web_server_static_files = join(dest, "web_server_static_files.h")
Expand Down

0 comments on commit 56c5766

Please sign in to comment.