comparison python/lsex.py @ 367:77e7cab3e9f2

modularize
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 20 Jul 2013 11:37:39 -0700
parents 71576cdc28ab
children 20aa4a6ef719
comparison
equal deleted inserted replaced
366:ace6c399fcb1 367:77e7cab3e9f2
14 new.append(item) 14 new.append(item)
15 return new 15 return new
16 16
17 def lsex(path=None): 17 def lsex(path=None):
18 """ 18 """
19 list executable files on the path 19 list of executable files on the path
20 - path: list of directories to search. if not specified, use system path 20
21 - path: list or PATH-style string of directories to search.
22 if not specified, use system PATH
21 """ 23 """
22 24
23 if path is None: 25 if path is None:
24 # use system path 26 # use system path
25 path = ordered_set(os.environ['PATH'].split(':')) 27 path = os.environ['PATH']
28 if isinstance(path, basestring):
29 path = ordered_set(path.split(os.pathsep))
26 30
27 executables = [] 31 executables = []
28 32
29 # add the executable files to the list 33 # add the executable files to the list
30 for i in path: 34 for i in path: