[asterisk-scf-commits] asterisk-scf/release/configurator.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Apr 12 17:39:51 CDT 2012


branch "master" has been updated
       via  9f8455129af62a03ae9625388da61204ad3c07d6 (commit)
      from  a02be9ac84985a4ae3b9b43050c2ace3b4439cfa (commit)

Summary of changes:
 AsteriskSCF.py         |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 Configurator.py        |   19 +++----------------
 ExampleConfigurator.py |    4 ++--
 3 files changed, 51 insertions(+), 18 deletions(-)
 create mode 100755 AsteriskSCF.py


- Log -----------------------------------------------------------------
commit 9f8455129af62a03ae9625388da61204ad3c07d6
Author: David M. Lee <dlee at digium.com>
Date:   Thu Apr 12 17:39:40 2012 -0500

    Extracted astscfLoadSlice to an AsteriskSCF module

diff --git a/AsteriskSCF.py b/AsteriskSCF.py
new file mode 100755
index 0000000..1086d8b
--- /dev/null
+++ b/AsteriskSCF.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+#
+# Asterisk SCF -- An open-source communications framework.
+#
+# Copyright (C) 2012, Digium, Inc.
+#
+# See http://www.asterisk.org for more information about
+# the Asterisk SCF project. Please do not directly contact
+# any of the maintainers of this project for assistance;
+# the project provides a web site, mailing lists and IRC
+# channels for your use.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License Version 2. See the LICENSE.txt file
+# at the top of the source tree.
+#
+
+# Stuff that will probably be moved into an ice-util-py at some point
+
+import os, Ice
+
+def loadSlice(component, sliceFile):
+    """Load the given Asterisk SCF slice file. See Ice.loadSlice()
+
+    Arguments:
+    component -- Component that contains the slice file. This is used for
+                 locating slice files from source instead of install
+    sliceFile -- Slice file to load
+    """
+    # TODO - handle case where ASTSCF_HOME points to install directory instead
+    # of source directory
+    componentSliceDir = "%(astscfHome)s/%(component)s/slice" % {
+        "astscfHome": os.environ["ASTSCF_HOME"],
+        "component": component
+        }
+    scfSliceDir = "%(astscfHome)s/slice/slice" % {
+        "astscfHome": os.environ["ASTSCF_HOME"]
+        }
+    loadSliceCmd = '-I"%(scfSliceDir)s" -I"%(iceSliceDir)s" -I"%(componentSliceDir)s" --all "%(componentSliceDir)s"/%(slice)s' % {
+        "scfSliceDir": scfSliceDir,
+        "iceSliceDir": Ice.getSliceDir(),
+        "componentSliceDir": componentSliceDir,
+        "slice": sliceFile
+        }
+    Ice.loadSlice(loadSliceCmd)
diff --git a/Configurator.py b/Configurator.py
index 6517ae8..0cfdedf 100755
--- a/Configurator.py
+++ b/Configurator.py
@@ -22,24 +22,11 @@ import sys
 
 sys.path.append('/opt/Ice-3.4/python')
 
-import ConfigParser, traceback, os, Ice, getopt
+import ConfigParser, traceback, os, Ice, getopt, AsteriskSCF
 
 def astscfLoadSlice(component, sliceFile):
-    # TODO - handle case where ASTSCF_HOME points to install directory instead of source directory
-    componentSliceDir = "%(astscfHome)s/%(component)s/slice" % {
-        "astscfHome": os.environ["ASTSCF_HOME"],
-        "component": component
-        }
-    scfSliceDir = "%(astscfHome)s/slice/slice" % {
-        "astscfHome": os.environ["ASTSCF_HOME"]
-        }
-    loadSliceCmd = '-I"%(scfSliceDir)s" -I"%(iceSliceDir)s" -I"%(componentSliceDir)s" --all "%(componentSliceDir)s"/%(slice)s' % {
-        "scfSliceDir": scfSliceDir,
-        "iceSliceDir": Ice.getSliceDir(),
-        "componentSliceDir": componentSliceDir,
-        "slice": sliceFile
-        }
-    Ice.loadSlice(loadSliceCmd)
+    """Old name. Moved to AsteriskSCF.loadSlice(). Update usages at your leisure."""
+    AsteriskSCF.loadSlice(component, sliceFile)
 
 # Load and make the configuration interface available, we require it
 astscfLoadSlice('slice', 'AsteriskSCF/System/Component/ConfigurationIf.ice')
diff --git a/ExampleConfigurator.py b/ExampleConfigurator.py
index 8f6b0f5..d9cf536 100755
--- a/ExampleConfigurator.py
+++ b/ExampleConfigurator.py
@@ -3,10 +3,10 @@
 # Example configurator
 
 # Bring in the common configuration infrastructure
-import Ice, Configurator, sys
+import Ice, Configurator, sys, AsteriskSCF
 
 # Load our component specific configuration definitions
-Configurator.astscfLoadSlice("example", "AsteriskSCF/System/Configuration/ExampleConfigurationIf.ice")
+AsteriskSCF.loadSlice("example", "AsteriskSCF/System/Configuration/ExampleConfigurationIf.ice")
 import AsteriskSCF.System.Configuration.Example.V1
 
 # Add our own visitor implementations for the sections we support

-----------------------------------------------------------------------


-- 
asterisk-scf/release/configurator.git



More information about the asterisk-scf-commits mailing list