@@ -88,7 +88,7 @@ def run_command(self, cmd, suppress_message=False, return_output=False):
88
88
if not suppress_message :
89
89
self .info (decoded_output )
90
90
full_output += decoded_output
91
- except Exception as err : # pylint: disable=broad-except
91
+ except Exception : # pylint: disable=broad-except
92
92
pass
93
93
finally :
94
94
sys .stdout = original_stdout
@@ -294,7 +294,7 @@ def pattern_search(self, location, pattern, multi_line=False):
294
294
295
295
if self .exists (location ) and not self .isdir (location ):
296
296
if multi_line :
297
- with open (location , "r+" ) as file :
297
+ with open (location , "r+" , encoding = "utf-8" ) as file :
298
298
if re .search (pattern , file .read (), flags = re .DOTALL ):
299
299
found = True
300
300
else :
@@ -315,7 +315,7 @@ def pattern_replace(self, location, pattern, replace="", multi_line=False):
315
315
if self .pattern_search (location , pattern , multi_line ):
316
316
if multi_line :
317
317
regex = re .compile (pattern , flags = re .DOTALL )
318
- with open (location , "r+" ) as file :
318
+ with open (location , "r+" , encoding = "utf-8" ) as file :
319
319
data = file .read ()
320
320
file .seek (0 )
321
321
file .write (regex .sub (replace , data ))
@@ -397,7 +397,7 @@ def write_text_file(self, path, content, append=True):
397
397
content = "\n " + content
398
398
else :
399
399
mode = "w"
400
- with open (self .path (path ), mode ) as service_file :
400
+ with open (self .path (path ), mode , encoding = "utf-8" ) as service_file :
401
401
service_file .write (content )
402
402
403
403
@staticmethod
@@ -441,6 +441,13 @@ def is_armv8():
441
441
"""
442
442
return platform .machine () == "armv8l"
443
443
444
+ @staticmethod
445
+ def is_arm64 ():
446
+ """
447
+ Check if Platform.machine() returns ARM 64
448
+ """
449
+ return platform .machine () == "aarch64"
450
+
444
451
@staticmethod
445
452
def get_arch ():
446
453
"""Return a string containing the architecture"""
@@ -461,15 +468,17 @@ def get_os(self):
461
468
)
462
469
release = None
463
470
if os .path .exists ("/etc/os-release" ):
464
- with open ("/etc/os-release" ) as f :
471
+ with open ("/etc/os-release" , encoding = "utf-8" ) as f :
465
472
if "Raspbian" in f .read ():
466
473
release = "Raspbian"
467
474
if self .run_command ("command -v apt-get" , suppress_message = True ):
468
- with open ("/etc/os-release" ) as f :
475
+ with open ("/etc/os-release" , encoding = "utf-8" ) as f :
469
476
release_file = f .read ()
470
477
for opsys in os_releases :
471
478
if opsys in release_file :
472
479
release = opsys
480
+ if release == "Debian" and os .path .exists ("/etc/rpi-issue" ):
481
+ release = "Raspbian"
473
482
if os .path .isdir (os .path .expanduser ("~/.kano-settings" )) or os .path .isdir (
474
483
os .path .expanduser ("~/.kanoprofile" )
475
484
):
@@ -486,7 +495,7 @@ def get_raspbian_version(self):
486
495
return None
487
496
raspbian_releases = ("buster" , "stretch" , "jessie" , "wheezy" )
488
497
if os .path .exists ("/etc/os-release" ):
489
- with open ("/etc/os-release" ) as f :
498
+ with open ("/etc/os-release" , encoding = "utf-8" ) as f :
490
499
release_file = f .read ()
491
500
if "/sid" in release_file :
492
501
return "unstable"
0 commit comments