Update website URL [ci skip]

This commit is contained in:
Alex Clark 2016-03-15 07:10:42 -04:00
parent b7b42a65c1
commit 838986349c

162
setup.py
View File

@ -22,18 +22,16 @@ 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 = ( _IMAGING = ("decode", "encode", "map", "display", "outline", "path")
"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", "Effects", "EpsEncode", "File", "Fill", "Filter", "FliDecode", "Geometry",
"Geometry", "GetBBox", "GifDecode", "GifEncode", "HexDecode", "GetBBox", "GifDecode", "GifEncode", "HexDecode", "Histo", "JpegDecode",
"Histo", "JpegDecode", "JpegEncode", "LzwDecode", "Matrix", "JpegEncode", "LzwDecode", "Matrix", "ModeFilter", "MspDecode", "Negative",
"ModeFilter", "MspDecode", "Negative", "Offset", "Pack", "Offset", "Pack", "PackDecode", "Palette", "Paste", "Quant", "QuantOctree",
"PackDecode", "Palette", "Paste", "Quant", "QuantOctree", "QuantHash", "QuantHash", "QuantHeap", "PcdDecode", "PcxDecode", "PcxEncode", "Point",
"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",
@ -65,13 +63,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( ret = self.compiler.find_library_file(self.compiler.library_dirs,
self.compiler.library_dirs, library) 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( return self.compiler.find_library_file(self.compiler.library_dirs,
self.compiler.library_dirs, library) library)
def _lib_include(root): def _lib_include(root):
@ -82,13 +80,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
@ -101,7 +99,6 @@ 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
@ -121,11 +118,9 @@ 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) ('disable-%s' % x, None, 'Disable support for %s' % x) for x in feature
for x in feature
] + [ ] + [
('enable-%s' % x, None, 'Enable support for %s' % x) ('enable-%s' % x, None, 'Enable support for %s' % x) for x in feature
for x in feature
] ]
def initialize_options(self): def initialize_options(self):
@ -142,8 +137,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)
@ -197,8 +192,9 @@ 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, os.path.join( _add_directory(library_dirs,
"/usr/lib", "python%s" % sys.version[:3], "config")) os.path.join("/usr/lib", "python%s" %
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
@ -214,9 +210,8 @@ 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( prefix = subprocess.check_output(['brew', '--prefix']).strip(
['brew', '--prefix'] ).decode('latin1')
).strip().decode('latin1')
except: except:
# Homebrew not installed # Homebrew not installed
prefix = None prefix = None
@ -232,8 +227,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( _add_directory(include_dirs,
include_dirs, os.path.join(ft_prefix, 'include')) 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
@ -254,38 +249,37 @@ 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( _add_directory(library_dirs,
library_dirs, "/usr/lib/x86_64-linux-gnu") "/usr/lib/x86_64-linux-gnu")
break break
elif platform_ in ["i386", "i686", "32bit"]: elif platform_ in ["i386", "i686", "32bit"]:
_add_directory( _add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
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( _add_directory(library_dirs,
library_dirs, "/usr/lib/aarch64-linux-gnu") "/usr/lib/aarch64-linux-gnu")
break break
elif platform_ in ["arm", "armv7l"]: elif platform_ in ["arm", "armv7l"]:
_add_directory( _add_directory(library_dirs,
library_dirs, "/usr/lib/arm-linux-gnueabi") "/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( _add_directory(library_dirs,
library_dirs, "/usr/lib/ppc64-linux-gnu") "/usr/lib/ppc64-linux-gnu")
_add_directory( _add_directory(library_dirs,
library_dirs, "/usr/lib/powerpc64-linux-gnu") "/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( _add_directory(library_dirs,
library_dirs, "/usr/lib/powerpc-linux-gnu") "/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( _add_directory(library_dirs,
library_dirs, "/usr/lib/s390x-linux-gnu") "/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")
@ -332,8 +326,12 @@ 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" + TCLVERSION, "/Tcl" + TCL_VERSION, "/Tcl",
os.path.join(os.environ.get("ProgramFiles", ""), "Tcl"), ] "/Tcl" + TCLVERSION,
"/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")):
@ -368,15 +366,14 @@ 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( version = tuple([int(x) for x in name[9:].strip().split(
[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, _add_directory(library_dirs, os.path.join(best_path, 'lib'))
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'))
@ -404,8 +401,7 @@ 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 ( elif (sys.platform == "win32" and
sys.platform == "win32" and
_find_library_file(self, "libjpeg")): _find_library_file(self, "libjpeg")):
feature.jpeg = "libjpeg" # alternative name feature.jpeg = "libjpeg" # alternative name
@ -436,8 +432,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( feature.openjpeg_version = '.'.join([str(x) for x in
[str(x) for x in best_version]) best_version])
if feature.want('tiff'): if feature.want('tiff'):
if _find_library_file(self, "tiff"): if _find_library_file(self, "tiff"):
@ -511,12 +507,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('%s is required unless explicitly disabled'
' using --disable-%s, aborting' %
(f, f))
raise ValueError( raise ValueError(
'--enable-%s requested but %s not found, aborting.' '%s is required unless explicitly disabled'
% (f, f)) ' using --disable-%s, aborting' % (f, f))
raise ValueError(
'--enable-%s requested but %s not found, aborting.' %
(f, f))
# #
# core library # core library
@ -548,22 +544,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( exts = [(Extension("PIL._imaging",
"PIL._imaging", files, libraries=libs, define_macros=defs))] files,
libraries=libs,
define_macros=defs))]
# #
# additional libraries # additional libraries
if feature.freetype: if feature.freetype:
exts.append(Extension( exts.append(Extension("PIL._imagingft",
"PIL._imagingft", ["_imagingft.c"], libraries=["freetype"])) ["_imagingft.c"],
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( exts.append(Extension("PIL._imagingcms",
"PIL._imagingcms",
["_imagingcms.c"], ["_imagingcms.c"],
libraries=[feature.lcms] + extra)) libraries=[feature.lcms] + extra))
@ -576,16 +574,18 @@ 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( exts.append(Extension("PIL._webp",
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs)) ["_webp.c"],
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", "/Library/Frameworks", "/System/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,13 +598,13 @@ 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( exts.append(Extension("PIL._imagingtk",
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], ["_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( exts.append(Extension("PIL._imagingtk",
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], ["_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"):
@ -649,7 +649,8 @@ class pil_build_ext(build_ext):
(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:
@ -717,11 +718,9 @@ 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( _add_directory(self.compiler.library_dirs,
self.compiler.library_dirs,
'/usr/lib/' + multiarch_path_component) '/usr/lib/' + multiarch_path_component)
_add_directory( _add_directory(self.compiler.include_dirs,
self.compiler.include_dirs,
'/usr/include/' + multiarch_path_component) '/usr/include/' + multiarch_path_component)
finally: finally:
os.unlink(tmpfile) os.unlink(tmpfile)
@ -730,14 +729,14 @@ class pil_build_ext(build_ext):
def debug_build(): def debug_build():
return hasattr(sys, 'gettotalrefcount') return hasattr(sys, 'gettotalrefcount')
setup(
name=NAME, setup(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.github.io/', url='http://python-pillow.org',
classifiers=[ classifiers=[
"Development Status :: 6 - Mature", "Development Status :: 6 - Mature",
"Topic :: Multimedia :: Graphics", "Topic :: Multimedia :: Graphics",
@ -765,6 +764,5 @@ setup(
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