Ticket #3633: hostinfo.patch

File hostinfo.patch, 0.9 kB (added by yi, 5 months ago)
  • a/sage/dsage/misc/hostinfo.py

    old new  
    1515# 
    1616#                  http://www.gnu.org/licenses/ 
    1717############################################################################ 
     18 
    1819import os 
     20import commands 
     21 
    1922 
    2023class HostInfo(object): 
    2124    """ 
     
    8083                    else: 
    8184                        host_info[key] = value.strip() 
    8285        elif host_info['os'] == 'Darwin': 
    83             for line in os.popen('sysctl -a hw machdep').readlines(): 
     86            for line in commands.getoutput('sysctl -a hw machdep').split('\n'): 
    8487                l = line.strip() 
    8588                if '=' in l: 
    8689                    l = l.split('=')