summaryrefslogtreecommitdiffstats
path: root/lib/python/debian_linux/abi.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/debian_linux/abi.py')
-rw-r--r--lib/python/debian_linux/abi.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/python/debian_linux/abi.py b/lib/python/debian_linux/abi.py
new file mode 100644
index 0000000..61e8a66
--- /dev/null
+++ b/lib/python/debian_linux/abi.py
@@ -0,0 +1,37 @@
+class Symbol(object):
+ def __init__(self, name, module, version, export):
+ self.name, self.module = name, module
+ self.version, self.export = version, export
+
+ def __eq__(self, other):
+ if not isinstance(other, Symbol):
+ return NotImplemented
+
+ if self.name != other.name: return False
+ if self.module != other.module: return False
+ if self.version != other.version: return False
+ if self.export != other.export: return False
+
+ return True
+
+ def __ne__(self, other):
+ ret = self.__eq__(other)
+ if ret is NotImplemented:
+ return ret
+ return not ret
+
+class Symbols(dict):
+ def __init__(self, file=None):
+ if file:
+ self.read(file)
+
+ def read(self, file):
+ for line in file:
+ version, name, module, export = line.strip().split()
+ self[name] = Symbol(name, module, version, export)
+
+ def write(self, file):
+ symbols = self.values()
+ symbols.sort(key=lambda i: i.name)
+ for s in symbols:
+ file.write("%s %s %s %s\n" % (s.version, s.name, s.module, s.export))