[svn-commits] pabelanger: branch pabelanger/ast_version r3017 - in /asterisk/team/pabelange...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jan 26 10:34:33 CST 2012
Author: pabelanger
Date: Thu Jan 26 10:34:30 2012
New Revision: 3017
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3017
Log:
No longer depend on version.h for asterisk version
We'll now attempt to run the asterisk binary and parse the version from it
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=3017&r1=3016&r2=3017
==============================================================================
--- asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py (original)
+++ asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.py Thu Jan 26 10:34:30 2012
@@ -15,6 +15,8 @@
import re
import unittest
import logging
+import subprocess
+import utils
logger = logging.getLogger(__name__)
@@ -34,20 +36,30 @@
version string to pull out and Parse.
"""
self.svn = False
- if version is not None:
+ self.ast_binary = utils.which("asterisk") or "/usr/sbin/asterisk"
+
+ if version is None:
+ cmd = [
+ self.ast_binary,
+ "-V",
+ ]
+
+ try:
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ except OSError:
+ return
+
+ self.version_str = ""
+ try:
+ for l in process.stdout.readlines():
+ self.version_str += l
+ except OSError:
+ pass
+ self.version_str = self.version_str.replace("Asterisk ", "")
+
+ else:
self.version_str = version
- else:
- version_hdr_paths = [
- "../include/asterisk/version.h",
- "/usr/include/asterisk/version.h",
- "/usr/local/include/asterisk/version.h"
- ]
- if path:
- version_hdr_paths.insert(0, path)
- for p in version_hdr_paths:
- self.version_str = self.__get_ast_version(p)
- if self.version_str:
- break
if not self.version_str:
return
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=3017&r1=3016&r2=3017
==============================================================================
--- asterisk/team/pabelanger/ast_version/runtests.py (original)
+++ asterisk/team/pabelanger/ast_version/runtests.py Thu Jan 26 10:34:30 2012
@@ -342,19 +342,6 @@
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 svn-commits
mailing list