summaryrefslogtreecommitdiffstats
path: root/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/__init__.py1
-rw-r--r--lib/util/__init__.pycbin0 -> 158 bytes
-rw-r--r--lib/util/miscutil.py12
-rw-r--r--lib/util/miscutil.pycbin0 -> 345 bytes
-rw-r--r--lib/util/netutil.py18
-rw-r--r--lib/util/netutil.pycbin0 -> 516 bytes
6 files changed, 31 insertions, 0 deletions
diff --git a/lib/util/__init__.py b/lib/util/__init__.py
new file mode 100644
index 0000000..850a751
--- /dev/null
+++ b/lib/util/__init__.py
@@ -0,0 +1 @@
+__all__ = ['netutil','miscutil']
diff --git a/lib/util/__init__.pyc b/lib/util/__init__.pyc
new file mode 100644
index 0000000..9226731
--- /dev/null
+++ b/lib/util/__init__.pyc
Binary files differ
diff --git a/lib/util/miscutil.py b/lib/util/miscutil.py
new file mode 100644
index 0000000..4afa565
--- /dev/null
+++ b/lib/util/miscutil.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+#
+# Licence statement goes here
+#
+
+def read_templatefile(temp_filename):
+ f = open(temp_filename, 'r')
+ lines = f.read().splitlines()
+
+ return lines
+
diff --git a/lib/util/miscutil.pyc b/lib/util/miscutil.pyc
new file mode 100644
index 0000000..ffc4524
--- /dev/null
+++ b/lib/util/miscutil.pyc
Binary files differ
diff --git a/lib/util/netutil.py b/lib/util/netutil.py
new file mode 100644
index 0000000..f8cc2d4
--- /dev/null
+++ b/lib/util/netutil.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+#
+# Licence statement goes here
+#
+
+import socket
+def get_ip():
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ try:
+ # doesn't even have to be reachable
+ s.connect(('192.255.255.255', 1))
+ IP = s.getsockname()[0]
+ except:
+ IP = '127.0.0.1'
+ finally:
+ s.close()
+ return IP
diff --git a/lib/util/netutil.pyc b/lib/util/netutil.pyc
new file mode 100644
index 0000000..ad3953e
--- /dev/null
+++ b/lib/util/netutil.pyc
Binary files differ