def do_get_platform_info(): from xpra.os_util import platform_name, platform_release pp = sys.modules.get("platform", python_platform) def get_processor_name(): if pp.system() == "Windows": return pp.processor() elif pp.system() == "Darwin": os.environ['PATH'] = os.environ['PATH'] + os.pathsep + '/usr/sbin' command = "sysctl -n machdep.cpu.brand_string" import subprocess return subprocess.check_output(command).strip() elif pp.system() == "Linux": with open("/proc/cpuinfo") as f: data = f.read() import re for line in data.split("\n"): if "model name" in line: return re.sub(".*model name.*:", "", line, 1).strip() assert False info = {} ld = get_linux_distribution() if ld: info["linux_distribution"] = ld release = platform_release(pp.release()) info.update({ "": sys.platform, "name": platform_name(sys.platform, info.get("linux_distribution") or release), "release": pp.release(), "sysrelease": release, "platform": pp.platform(), "machine": pp.machine(), "processor": pp.processor(), "architecture": pp.architecture(), }) try: info["processor"] = get_processor_name() except: info["processor"] = pp.processor() return info
def do_get_platform_info(): from xpra.os_util import platform_name, platform_release pp = sys.modules.get("platform", python_platform) def get_processor_name(): if pp.system() == "Windows": return pp.processor() elif pp.system() == "Darwin": os.environ['PATH'] = os.environ['PATH'] + os.pathsep + '/usr/sbin' command ="sysctl -n machdep.cpu.brand_string" import subprocess return subprocess.check_output(command).strip() elif pp.system() == "Linux": with open("/proc/cpuinfo") as f: data = f.read() import re for line in data.split("\n"): if "model name" in line: return re.sub(".*model name.*:", "", line,1).strip() assert False info = {} ld = get_linux_distribution() if ld: info["linux_distribution"] = ld release = platform_release(pp.release()) info.update({ "" : sys.platform, "name" : platform_name(sys.platform, info.get("linux_distribution") or release), "release" : pp.release(), "sysrelease": release, "platform" : pp.platform(), "machine" : pp.machine(), "processor" : pp.processor(), "architecture" : pp.architecture(), }) try: info["processor"] = get_processor_name() except: info["processor"] = pp.processor() return info