PEP8 fixes

This commit is contained in:
Alex Clark 2010-11-26 10:01:37 -05:00
parent 1e686fddf9
commit 3c7f9152c6

View File

@ -6,7 +6,14 @@
# Usage: python setup.py install # Usage: python setup.py install
# #
import glob, os, re, struct, string, sys, platform import glob
import os
import platform
import re
import struct
import string
import sys
def libinclude(root): def libinclude(root):
# map root to (root/lib, root/include) # map root to (root/lib, root/include)
@ -80,6 +87,7 @@ try:
except ImportError: except ImportError:
_tkinter = None _tkinter = None
def add_directory(path, dir, where=None): def add_directory(path, dir, where=None):
if dir and os.path.isdir(dir) and dir not in path: if dir and os.path.isdir(dir) and dir not in path:
if where is None: if where is None:
@ -87,15 +95,18 @@ def add_directory(path, dir, where=None):
else: else:
path.insert(where, dir) path.insert(where, dir)
def find_include_file(self, include): def find_include_file(self, include):
for directory in self.compiler.include_dirs: for directory in self.compiler.include_dirs:
if os.path.isfile(os.path.join(directory, include)): if os.path.isfile(os.path.join(directory, include)):
return 1 return 1
return 0 return 0
def find_library_file(self, library): def find_library_file(self, library):
return self.compiler.find_library_file(self.compiler.library_dirs, library) return self.compiler.find_library_file(self.compiler.library_dirs, library)
def find_version(filename): def find_version(filename):
for line in open(filename).readlines(): for line in open(filename).readlines():
m = re.search("VERSION\s*=\s*\"([^\"]+)\"", line) m = re.search("VERSION\s*=\s*\"([^\"]+)\"", line)
@ -106,6 +117,7 @@ def find_version(filename):
#VERSION = find_version("PIL/Image.py") #VERSION = find_version("PIL/Image.py")
VERSION = "1.2" VERSION = "1.2"
class pil_build_ext(build_ext): class pil_build_ext(build_ext):
def build_extensions(self): def build_extensions(self):
@ -234,7 +246,8 @@ class pil_build_ext(build_ext):
if find_include_file(self, "jpeglib.h"): if find_include_file(self, "jpeglib.h"):
if find_library_file(self, "jpeg"): if find_library_file(self, "jpeg"):
feature.jpeg = "jpeg" feature.jpeg = "jpeg"
elif sys.platform == "win32" and find_library_file(self, "libjpeg"): elif sys.platform == "win32" and find_library_file(self,
"libjpeg"):
feature.jpeg = "libjpeg" # alternative name feature.jpeg = "libjpeg" # alternative name
if find_library_file(self, "tiff"): if find_library_file(self, "tiff"):
@ -467,11 +480,11 @@ if __name__ == "__main__":
"Topic :: Multimedia :: Graphics :: Graphics Conversion", "Topic :: Multimedia :: Graphics :: Graphics Conversion",
"Topic :: Multimedia :: Graphics :: Viewers", "Topic :: Multimedia :: Graphics :: Viewers",
], ],
cmdclass = {"build_ext": pil_build_ext}, cmdclass={"build_ext": pil_build_ext},
description=DESCRIPTION, description=DESCRIPTION,
# download_url=DOWNLOAD_URL % (NAME, VERSION), # download_url=DOWNLOAD_URL % (NAME, VERSION),
ext_modules = [Extension("_imaging", ["_imaging.c"])], # dummy ext_modules=[Extension("_imaging", ["_imaging.c"])], # dummy
extra_path = "PIL", extra_path="PIL",
license="Python (MIT style)", license="Python (MIT style)",
# long_description=DESCRIPTION, # long_description=DESCRIPTION,
long_description=open("README.txt").read() + "\n" + long_description=open("README.txt").read() + "\n" +
@ -481,7 +494,7 @@ if __name__ == "__main__":
packages=find_packages(), packages=find_packages(),
# setup_requires=["setuptools_hg"], # setup_requires=["setuptools_hg"],
platforms="Python 1.5.2 and later.", platforms="Python 1.5.2 and later.",
scripts = glob.glob("Scripts/pil*.py"), scripts=glob.glob("Scripts/pil*.py"),
url=HOMEPAGE, url=HOMEPAGE,
version=VERSION, version=VERSION,
) )