[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Jun 1 09:49:31 CDT 2011
branch "review" has been updated
via d3d331b8d6835f8b4b76e12587f24b93d7cf56b0 (commit)
from 41deebe580463f79a67e6f0d666a94ec60ba3b58 (commit)
Summary of changes:
lib/python/TestSuite.py | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit d3d331b8d6835f8b4b76e12587f24b93d7cf56b0
Author: Darren Sessions <dsessions at digium.com>
Date: Wed Jun 1 09:49:29 2011 -0500
added the which function from the remote to the main testsuite.
diff --git a/lib/python/TestSuite.py b/lib/python/TestSuite.py
index c40cd02..511e0f0 100644
--- a/lib/python/TestSuite.py
+++ b/lib/python/TestSuite.py
@@ -57,7 +57,7 @@ class utils():
except:
pass
- cmd[0] = self._which(cmd[0])
+ cmd[0] = self.which(cmd[0])
if os.path.exists(cmd[0]) and os.access(cmd[0], os.X_OK):
p = subprocess.Popen(
cmd,
@@ -77,6 +77,20 @@ class utils():
return {'success':False,"msg":"FAILED TO EXECUTE '%s', it must exist and be executable" % ' '.join(cmd)}
return {'success':True}
+ def which(self, app):
+ def if_exists(fp):
+ return os.path.exists(fp) and os.access(fp, os.X_OK)
+ fp, fn = os.path.split(app)
+ if fp:
+ if if_exists(app):
+ return app
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ prog = os.path.join(path, app)
+ if if_exists(prog):
+ return prog
+ return app
+
class file:
def write(self, fn, fd):
try:
-----------------------------------------------------------------------
--
asterisk-scf/integration/testsuite.git
More information about the asterisk-scf-commits
mailing list