annotate python/which.py @ 173:61282540f7c7
add curl and arandr to needed packages
author |
Jeff Hammel <jhammel@mozilla.com> |
date |
Sun, 23 Oct 2011 20:35:57 -0700 |
parents |
3e52d6bcac99 |
children |
b91750a108b2 |
rev |
line source |
170
|
1 def findInPath(fileName, path=os.environ['PATH']):
|
|
2 """python equivalent of which; should really be in the stdlib"""
|
|
3 dirs = path.split(os.pathsep)
|
|
4 for dir in dirs:
|
|
5 if os.path.isfile(os.path.join(dir, fileName)):
|
|
6 return os.path.join(dir, fileName)
|
|
7 if mozinfo.isWin:
|
|
8 if os.path.isfile(os.path.join(dir, fileName + ".exe")):
|
|
9 return os.path.join(dir, fileName + ".exe")
|
|
10
|
|
11 if __name__ == '__main__':
|
|
12 for i in sys.argv[1:]:
|
|
13 print findInPath(i) |