[1] + try: + current = None + + for line in file: + parts = line.split(":", 1) + key = parts[0].strip() + + if key == "Processor": + # ARM doesn't support SMP, thus no processor-id in + # the cpuinfo + current = {"processor-id": 0, + "model": parts[1].strip()} + processors.append(current) + elif key == "Cache size": + value_parts = parts[1].split() + current["cache-size"] = int(value_parts[0].strip()) + finally: + file.close()
I think current should be initially set to {}. If the ordering of keys in /proc/cpuinfo ever results in 'Cache size' coming before 'Processor', this code will break. current can be appended to the processors list can happen just after the for loop if bool(current) is True. +1 considering #1. -- Support for ARM architecture https://bugs.launchpad.net/bugs/317285 You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs