소스 검색

replace cpuinfo-module

Marcus 8 년 전
부모
커밋
90d38d6979
2개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 0 1
      README.md
  2. 11 2
      ext-respondd.py

+ 0 - 1
README.md

@@ -9,7 +9,6 @@ A gluon compatible status script for respondd in python.
  * ethtool
  * python3.3
  * python3-netifaces
- * py-cpuinfo
  * batman-adv
 
 ## Setup

+ 11 - 2
ext-respondd.py

@@ -21,7 +21,6 @@ import json
 import zlib
 
 import netifaces as netif
-from cpuinfo import cpuinfo
 
 def toUTF8(line):
     return line.decode("utf-8")
@@ -275,6 +274,16 @@ def getNeighbours():
                     }
     return j
 
+def getCPUInfo():
+    j = {}
+    with open("/proc/cpuinfo", 'r') as fh:
+        for line in fh:
+            ml = re.match(r"^(.+?)[\t ]+:[\t ]+(.*)$", line, re.I)
+
+            if ml:
+                j[ml.group(1)] = ml.group(2)
+    return j
+
 # ======================== Output =========================
 # =========================================================
 
@@ -314,7 +323,7 @@ def createNodeinfo():
             },
         },
         "hardware": {
-            "model": cpuinfo.get_cpu_info()["brand"],
+            "model": getCPUInfo()["model name"],
             "nproc": int(call(['nproc'])[0]),
         },
 #        "vpn": True,