# HG changeset patch
# User Jeff Hammel <jhammel@mozilla.com>
# Date 1317080702 25200
# Node ID 3e52d6bcac995c673412e82ce06e2ca712dddeac
# Parent  ab2fc6222f941f82ffa0c976bee49d4dfd3ce176
add the which thingy

diff -r ab2fc6222f94 -r 3e52d6bcac99 python/which.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/which.py	Mon Sep 26 16:45:02 2011 -0700
@@ -0,0 +1,13 @@
+def findInPath(fileName, path=os.environ['PATH']):
+    """python equivalent of which; should really be in the stdlib"""
+    dirs = path.split(os.pathsep)
+    for dir in dirs:
+        if os.path.isfile(os.path.join(dir, fileName)):
+            return os.path.join(dir, fileName)
+        if mozinfo.isWin:
+            if os.path.isfile(os.path.join(dir, fileName + ".exe")):
+                return os.path.join(dir, fileName + ".exe")
+
+if __name__ == '__main__':
+    for i in sys.argv[1:]:
+        print findInPath(i)
\ No newline at end of file