moving isdirectory into utils

This commit is contained in:
Martin A. Brown 2016-02-22 13:04:03 -08:00
parent bfd07eb4d5
commit 0a32e87dfc
1 changed files with 7 additions and 0 deletions

View File

@ -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)))