[jhbuild/wip/lantw/sysid-decode-the-output-of-check_output: 2/2] sysid: decode the output of check_output



commit ddb09116d3326f60bd2678ab07b563fae9cff16e
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Tue Sep 24 16:39:36 2019 +0800

    sysid: decode the output of check_output
    
    Otherwise, JHBuild just crashes immediately on FreeBSD because of mixing
    str and bytes in an expression.

 jhbuild/utils/sysid.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/jhbuild/utils/sysid.py b/jhbuild/utils/sysid.py
index fc4390fe..5ed5cea1 100644
--- a/jhbuild/utils/sysid.py
+++ b/jhbuild/utils/sysid.py
@@ -21,6 +21,8 @@ import sys
 import subprocess
 import ast
 
+from . import udecode
+
 sys_id = None
 sys_name = None
 default_conditions = None
@@ -84,7 +86,7 @@ def get_macos_info():
     global sys_id
 
     try:
-        ver = subprocess.check_output('sw_vers -productVersion')
+        ver = udecode(subprocess.check_output('sw_vers -productVersion'))
 
         sys_name = 'Mac OS X ' + ver
         sys_id = 'macos-' + ver
@@ -99,7 +101,7 @@ def get_freebsd_info():
     global sys_id
 
     try:
-        ver = subprocess.check_output('freebsd-version').strip()
+        ver = udecode(subprocess.check_output('freebsd-version')).strip()
 
         sys_name = 'FreeBSD ' + ver
         return True
@@ -107,7 +109,7 @@ def get_freebsd_info():
         pass
 
     try:
-        ver = subprocess.check_output(['uname', '-r']).strip()
+        ver = udecode(subprocess.check_output(['uname', '-r'])).strip()
 
         sys_name = 'FreeBSD ' + ver
         return True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]