Fix build failure when compiler.include_dirs refers to nonexistent directory

This commit is contained in:
cgohlke 2014-06-28 16:15:06 -07:00
parent 2633408dc3
commit 526ac7e278

View File

@ -405,7 +405,12 @@ class pil_build_ext(build_ext):
# Find the best version
for directory in self.compiler.include_dirs:
for name in os.listdir(directory):
try:
listdir = os.listdir(directory)
except Exception:
# WindowsError, FileNotFoundError
continue
for name in listdir:
if name.startswith('openjpeg-') and \
os.path.isfile(os.path.join(directory, name,
'openjpeg.h')):