[asterisk-commits] pabelanger: branch pabelanger/ast_version r3019 - in /asterisk/team/pabelange...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 26 16:23:15 CST 2012


Author: pabelanger
Date: Thu Jan 26 16:23:11 2012
New Revision: 3019

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3019
Log:
Clean up

Modified:
    asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py
    asterisk/team/pabelanger/ast_version/runtests.py

Modified: asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py?view=diff&rev=3019&r1=3018&r2=3019
==============================================================================
--- asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py (original)
+++ asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py Thu Jan 26 16:23:11 2012
@@ -25,7 +25,7 @@
 
     This class handles Asterisk version strings.
     """
-    version = ''
+    ast_version = ''
 
     def __init__(self, version=None, path=None):
         """Construct an Asterisk Version parser.
@@ -38,7 +38,7 @@
         """
         self.svn = False
 
-        if version is None and AsteriskVersion.version == '':
+        if version is None and AsteriskVersion.ast_version == '':
             self.ast_binary = utils.which("asterisk") or "/usr/sbin/asterisk"
             cmd = [
                 self.ast_binary,
@@ -53,17 +53,17 @@
 
             try:
                 for l in process.stdout.readlines():
-                    AsteriskVersion.version += l
+                    AsteriskVersion.ast_version += l
             except OSError:
                 pass
-            AsteriskVersion.version = AsteriskVersion.version.replace("Asterisk ", "")
-            self.version_str = AsteriskVersion.version
+            AsteriskVersion.ast_version = AsteriskVersion.ast_version.replace("Asterisk ", "")
+            self.version_str = AsteriskVersion.ast_version
 
         elif version is not None:
             self.version_str = version
 
         else:
-            self.version_str = AsteriskVersion.version
+            self.version_str = AsteriskVersion.ast_version
 
         if not self.version_str:
             return
@@ -160,24 +160,6 @@
 
         return ret
 
-    def __get_ast_version(self, path):
-        '''
-        Determine the version of Asterisk installed from the installed version.h.
-        '''
-        v = None
-        try:
-            f = open(path, "r")
-            match = re.search("ASTERISK_VERSION\s+\"(.*)\"", f.read())
-            if match is not None:
-                v = match.group(1)
-            f.close()
-        except IOError:
-            logger.error("I/O Error getting Asterisk version from %s" % path)
-        except:
-            logger.error("Unexpected error getting version from %s: %s" % (path,
-                    sys.exc_info()[0]))
-        return v
-
 
 class AsteriskVersionTests(unittest.TestCase):
     def test_version(self):

Modified: asterisk/team/pabelanger/ast_version/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/ast_version/runtests.py?view=diff&rev=3019&r1=3018&r2=3019
==============================================================================
--- asterisk/team/pabelanger/ast_version/runtests.py (original)
+++ asterisk/team/pabelanger/ast_version/runtests.py Thu Jan 26 16:23:11 2012
@@ -342,6 +342,19 @@
             help="Specify the version of Asterisk rather then detecting it.")
     (options, args) = parser.parse_args(argv)
 
+    # Check to see if this has been executed within a sub directory of an
+    # Asterisk source tree.  This is required so that we can execute
+    # install and uninstall targets of the Asterisk Makefile in between
+    # tests.
+    if os.path.exists("../main/asterisk.c") is False:
+        print "***  ERROR  ***\n" \
+              "runtests has not been executed from within a\n" \
+              "subdirectory of an Asterisk source tree.  This\n" \
+              "is required for being able to uninstall and install\n" \
+              "Asterisk in between tests.\n" \
+              "***************\n"
+        return 1
+
     ast_version = AsteriskVersion(options.version)
 
     #remove any trailing '/' from a test specified with the -t option




More information about the asterisk-commits mailing list