[asterisk-commits] pabelanger: branch pabelanger/ast_version r3018 - /asterisk/team/pabelanger/a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 26 16:16:32 CST 2012
Author: pabelanger
Date: Thu Jan 26 16:16:29 2012
New Revision: 3018
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3018
Log:
Rework 2
Modified:
asterisk/team/pabelanger/ast_version/lib/python/asterisk/version.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=3018&r1=3017&r2=3018
==============================================================================
--- 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:16:29 2012
@@ -25,6 +25,7 @@
This class handles Asterisk version strings.
"""
+ version = ''
def __init__(self, version=None, path=None):
"""Construct an Asterisk Version parser.
@@ -36,9 +37,9 @@
version string to pull out and Parse.
"""
self.svn = False
- self.ast_binary = utils.which("asterisk") or "/usr/sbin/asterisk"
-
- if version is None:
+
+ if version is None and AsteriskVersion.version == '':
+ self.ast_binary = utils.which("asterisk") or "/usr/sbin/asterisk"
cmd = [
self.ast_binary,
"-V",
@@ -50,16 +51,19 @@
except OSError:
return
- self.version_str = ""
try:
for l in process.stdout.readlines():
- self.version_str += l
+ AsteriskVersion.version += l
except OSError:
pass
- self.version_str = self.version_str.replace("Asterisk ", "")
+ AsteriskVersion.version = AsteriskVersion.version.replace("Asterisk ", "")
+ self.version_str = AsteriskVersion.version
+
+ elif version is not None:
+ self.version_str = version
else:
- self.version_str = version
+ self.version_str = AsteriskVersion.version
if not self.version_str:
return
More information about the asterisk-commits
mailing list