Skip to content

Commit

Permalink
Handle non-ASCII paths etc.
Browse files Browse the repository at this point in the history
See: #20

Signed-off-by: Phil Elwell <[email protected]>
  • Loading branch information
pelwell committed Sep 25, 2023
1 parent be67764 commit bea71b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rpi-source
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def sh_out(cmd):
errcode = process.returncode
if errcode:
return None
return out.decode('ascii')
return out.decode('utf-8')

def writef(f, str, mode='w'):
debug("writef(%s)" % f)
Expand All @@ -109,7 +109,7 @@ def writef(f, str, mode='w'):
def download(url):
debug("download: %s" % url)
try:
res = urllib.request.urlopen(url).read().decode('ascii')
res = urllib.request.urlopen(url).read().decode('utf-8')
except urllib.error.HTTPError as e:
fail(
"Couldn't download %s, HTTPError: %s\n\n%s"
Expand Down Expand Up @@ -190,7 +190,7 @@ def check_gcc():
errcode = process.returncode
if errcode:
debug("gcc version check failed: '%s' returned %d" %(cmd, errcode))
gcc_ver = out.strip().decode('ascii')
gcc_ver = out.strip().decode('utf-8')

with open('/proc/version', 'r') as f:
proc_version = f.read()
Expand All @@ -215,7 +215,7 @@ def proc_config_gz():
return ''

with gzip.open('/proc/config.gz', 'rb') as f:
return f.read().decode('ascii')
return f.read().decode('utf-8')


def processor_type_suffix():
Expand Down

0 comments on commit bea71b9

Please sign in to comment.