[Buildbot-commits] buildbot/buildbot twcompat.py,1.4,1.5

Brian Warner warner at users.sourceforge.net
Mon Apr 24 09:03:09 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25026/buildbot

Modified Files:
	twcompat.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-510
Creator:  Brian Warner <warner at lothar.com>

improve the windowsness of test_vc and tryclient

	* buildbot/test/test_vc.py (*.capable): store the actual VC
	binary's pathname in VCS[vcname], so it can be retrieved later
	(CVSSupport.vc_try_checkout): incorporate Niklaus Giger's patch to
	strip out non-numeric timezone information, specifically the funky
	German string that his system produced that confuses CVS.
	(DarcsSupport.vc_create): use dovc() instead of vc(), this should
	allow Darcs tests to work on windows
	* buildbot/scripts/tryclient.py (SourceStampExtractor): use
	procutils.which() everywhere, to allow tryclient to work under
	windows. Also from Niklaus Giger, SF#1463394.

	* buildbot/twcompat.py (which): move the replacement for a missing
	twisted.python.procutils.which from test_vc.py to here, so it can
	be used in other places too (specifically tryclient.py)


Index: twcompat.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/twcompat.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- twcompat.py	17 Apr 2006 20:43:46 -0000	1.4
+++ twcompat.py	24 Apr 2006 09:03:07 -0000	1.5
@@ -23,6 +23,8 @@
     assert providedBy(obj, IFoo)
 """
 
+import os, os.path
+
 from twisted.copyright import version
 from twisted.python import components
 
@@ -249,3 +251,35 @@
                                          executable, args, env, path,
                                          reactor)
     utils.getProcessOutputAndValue = getProcessOutputAndValue
+
+
+# copied from Twisted circa 2.2.0
+def _which(name, flags=os.X_OK):
+    """Search PATH for executable files with the given name.
+
+    @type name: C{str}
+    @param name: The name for which to search.
+
+    @type flags: C{int}
+    @param flags: Arguments to L{os.access}.
+
+    @rtype: C{list}
+    @param: A list of the full paths to files found, in the
+    order in which they were found.
+    """
+    result = []
+    exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
+    for p in os.environ['PATH'].split(os.pathsep):
+        p = os.path.join(p, name)
+        if os.access(p, flags):
+            result.append(p)
+        for e in exts:
+            pext = p + e
+            if os.access(pext, flags):
+                result.append(pext)
+    return result
+
+try:
+    from twisted.python.procutils import which
+except ImportError:
+    which = _which





More information about the Commits mailing list