Dir is not a variable name

This commit is contained in:
Eric Soroos 2016-03-30 08:19:23 -07:00
parent 4d234fb54d
commit f869ecd808

View File

@ -38,15 +38,15 @@ _LIB_IMAGING = (
"Jpeg2KDecode", "Jpeg2KEncode", "BoxBlur") "Jpeg2KDecode", "Jpeg2KEncode", "BoxBlur")
def _add_directory(path, dir, where=None): def _add_directory(path, subdir, where=None):
if dir is None: if subdir is None:
return return
dir = os.path.realpath(dir) subdir = os.path.realpath(subdir)
if os.path.isdir(dir) and dir not in path: if os.path.isdir(subdir) and subdir not in path:
if where is None: if where is None:
path.append(dir) path.append(subdir)
else: else:
path.insert(where, dir) path.insert(where, subdir)
def _find_include_file(self, include): def _find_include_file(self, include):
@ -448,20 +448,20 @@ class pil_build_ext(build_ext):
if _find_library_file(self, "freetype"): if _find_library_file(self, "freetype"):
# look for freetype2 include files # look for freetype2 include files
freetype_version = 0 freetype_version = 0
for dir in self.compiler.include_dirs: for subdir in self.compiler.include_dirs:
if os.path.isfile(os.path.join(dir, "ft2build.h")): if os.path.isfile(os.path.join(subdir, "ft2build.h")):
freetype_version = 21 freetype_version = 21
dir = os.path.join(dir, "freetype2") subdir = os.path.join(subdir, "freetype2")
break break
dir = os.path.join(dir, "freetype2") subdir = os.path.join(subdir, "freetype2")
if os.path.isfile(os.path.join(dir, "ft2build.h")): if os.path.isfile(os.path.join(subdir, "ft2build.h")):
freetype_version = 21 freetype_version = 21
break break
if freetype_version: if freetype_version:
feature.freetype = "freetype" feature.freetype = "freetype"
feature.freetype_version = freetype_version feature.freetype_version = freetype_version
if dir: if subdir:
_add_directory(self.compiler.include_dirs, dir, 0) _add_directory(self.compiler.include_dirs, subdir, 0)
if feature.want('lcms'): if feature.want('lcms'):
if _find_include_file(self, "lcms2.h"): if _find_include_file(self, "lcms2.h"):
@ -592,10 +592,10 @@ class pil_build_ext(build_ext):
if (os.path.exists(root_tcl) and os.path.exists(root_tk)): if (os.path.exists(root_tcl) and os.path.exists(root_tk)):
print("--- using frameworks at %s" % root) print("--- using frameworks at %s" % root)
frameworks = ["-framework", "Tcl", "-framework", "Tk"] frameworks = ["-framework", "Tcl", "-framework", "Tk"]
dir = os.path.join(root_tcl, "Headers") subdir = os.path.join(root_tcl, "Headers")
_add_directory(self.compiler.include_dirs, dir, 0) _add_directory(self.compiler.include_dirs, subdir, 0)
dir = os.path.join(root_tk, "Headers") subdir = os.path.join(root_tk, "Headers")
_add_directory(self.compiler.include_dirs, dir, 1) _add_directory(self.compiler.include_dirs, subdir, 1)
break break
if frameworks: if frameworks:
exts.append(Extension("PIL._imagingtk", exts.append(Extension("PIL._imagingtk",
@ -689,8 +689,8 @@ class pil_build_ext(build_ext):
def check_zlib_version(self, include_dirs): def check_zlib_version(self, include_dirs):
# look for unsafe versions of zlib # look for unsafe versions of zlib
for dir in include_dirs: for subdir in include_dirs:
zlibfile = os.path.join(dir, "zlib.h") zlibfile = os.path.join(subdir, "zlib.h")
if os.path.isfile(zlibfile): if os.path.isfile(zlibfile):
break break
else: else: