Browse Source

move python lib path ISC/CC to isc/cc

git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@695 e5f2f494-b856-4b98-b285-d166d9295462
Jelte Jansen 15 years ago
parent
commit
119fd99358

+ 4 - 1
Makefile.am

@@ -34,7 +34,10 @@ pyshared:
 	mkdir pyshared
 	mkdir pyshared/isc
 	ln -s ${abs_top_srcdir}/src/lib/config/python/isc/config pyshared/isc/config
-	ln -s ${abs_top_srcdir}/src/lib/cc/python/ISC/CC pyshared/isc/cc
+	cat ${abs_top_srcdir}/src/lib/config/python/isc/__init__.py >> pyshared/isc/__init__.py
+	ln -s ${abs_top_srcdir}/src/lib/cc/python/isc/cc pyshared/isc/cc
+	ln -s ${abs_top_srcdir}/src/lib/cc/python/isc/cc pyshared/isc/Util
+	cat ${abs_top_srcdir}/src/lib/cc/python/isc/__init__.py >> pyshared/isc/__init__.py
 
 include:
 	mkdir include

+ 3 - 3
configure.ac

@@ -157,9 +157,9 @@ AC_CONFIG_FILES([Makefile
                  src/lib/cc/Makefile
                  src/lib/cc/cpp/Makefile
                  src/lib/cc/python/Makefile
-                 src/lib/cc/python/ISC/Makefile
-                 src/lib/cc/python/ISC/CC/Makefile
-                 src/lib/cc/python/ISC/Util/Makefile
+                 src/lib/cc/python/isc/Makefile
+                 src/lib/cc/python/isc/cc/Makefile
+                 src/lib/cc/python/isc/Util/Makefile
                  src/lib/config/Makefile
                  src/lib/config/cpp/Makefile
                  src/lib/config/python/Makefile

+ 3 - 3
src/bin/bind10/bind10.py.in

@@ -46,7 +46,7 @@ import select
 import pprint
 from optparse import OptionParser, OptionValueError
 
-import ISC.CC
+import isc.cc
 import isc
 
 # This is the version that gets displayed to the user.
@@ -164,8 +164,8 @@ class BoB:
                 return "Unable to connect to c-channel after 5 seconds"
             # try to connect, and if we can't wait a short while
             try:
-                self.cc_session = ISC.CC.Session(self.c_channel_port)
-            except ISC.CC.session.SessionError:
+                self.cc_session = isc.cc.Session(self.c_channel_port)
+            except isc.cc.session.SessionError:
                 time.sleep(0.1)
         #self.cc_session.group_subscribe("Boss", "boss")
 

+ 1 - 1
src/bin/bind10/run_bind10.sh.in

@@ -8,7 +8,7 @@ BIND10_PATH=@abs_top_builddir@/src/bin/bind10
 PATH=@abs_top_builddir@/src/bin/msgq:@abs_top_builddir@/src/bin/auth:@abs_top_builddir@/src/bin/cfgmgr:@abs_top_builddir@/src/bin/cmdctl:$PATH
 export PATH
 
-PYTHONPATH=@abs_top_srcdir@/src/lib/cc/python:@abs_top_srcdir@/src/lib/config/python
+PYTHONPATH=@abs_top_srcdir@/pyshared/
 export PYTHONPATH
 
 B10_FROM_SOURCE=@abs_top_srcdir@

+ 5 - 5
src/bin/bindctl/bindcmd.py

@@ -20,8 +20,8 @@ from exception import *
 from moduleinfo import *
 from cmdparse import BindCmdParse
 from xml.dom import minidom
-import ISC
-import ISC.CC.data
+import isc
+import isc.cc.data
 import http.client
 import json
 import inspect
@@ -85,7 +85,7 @@ class BindCmdInterpreter(Cmd):
                 return False
 
             # Get all module information from cmd-ctrld
-            self.config_data = ISC.CC.data.UIConfigData(self)
+            self.config_data = isc.cc.data.UIConfigData(self)
             self.update_commands()
             self.cmdloop()
         except KeyboardInterrupt:
@@ -453,9 +453,9 @@ class BindCmdInterpreter(Cmd):
                 self.config_data.commit(self)
             elif cmd.command == "go":
                 self.go(identifier)
-        except ISC.CC.data.DataTypeError as dte:
+        except isc.cc.data.DataTypeError as dte:
             print("Error: " + str(dte))
-        except ISC.CC.data.DataNotFoundError as dnfe:
+        except isc.cc.data.DataNotFoundError as dnfe:
             print("Error: " + identifier + " not found")
         except KeyError as ke:
             print("Error: missing " + str(ke))

+ 1 - 1
src/bin/bindctl/bindctl.py

@@ -16,7 +16,7 @@
 
 from moduleinfo  import *
 from bindcmd import *
-import ISC
+import isc
 import pprint
 
 

+ 3 - 3
src/bin/cfgmgr/cfgmgr.py

@@ -1,9 +1,9 @@
-import ISC
+import isc
 import signal
 import ast
 import pprint
 import os
-from ISC.CC import data
+from isc.cc import data
 
 class ConfigManagerData:
     CONFIG_VERSION = 1
@@ -58,7 +58,7 @@ class ConfigManager:
         self.data_definitions = {}
         self.data_path = data_path
         self.config = ConfigManagerData(data_path)
-        self.cc = ISC.CC.Session()
+        self.cc = isc.cc.Session()
         self.cc.group_subscribe("ConfigManager")
         self.cc.group_subscribe("Boss", "ConfigManager")
         self.running = False

+ 3 - 3
src/bin/cmdctl/b10-cmdctl.py.in

@@ -33,7 +33,7 @@ import urllib.parse
 import json
 import re
 import ssl, socket
-import ISC
+import isc
 import pprint
 import select
 import csv
@@ -180,7 +180,7 @@ class CommandControl():
     '''
 
     def __init__(self):
-        self.cc = ISC.CC.Session()
+        self.cc = isc.cc.Session()
         self.cc.group_subscribe('Cmd-Ctrld')
         #self.cc.group_subscribe('Boss', 'Cmd-Ctrld')
         self.command_spec = self.get_cmd_specification()
@@ -339,7 +339,7 @@ def run(server_class = SecureHTTPServer, addr = 'localhost', port = 8080):
 if __name__ == '__main__':
     try:
         run()
-    except ISC.CC.SessionError as se:
+    except isc.cc.SessionError as se:
         print("[b10-cmdctl] Error creating b10-cmdctl, "
                 "is the command channel daemon running?")        
     except KeyboardInterrupt:

+ 4 - 4
src/bin/msgq/msgq.py.in

@@ -17,7 +17,7 @@ import pprint
 import random
 from optparse import OptionParser, OptionValueError
 
-import ISC.CC
+import isc.cc
 
 # This is the version that gets displayed to the user.
 __version__ = "v20091030 (Paving the DNS Parking Lot)"
@@ -202,7 +202,7 @@ class MsgQ:
             return
 
         try:
-            routingmsg = ISC.CC.message.from_wire(routing)
+            routingmsg = isc.cc.message.from_wire(routing)
         except DecodeError as err:
             self.kill_socket(fd, sock)
             sys.stderr.write("Routing decode error: %s\n" % err)
@@ -232,9 +232,9 @@ class MsgQ:
 
     def preparemsg(self, env, msg = None):
         if type(env) == dict:
-            env = ISC.CC.message.to_wire(env)
+            env = isc.cc.message.to_wire(env)
         if type(msg) == dict:
-            msg = ISC.CC.message.to_wire(msg)
+            msg = isc.cc.message.to_wire(msg)
         length = 2 + len(env);
         if msg:
             length += len(msg)

+ 2 - 2
src/bin/stats/statsd.py

@@ -3,7 +3,7 @@
 # This program collects 'counters' from 'statistics' channel.
 # It accepts one command: 'Boss' group 'shutdown'
 
-import ISC.CC
+import isc.cc
 import time
 import select
 import os
@@ -103,7 +103,7 @@ def dump_stats(statpath, statcount, stat, statraw):
     os.rename(statpath + '.new', statpath)
 
 def collector(statgroup,step,statpath,statcount):
-    cc = ISC.CC.Session()
+    cc = isc.cc.Session()
     if debug:
         print ("cc.lname=",cc.lname)
     cc.group_subscribe(statgroup)

+ 2 - 2
src/bin/stats/test/shutdown.py

@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import ISC
-cc = ISC.CC.Session()
+import isc
+cc = isc.cc.Session()
 cc.group_subscribe("Boss")
 cc.group_sendmsg({ "command":"shutdown"},"Boss")

+ 2 - 2
src/bin/stats/test/test_agent.py

@@ -6,7 +6,7 @@
 # One command is available
 #   "Boss"       group: "shutdown"
 
-import ISC
+import isc
 import time
 import select
 import random
@@ -14,7 +14,7 @@ import random
 step_time = 10
 statgroup = "statistics"
 
-cc = ISC.CC.Session()
+cc = isc.cc.Session()
 print (cc.lname)
 #cc.group_subscribe(statgroup)
 cc.group_subscribe("Boss")

+ 0 - 6
src/lib/cc/python/ISC/CC/Makefile.am

@@ -1,6 +0,0 @@
-PY_MODULES=	__init__.py data.py session.py message.py
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/ISC/CC
-	@(for _foo_ in $(PY_MODULES) ; \
-		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/ISC/CC/$$_foo_ $(DESTDIR)$(pyexecdir)/ISC/CC/ ; done)

+ 0 - 2
src/lib/cc/python/ISC/CC/__init__.py

@@ -1,2 +0,0 @@
-import ISC.CC.message
-from ISC.CC.session import *

+ 0 - 8
src/lib/cc/python/ISC/Makefile.am

@@ -1,8 +0,0 @@
-SUBDIRS = CC Util
-
-PY_MODULES=	__init__.py
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/ISC
-	@(for _foo_ in $(PY_MODULES) ; \
-		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/ISC/$$_foo_ $(DESTDIR)$(pyexecdir)/ISC/ ; done)

+ 0 - 6
src/lib/cc/python/ISC/Util/Makefile.am

@@ -1,6 +0,0 @@
-PY_MODULES=	__init__.py hexdump.py
-
-install-data-local:
-	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/ISC/Util
-	@(for _foo_ in $(PY_MODULES) ; \
-		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/ISC/Util/$$_foo_ $(DESTDIR)$(pyexecdir)/ISC/Util/ ; done)

+ 0 - 1
src/lib/cc/python/ISC/Util/__init__.py

@@ -1 +0,0 @@
-from ISC.Util.hexdump import *

+ 0 - 2
src/lib/cc/python/ISC/__init__.py

@@ -1,2 +0,0 @@
-import ISC.CC
-import ISC.Util

+ 1 - 1
src/lib/cc/python/Makefile.am

@@ -1 +1 @@
-SUBDIRS = ISC
+SUBDIRS = isc

+ 8 - 0
src/lib/cc/python/isc/Makefile.am

@@ -0,0 +1,8 @@
+SUBDIRS = cc Util
+
+PY_MODULES=	__init__.py
+
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/isc
+	@(for _foo_ in $(PY_MODULES) ; \
+		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/isc/$$_foo_ $(DESTDIR)$(pyexecdir)/isc/ ; done)

+ 6 - 0
src/lib/cc/python/isc/Util/Makefile.am

@@ -0,0 +1,6 @@
+PY_MODULES=	__init__.py hexdump.py
+
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/isc/Util
+	@(for _foo_ in $(PY_MODULES) ; \
+		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/isc/Util/$$_foo_ $(DESTDIR)$(pyexecdir)/isc/Util/ ; done)

+ 1 - 0
src/lib/cc/python/isc/Util/__init__.py

@@ -0,0 +1 @@
+from isc.Util.hexdump import *

src/lib/cc/python/ISC/Util/hexdump.py → src/lib/cc/python/isc/Util/hexdump.py


+ 2 - 0
src/lib/cc/python/isc/__init__.py

@@ -0,0 +1,2 @@
+import isc.cc
+import isc.Util

+ 6 - 0
src/lib/cc/python/isc/cc/Makefile.am

@@ -0,0 +1,6 @@
+PY_MODULES=	__init__.py data.py session.py message.py
+
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)$(pyexecdir)/isc/cc
+	@(for _foo_ in $(PY_MODULES) ; \
+		do $(INSTALL) -m 0644 $(top_srcdir)/src/lib/cc/python/isc/cc/$$_foo_ $(DESTDIR)$(pyexecdir)/isc/cc/ ; done)

+ 2 - 0
src/lib/cc/python/isc/cc/__init__.py

@@ -0,0 +1,2 @@
+import isc.cc.message
+from isc.cc.session import *

src/lib/cc/python/ISC/CC/data.py → src/lib/cc/python/isc/cc/data.py


+ 1 - 1
src/lib/cc/python/ISC/CC/message.py

@@ -14,7 +14,7 @@
 # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 # XXX
-from ISC.Util import hexdump
+import isc.Util
 
 import sys
 import struct

+ 8 - 7
src/lib/cc/python/ISC/CC/session.py

@@ -17,7 +17,8 @@ import sys
 import socket
 import struct
 
-from ISC.CC import message
+#from isc.cc import message
+import isc.cc.message
 
 class ProtocolError(Exception): pass
 class NetworkError(Exception): pass
@@ -61,9 +62,9 @@ class Session:
         if self._closed:
             raise SessionError("Session has been closed.")
         if type(env) == dict:
-            env = message.to_wire(env)
+            env = isc.cc.message.to_wire(env)
         if type(msg) == dict:
-            msg = message.to_wire(msg)
+            msg = isc.cc.message.to_wire(msg)
         self._socket.setblocking(1)
         length = 2 + len(env);
         if msg:
@@ -82,9 +83,9 @@ class Session:
             header_length = struct.unpack('>H', data[0:2])[0]
             data_length = len(data) - 2 - header_length
             if data_length > 0:
-                return message.from_wire(data[2:header_length+2]), message.from_wire(data[header_length + 2:])
+                return isc.cc.message.from_wire(data[2:header_length+2]), isc.cc.message.from_wire(data[header_length + 2:])
             else:
-                return message.from_wire(data[2:header_length+2]), None
+                return isc.cc.message.from_wire(data[2:header_length+2]), None
         return None, None
 
     def _receive_full_buffer(self, nonblock):
@@ -151,7 +152,7 @@ class Session:
             "group": group,
             "instance": instance,
             "seq": seq,
-        }, message.to_wire(msg))
+        }, isc.cc.message.to_wire(msg))
         return seq
 
     def group_recvmsg(self, nonblock = True):
@@ -172,7 +173,7 @@ class Session:
             "instance": routing["instance"],
             "seq": seq,
             "reply": routing["seq"],
-        }, message.to_wire(msg))
+        }, isc.cc.message.to_wire(msg))
         return seq
 
 if __name__ == "__main__":

+ 2 - 2
src/lib/cc/python/sendcmd.py

@@ -1,7 +1,7 @@
 #!/usr/bin/python3
-import ISC, sys
+import isc, sys
 
-cc = ISC.CC.Session()
+cc = isc.cc.Session()
 if len(sys.argv) < 3:
     sys.stderr.write('Usage: ' + sys.argv[0] + ' <channel> <command> [arg]\n')
     sys.exit(1)

+ 23 - 23
src/lib/cc/python/test.py

@@ -1,106 +1,106 @@
-import ISC
+import isc
 import unittest
 
 class TestCCWireEncoding(unittest.TestCase):
     def setUp(self): pass
 
     def test_to_wire_of_string(self):
-        wire = ISC.CC.message.to_wire({ "simple" : "string" })
+        wire = isc.cc.message.to_wire({ "simple" : "string" })
         self.assertEqual(wire, b'Skan\x06simple(\x06string')
 
     def test_from_wire_of_string(self):
         wire = b'Skan\x06simple(\x06string'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], "string")
 
     def test_to_wire_of_binary_string(self):
-        wire = ISC.CC.message.to_wire({ "simple" : b'\x01\xff\x02\x85' })
+        wire = isc.cc.message.to_wire({ "simple" : b'\x01\xff\x02\x85' })
         self.assertEqual(wire, b'Skan\x06simple!\x04\x01\xff\x02\x85')
 
     def test_from_wire_of_binary_string(self):
         wire = b'Skan\x06simple!\x04\x01\xff\x02\x85'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], b'\x01\xff\x02\x85')
 
     def test_to_wire_of_list(self):
-        wire = ISC.CC.message.to_wire({ "simple" : [ "string" ] })
+        wire = isc.cc.message.to_wire({ "simple" : [ "string" ] })
         self.assertEqual(wire, b'Skan\x06simple#\x08(\x06string')
 
     def test_from_wire_of_list(self):
         wire = b'Skan\x06simple#\x08(\x06string'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], [ "string" ])
 
     def test_to_wire_of_hash(self):
-        wire = ISC.CC.message.to_wire({ "simple" : { "string" : 1 }})
+        wire = isc.cc.message.to_wire({ "simple" : { "string" : 1 }})
         self.assertEqual(wire, b'Skan\x06simple"\n\x06string&\x011')
 
     def test_from_wire_of_hash(self):
         wire = b'Skan\x06simple"\n\x06string(\x011'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], { "string" : '1' })
 
     def test_to_wire_of_none(self):
-        wire = ISC.CC.message.to_wire({ "simple" : None })
+        wire = isc.cc.message.to_wire({ "simple" : None })
         self.assertEqual(wire, b'Skan\x06simple\x04')
 
     def test_from_wire_of_none(self):
         wire = b'Skan\x06simple\x04'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], None)
 
     def test_to_wire_of_empty_string(self):
-        wire = ISC.CC.message.to_wire({ "simple" : "" })
+        wire = isc.cc.message.to_wire({ "simple" : "" })
         self.assertEqual(wire, b'Skan\x06simple(\x00')
 
     def test_from_wire_of_empty_string(self):
         wire = b'Skan\x06simple(\x00'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], "")
 
     def test_to_wire_of_utf8_string(self):
-        wire = ISC.CC.message.to_wire({ "simple" : "せんせい" })
+        wire = isc.cc.message.to_wire({ "simple" : "せんせい" })
         self.assertEqual(wire, b'Skan\x06simple(\x0c\xe3\x81\x9b\xe3\x82\x93\xe3\x81\x9b\xe3\x81\x84')
 
     def test_from_wire_of_utf8_string(self):
         wire = b'Skan\x06simple(\x0c\xe3\x81\x9b\xe3\x82\x93\xe3\x81\x9b\xe3\x81\x84'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["simple"], "せんせい")
 
     def test_to_wire_of_utf8_label(self):
-        wire = ISC.CC.message.to_wire({ "せんせい" : "string" })
+        wire = isc.cc.message.to_wire({ "せんせい" : "string" })
         self.assertEqual(wire, b'Skan\x0c\xe3\x81\x9b\xe3\x82\x93\xe3\x81\x9b\xe3\x81\x84(\x06string')
 
     def test_from_wire_of_utf8_label(self):
         wire = b'Skan\x0c\xe3\x81\x9b\xe3\x82\x93\xe3\x81\x9b\xe3\x81\x84(\x06string'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["せんせい"], "string")
 
     def test_to_wire_of_bool_true(self):
-        wire = ISC.CC.message.to_wire({ "bool": True })
+        wire = isc.cc.message.to_wire({ "bool": True })
         self.assertEqual(wire, b'Skan\x04bool%\x01\x01')
 
     def test_to_wire_of_bool_false(self):
-        wire = ISC.CC.message.to_wire({ "bool": False })
+        wire = isc.cc.message.to_wire({ "bool": False })
         self.assertEqual(wire, b'Skan\x04bool%\x01\x00')
 
     def test_from_wire_of_bool_true(self):
         wire = b'Skan\x04bool%\x01\x01'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["bool"], True)
 
     def test_from_wire_of_bool_true(self):
         wire = b'Skan\x04bool%\x01\x00'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["bool"], False)
 
     def test_to_wire_of_int(self):
-        wire = ISC.CC.message.to_wire({ "number": 123 })
+        wire = isc.cc.message.to_wire({ "number": 123 })
         self.assertEqual(wire, b'Skan\x06number&\x03123')
 
     def test_from_wire_of_int(self):
         wire = b'Skan\x06number&\x03123'
-        decoded = ISC.CC.message.from_wire(wire)
+        decoded = isc.cc.message.from_wire(wire)
         self.assertEqual(decoded["number"], 123)
     
 if __name__ == '__main__':

+ 2 - 2
src/lib/cc/python/test_cfgd_sess.py

@@ -1,6 +1,6 @@
-import ISC
+import isc
 
-cc = ISC.CC.Session()
+cc = isc.cc.Session()
 
 cc.group_subscribe("ConfigManager")
 

+ 3 - 3
src/lib/cc/python/test_session.py

@@ -1,4 +1,4 @@
-import ISC
+import isc
 
 import time
 import pprint
@@ -12,8 +12,8 @@ import unittest
 
 class TestCCWireEncoding(unittest.TestCase):
     def setUp(self):
-        self.s1 = ISC.CC.Session()
-        self.s2 = ISC.CC.Session()
+        self.s1 = isc.cc.Session()
+        self.s2 = isc.cc.Session()
 
     def tearDown(self):
         self.s1.close()

+ 1 - 1
src/lib/config/python/isc/config/ccsession.py

@@ -22,7 +22,7 @@
 # modeled after ccsession.h/cc 'protocol' changes here need to be
 # made there as well
 
-from ISC.CC import Session
+from isc.cc import Session
 import isc
 
 class CCSession: