mirror of https://github.com/tLDP/python-tldp
moving isdirectory into utils
This commit is contained in:
parent
bfd07eb4d5
commit
0a32e87dfc
|
@ -24,6 +24,7 @@ def getLogger(**opts):
|
|||
|
||||
logger = getLogger()
|
||||
|
||||
|
||||
def firstfoundfile(locations):
|
||||
'''return the first existing file from a list of filenames (or None)'''
|
||||
for option in locations:
|
||||
|
@ -32,6 +33,12 @@ def firstfoundfile(locations):
|
|||
return None
|
||||
|
||||
|
||||
def isdirectory(d):
|
||||
if os.path.exists(d):
|
||||
return d
|
||||
return None
|
||||
|
||||
|
||||
def stem_and_ext(name):
|
||||
'''return (stem, ext) for any relative or absolute filename'''
|
||||
return os.path.splitext(os.path.basename(os.path.normpath(name)))
|
||||
|
|
Loading…
Reference in New Issue