Revert "Update website URL [ci skip]"

This reverts commit 838986349c.

OOPS, tried to sneak in yapf-formatting :-)
This commit is contained in:
Alex Clark 2016-03-15 07:14:03 -04:00
parent 838986349c
commit 6d5e7c69e6

250
setup.py
View File

@ -22,16 +22,18 @@ from setuptools import Extension, setup, find_packages
# comment this out to disable multi threaded builds. # comment this out to disable multi threaded builds.
import mp_compile import mp_compile
_IMAGING = ("decode", "encode", "map", "display", "outline", "path") _IMAGING = (
"decode", "encode", "map", "display", "outline", "path")
_LIB_IMAGING = ( _LIB_IMAGING = (
"Access", "AlphaComposite", "Resample", "Bands", "BitDecode", "Blend", "Access", "AlphaComposite", "Resample", "Bands", "BitDecode", "Blend",
"Chops", "Convert", "ConvertYCbCr", "Copy", "Crc32", "Crop", "Dib", "Draw", "Chops", "Convert", "ConvertYCbCr", "Copy", "Crc32", "Crop", "Dib", "Draw",
"Effects", "EpsEncode", "File", "Fill", "Filter", "FliDecode", "Geometry", "Effects", "EpsEncode", "File", "Fill", "Filter", "FliDecode",
"GetBBox", "GifDecode", "GifEncode", "HexDecode", "Histo", "JpegDecode", "Geometry", "GetBBox", "GifDecode", "GifEncode", "HexDecode",
"JpegEncode", "LzwDecode", "Matrix", "ModeFilter", "MspDecode", "Negative", "Histo", "JpegDecode", "JpegEncode", "LzwDecode", "Matrix",
"Offset", "Pack", "PackDecode", "Palette", "Paste", "Quant", "QuantOctree", "ModeFilter", "MspDecode", "Negative", "Offset", "Pack",
"QuantHash", "QuantHeap", "PcdDecode", "PcxDecode", "PcxEncode", "Point", "PackDecode", "Palette", "Paste", "Quant", "QuantOctree", "QuantHash",
"QuantHeap", "PcdDecode", "PcxDecode", "PcxEncode", "Point",
"RankFilter", "RawDecode", "RawEncode", "Storage", "SunRleDecode", "RankFilter", "RawDecode", "RawEncode", "Storage", "SunRleDecode",
"TgaRleDecode", "Unpack", "UnpackYCC", "UnsharpMask", "XbmDecode", "TgaRleDecode", "Unpack", "UnpackYCC", "UnsharpMask", "XbmDecode",
"XbmEncode", "ZipDecode", "ZipEncode", "TiffDecode", "Incremental", "XbmEncode", "ZipDecode", "ZipEncode", "TiffDecode", "Incremental",
@ -63,13 +65,13 @@ def _find_library_file(self, library):
if 'cpython' in self.compiler.shared_lib_extension: if 'cpython' in self.compiler.shared_lib_extension:
existing = self.compiler.shared_lib_extension existing = self.compiler.shared_lib_extension
self.compiler.shared_lib_extension = "." + existing.split('.')[-1] self.compiler.shared_lib_extension = "." + existing.split('.')[-1]
ret = self.compiler.find_library_file(self.compiler.library_dirs, ret = self.compiler.find_library_file(
library) self.compiler.library_dirs, library)
self.compiler.shared_lib_extension = existing self.compiler.shared_lib_extension = existing
return ret return ret
else: else:
return self.compiler.find_library_file(self.compiler.library_dirs, return self.compiler.find_library_file(
library) self.compiler.library_dirs, library)
def _lib_include(root): def _lib_include(root):
@ -80,13 +82,13 @@ def _lib_include(root):
def _read(file): def _read(file):
return open(file, 'rb').read() return open(file, 'rb').read()
try: try:
import _tkinter import _tkinter
except (ImportError, OSError): except (ImportError, OSError):
# pypy emits an oserror # pypy emits an oserror
_tkinter = None _tkinter = None
NAME = 'Pillow' NAME = 'Pillow'
PILLOW_VERSION = '3.2.0.dev0' PILLOW_VERSION = '3.2.0.dev0'
TCL_ROOT = None TCL_ROOT = None
@ -99,6 +101,7 @@ LCMS_ROOT = None
class pil_build_ext(build_ext): class pil_build_ext(build_ext):
class feature: class feature:
zlib = jpeg = tiff = freetype = tcl = tk = lcms = webp = webpmux = None zlib = jpeg = tiff = freetype = tcl = tk = lcms = webp = webpmux = None
jpeg2000 = None jpeg2000 = None
@ -118,9 +121,11 @@ class pil_build_ext(build_ext):
feature = feature() feature = feature()
user_options = build_ext.user_options + [ user_options = build_ext.user_options + [
('disable-%s' % x, None, 'Disable support for %s' % x) for x in feature ('disable-%s' % x, None, 'Disable support for %s' % x)
for x in feature
] + [ ] + [
('enable-%s' % x, None, 'Enable support for %s' % x) for x in feature ('enable-%s' % x, None, 'Enable support for %s' % x)
for x in feature
] ]
def initialize_options(self): def initialize_options(self):
@ -137,8 +142,8 @@ class pil_build_ext(build_ext):
self.feature.required.discard(x) self.feature.required.discard(x)
if getattr(self, 'enable_%s' % x): if getattr(self, 'enable_%s' % x):
raise ValueError( raise ValueError(
'Conflicting options: --enable-%s and --disable-%s' % 'Conflicting options: --enable-%s and --disable-%s'
(x, x)) % (x, x))
if getattr(self, 'enable_%s' % x): if getattr(self, 'enable_%s' % x):
self.feature.required.add(x) self.feature.required.add(x)
@ -192,9 +197,8 @@ class pil_build_ext(build_ext):
if sys.platform == "cygwin": if sys.platform == "cygwin":
# pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
_add_directory(library_dirs, _add_directory(library_dirs, os.path.join(
os.path.join("/usr/lib", "python%s" % "/usr/lib", "python%s" % sys.version[:3], "config"))
sys.version[:3], "config"))
elif sys.platform == "darwin": elif sys.platform == "darwin":
# attempt to make sure we pick freetype2 over other versions # attempt to make sure we pick freetype2 over other versions
@ -210,8 +214,9 @@ class pil_build_ext(build_ext):
# if Homebrew is installed, use its lib and include directories # if Homebrew is installed, use its lib and include directories
import subprocess import subprocess
try: try:
prefix = subprocess.check_output(['brew', '--prefix']).strip( prefix = subprocess.check_output(
).decode('latin1') ['brew', '--prefix']
).strip().decode('latin1')
except: except:
# Homebrew not installed # Homebrew not installed
prefix = None prefix = None
@ -227,8 +232,8 @@ class pil_build_ext(build_ext):
if ft_prefix and os.path.isdir(ft_prefix): if ft_prefix and os.path.isdir(ft_prefix):
# freetype might not be linked into Homebrew's prefix # freetype might not be linked into Homebrew's prefix
_add_directory(library_dirs, os.path.join(ft_prefix, 'lib')) _add_directory(library_dirs, os.path.join(ft_prefix, 'lib'))
_add_directory(include_dirs, _add_directory(
os.path.join(ft_prefix, 'include')) include_dirs, os.path.join(ft_prefix, 'include'))
else: else:
# fall back to freetype from XQuartz if # fall back to freetype from XQuartz if
# Homebrew's freetype is missing # Homebrew's freetype is missing
@ -249,37 +254,38 @@ class pil_build_ext(build_ext):
if platform_ in ["x86_64", "64bit"]: if platform_ in ["x86_64", "64bit"]:
_add_directory(library_dirs, "/lib64") _add_directory(library_dirs, "/lib64")
_add_directory(library_dirs, "/usr/lib64") _add_directory(library_dirs, "/usr/lib64")
_add_directory(library_dirs, _add_directory(
"/usr/lib/x86_64-linux-gnu") library_dirs, "/usr/lib/x86_64-linux-gnu")
break break
elif platform_ in ["i386", "i686", "32bit"]: elif platform_ in ["i386", "i686", "32bit"]:
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu") _add_directory(
library_dirs, "/usr/lib/i386-linux-gnu")
break break
elif platform_ in ["aarch64"]: elif platform_ in ["aarch64"]:
_add_directory(library_dirs, "/usr/lib64") _add_directory(library_dirs, "/usr/lib64")
_add_directory(library_dirs, _add_directory(
"/usr/lib/aarch64-linux-gnu") library_dirs, "/usr/lib/aarch64-linux-gnu")
break break
elif platform_ in ["arm", "armv7l"]: elif platform_ in ["arm", "armv7l"]:
_add_directory(library_dirs, _add_directory(
"/usr/lib/arm-linux-gnueabi") library_dirs, "/usr/lib/arm-linux-gnueabi")
break break
elif platform_ in ["ppc64"]: elif platform_ in ["ppc64"]:
_add_directory(library_dirs, "/usr/lib64") _add_directory(library_dirs, "/usr/lib64")
_add_directory(library_dirs, _add_directory(
"/usr/lib/ppc64-linux-gnu") library_dirs, "/usr/lib/ppc64-linux-gnu")
_add_directory(library_dirs, _add_directory(
"/usr/lib/powerpc64-linux-gnu") library_dirs, "/usr/lib/powerpc64-linux-gnu")
break break
elif platform_ in ["ppc"]: elif platform_ in ["ppc"]:
_add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") _add_directory(library_dirs, "/usr/lib/ppc-linux-gnu")
_add_directory(library_dirs, _add_directory(
"/usr/lib/powerpc-linux-gnu") library_dirs, "/usr/lib/powerpc-linux-gnu")
break break
elif platform_ in ["s390x"]: elif platform_ in ["s390x"]:
_add_directory(library_dirs, "/usr/lib64") _add_directory(library_dirs, "/usr/lib64")
_add_directory(library_dirs, _add_directory(
"/usr/lib/s390x-linux-gnu") library_dirs, "/usr/lib/s390x-linux-gnu")
break break
elif platform_ in ["s390"]: elif platform_ in ["s390"]:
_add_directory(library_dirs, "/usr/lib/s390-linux-gnu") _add_directory(library_dirs, "/usr/lib/s390-linux-gnu")
@ -305,8 +311,8 @@ class pil_build_ext(build_ext):
_add_directory(include_dirs, "/usr/pkg/include") _add_directory(include_dirs, "/usr/pkg/include")
elif sys.platform.startswith("sunos5"): elif sys.platform.startswith("sunos5"):
_add_directory(library_dirs, "/opt/local/lib") _add_directory(library_dirs, "/opt/local/lib")
_add_directory(include_dirs, "/opt/local/include") _add_directory(include_dirs, "/opt/local/include")
# FIXME: check /opt/stuff directories here? # FIXME: check /opt/stuff directories here?
@ -326,12 +332,8 @@ class pil_build_ext(build_ext):
# locations later) # locations later)
os.path.join("/py" + PYVERSION, "Tcl"), os.path.join("/py" + PYVERSION, "Tcl"),
os.path.join("/python" + PYVERSION, "Tcl"), os.path.join("/python" + PYVERSION, "Tcl"),
"/Tcl", "/Tcl", "/Tcl" + TCLVERSION, "/Tcl" + TCL_VERSION,
"/Tcl" + TCLVERSION, os.path.join(os.environ.get("ProgramFiles", ""), "Tcl"), ]
"/Tcl" + TCL_VERSION,
os.path.join(
os.environ.get("ProgramFiles", ""), "Tcl"),
]
for TCL_ROOT in roots: for TCL_ROOT in roots:
TCL_ROOT = os.path.abspath(TCL_ROOT) TCL_ROOT = os.path.abspath(TCL_ROOT)
if os.path.isfile(os.path.join(TCL_ROOT, "include", "tk.h")): if os.path.isfile(os.path.join(TCL_ROOT, "include", "tk.h")):
@ -366,14 +368,15 @@ class pil_build_ext(build_ext):
best_path = None best_path = None
for name in os.listdir(program_files): for name in os.listdir(program_files):
if name.startswith('OpenJPEG '): if name.startswith('OpenJPEG '):
version = tuple([int(x) for x in name[9:].strip().split( version = tuple(
'.')]) [int(x) for x in name[9:].strip().split('.')])
if version > best_version: if version > best_version:
best_version = version best_version = version
best_path = os.path.join(program_files, name) best_path = os.path.join(program_files, name)
if best_path: if best_path:
_add_directory(library_dirs, os.path.join(best_path, 'lib')) _add_directory(library_dirs,
os.path.join(best_path, 'lib'))
_add_directory(include_dirs, _add_directory(include_dirs,
os.path.join(best_path, 'include')) os.path.join(best_path, 'include'))
@ -394,15 +397,16 @@ class pil_build_ext(build_ext):
if _find_library_file(self, "z"): if _find_library_file(self, "z"):
feature.zlib = "z" feature.zlib = "z"
elif (sys.platform == "win32" and elif (sys.platform == "win32" and
_find_library_file(self, "zlib")): _find_library_file(self, "zlib")):
feature.zlib = "zlib" # alternative name feature.zlib = "zlib" # alternative name
if feature.want('jpeg'): if feature.want('jpeg'):
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 elif (
_find_library_file(self, "libjpeg")): sys.platform == "win32" and
_find_library_file(self, "libjpeg")):
feature.jpeg = "libjpeg" # alternative name feature.jpeg = "libjpeg" # alternative name
feature.openjpeg_version = None feature.openjpeg_version = None
@ -432,8 +436,8 @@ class pil_build_ext(build_ext):
# include path # include path
_add_directory(self.compiler.include_dirs, best_path, 0) _add_directory(self.compiler.include_dirs, best_path, 0)
feature.jpeg2000 = 'openjp2' feature.jpeg2000 = 'openjp2'
feature.openjpeg_version = '.'.join([str(x) for x in feature.openjpeg_version = '.'.join(
best_version]) [str(x) for x in best_version])
if feature.want('tiff'): if feature.want('tiff'):
if _find_library_file(self, "tiff"): if _find_library_file(self, "tiff"):
@ -507,12 +511,12 @@ class pil_build_ext(build_ext):
for f in feature: for f in feature:
if not getattr(feature, f) and feature.require(f): if not getattr(feature, f) and feature.require(f):
if f in ('jpeg', 'zlib'): if f in ('jpeg', 'zlib'):
raise ValueError( raise ValueError('%s is required unless explicitly disabled'
'%s is required unless explicitly disabled' ' using --disable-%s, aborting' %
' using --disable-%s, aborting' % (f, f)) (f, f))
raise ValueError( raise ValueError(
'--enable-%s requested but %s not found, aborting.' % '--enable-%s requested but %s not found, aborting.'
(f, f)) % (f, f))
# #
# core library # core library
@ -544,26 +548,24 @@ class pil_build_ext(build_ext):
if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1: if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1:
defs.append(("WORDS_BIGENDIAN", None)) defs.append(("WORDS_BIGENDIAN", None))
exts = [(Extension("PIL._imaging", exts = [(Extension(
files, "PIL._imaging", files, libraries=libs, define_macros=defs))]
libraries=libs,
define_macros=defs))]
# #
# additional libraries # additional libraries
if feature.freetype: if feature.freetype:
exts.append(Extension("PIL._imagingft", exts.append(Extension(
["_imagingft.c"], "PIL._imagingft", ["_imagingft.c"], libraries=["freetype"]))
libraries=["freetype"]))
if os.path.isfile("_imagingcms.c") and feature.lcms: if os.path.isfile("_imagingcms.c") and feature.lcms:
extra = [] extra = []
if sys.platform == "win32": if sys.platform == "win32":
extra.extend(["user32", "gdi32"]) extra.extend(["user32", "gdi32"])
exts.append(Extension("PIL._imagingcms", exts.append(Extension(
["_imagingcms.c"], "PIL._imagingcms",
libraries=[feature.lcms] + extra)) ["_imagingcms.c"],
libraries=[feature.lcms] + extra))
if os.path.isfile("_webp.c") and feature.webp: if os.path.isfile("_webp.c") and feature.webp:
libs = [feature.webp] libs = [feature.webp]
@ -574,18 +576,16 @@ class pil_build_ext(build_ext):
libs.append(feature.webpmux) libs.append(feature.webpmux)
libs.append(feature.webpmux.replace('pmux', 'pdemux')) libs.append(feature.webpmux.replace('pmux', 'pdemux'))
exts.append(Extension("PIL._webp", exts.append(Extension(
["_webp.c"], "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))
libraries=libs,
define_macros=defs))
if feature.tcl and feature.tk: if feature.tcl and feature.tk:
if sys.platform == "darwin": if sys.platform == "darwin":
# locate Tcl/Tk frameworks # locate Tcl/Tk frameworks
frameworks = [] frameworks = []
framework_roots = [ framework_roots = [
"/Library/Frameworks", "/System/Library/Frameworks" "/Library/Frameworks",
] "/System/Library/Frameworks"]
for root in framework_roots: for root in framework_roots:
root_tcl = os.path.join(root, "Tcl.framework") root_tcl = os.path.join(root, "Tcl.framework")
root_tk = os.path.join(root, "Tk.framework") root_tk = os.path.join(root, "Tk.framework")
@ -598,14 +598,14 @@ class pil_build_ext(build_ext):
_add_directory(self.compiler.include_dirs, dir, 1) _add_directory(self.compiler.include_dirs, dir, 1)
break break
if frameworks: if frameworks:
exts.append(Extension("PIL._imagingtk", exts.append(Extension(
["_imagingtk.c", "Tk/tkImaging.c"], "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
extra_compile_args=frameworks, extra_compile_args=frameworks,
extra_link_args=frameworks)) extra_link_args=frameworks))
else: else:
exts.append(Extension("PIL._imagingtk", exts.append(Extension(
["_imagingtk.c", "Tk/tkImaging.c"], "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
libraries=[feature.tcl, feature.tk])) libraries=[feature.tcl, feature.tk]))
if os.path.isfile("_imagingmath.c"): if os.path.isfile("_imagingmath.c"):
exts.append(Extension("PIL._imagingmath", ["_imagingmath.c"])) exts.append(Extension("PIL._imagingmath", ["_imagingmath.c"]))
@ -643,14 +643,13 @@ class pil_build_ext(build_ext):
(feature.tcl and feature.tk, "TKINTER"), (feature.tcl and feature.tk, "TKINTER"),
(feature.jpeg, "JPEG"), (feature.jpeg, "JPEG"),
(feature.jpeg2000, "OPENJPEG (JPEG2000)", (feature.jpeg2000, "OPENJPEG (JPEG2000)",
feature.openjpeg_version), feature.openjpeg_version),
(feature.zlib, "ZLIB (PNG/ZIP)"), (feature.zlib, "ZLIB (PNG/ZIP)"),
(feature.tiff, "LIBTIFF"), (feature.tiff, "LIBTIFF"),
(feature.freetype, "FREETYPE2"), (feature.freetype, "FREETYPE2"),
(feature.lcms, "LITTLECMS2"), (feature.lcms, "LITTLECMS2"),
(feature.webp, "WEBP"), (feature.webp, "WEBP"),
(feature.webpmux, "WEBPMUX"), (feature.webpmux, "WEBPMUX"), ]
]
all = 1 all = 1
for option in options: for option in options:
@ -718,10 +717,12 @@ class pil_build_ext(build_ext):
fp = open(tmpfile, 'r') fp = open(tmpfile, 'r')
multiarch_path_component = fp.readline().strip() multiarch_path_component = fp.readline().strip()
fp.close() fp.close()
_add_directory(self.compiler.library_dirs, _add_directory(
'/usr/lib/' + multiarch_path_component) self.compiler.library_dirs,
_add_directory(self.compiler.include_dirs, '/usr/lib/' + multiarch_path_component)
'/usr/include/' + multiarch_path_component) _add_directory(
self.compiler.include_dirs,
'/usr/include/' + multiarch_path_component)
finally: finally:
os.unlink(tmpfile) os.unlink(tmpfile)
@ -729,40 +730,41 @@ class pil_build_ext(build_ext):
def debug_build(): def debug_build():
return hasattr(sys, 'gettotalrefcount') return hasattr(sys, 'gettotalrefcount')
setup(
setup(name=NAME, name=NAME,
version=PILLOW_VERSION, version=PILLOW_VERSION,
description='Python Imaging Library (Fork)', description='Python Imaging Library (Fork)',
long_description=_read('README.rst').decode('utf-8'), long_description=_read('README.rst').decode('utf-8'),
author='Alex Clark (Fork Author)', author='Alex Clark (Fork Author)',
author_email='aclark@aclark.net', author_email='aclark@aclark.net',
url='http://python-pillow.org', url='http://python-pillow.github.io/',
classifiers=[ classifiers=[
"Development Status :: 6 - Mature", "Development Status :: 6 - Mature",
"Topic :: Multimedia :: Graphics", "Topic :: Multimedia :: Graphics",
"Topic :: Multimedia :: Graphics :: Capture :: Digital Camera", "Topic :: Multimedia :: Graphics :: Capture :: Digital Camera",
"Topic :: Multimedia :: Graphics :: Capture :: Scanners", "Topic :: Multimedia :: Graphics :: Capture :: Scanners",
"Topic :: Multimedia :: Graphics :: Capture :: Screen Capture", "Topic :: Multimedia :: Graphics :: Capture :: Screen Capture",
"Topic :: Multimedia :: Graphics :: Graphics Conversion", "Topic :: Multimedia :: Graphics :: Graphics Conversion",
"Topic :: Multimedia :: Graphics :: Viewers", "Topic :: Multimedia :: Graphics :: Viewers",
"Programming Language :: Python :: 2", "Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy', 'Programming Language :: Python :: Implementation :: PyPy',
], ],
cmdclass={"build_ext": pil_build_ext}, cmdclass={"build_ext": pil_build_ext},
ext_modules=[Extension("PIL._imaging", ["_imaging.c"])], ext_modules=[Extension("PIL._imaging", ["_imaging.c"])],
include_package_data=True, include_package_data=True,
packages=find_packages(), packages=find_packages(),
scripts=glob.glob("Scripts/*.py"), scripts=glob.glob("Scripts/*.py"),
test_suite='nose.collector', test_suite='nose.collector',
keywords=["Imaging", ], keywords=["Imaging", ],
license='Standard PIL License', license='Standard PIL License',
zip_safe=not debug_build(), ) zip_safe=not debug_build(),
)
# End of file # End of file