~jibel/ubuntu/trusty/python-imaging/lp1248743_enable_autopkgtest

« back to all changes in this revision

Viewing changes to .pc/changes-1.1.7.diff/setup.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-03-20 16:44:01 UTC
  • mfrom: (2.1.13 experimental)
  • Revision ID: package-import@ubuntu.com-20130320164401-ptf6m0ttg4zw72az
Tags: 1.1.7+2.0.0-1
Pillow 2.0.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from __future__ import print_function
1
2
import glob
2
3
import os
3
4
import platform
15
16
    )
16
17
 
17
18
_LIB_IMAGING = (
18
 
    "Access", "Antialias", "Bands", "BitDecode", "Blend", "Chops",
19
 
    "Convert", "ConvertYCbCr", "Copy", "Crc32", "Crop", "Dib", "Draw",
 
19
    "Access", "AlphaComposite", "Antialias", "Bands", "BitDecode", "Blend",
 
20
    "Chops", "Convert", "ConvertYCbCr", "Copy", "Crc32", "Crop", "Dib", "Draw",
20
21
    "Effects", "EpsEncode", "File", "Fill", "Filter", "FliDecode",
21
22
    "Geometry", "GetBBox", "GifDecode", "GifEncode", "HexDecode",
22
23
    "Histo", "JpegDecode", "JpegEncode", "LzwDecode", "Matrix",
23
24
    "ModeFilter", "MspDecode", "Negative", "Offset", "Pack",
24
 
    "PackDecode", "Palette", "Paste", "Quant", "QuantHash",
 
25
    "PackDecode", "Palette", "Paste", "Quant", "QuantOctree", "QuantHash",
25
26
    "QuantHeap", "PcdDecode", "PcxDecode", "PcxEncode", "Point",
26
27
    "RankFilter", "RawDecode", "RawEncode", "Storage", "SunRleDecode",
27
28
    "TgaRleDecode", "Unpack", "UnpackYCC", "UnsharpMask", "XbmDecode",
28
 
    "XbmEncode", "ZipDecode", "ZipEncode")
 
29
    "XbmEncode", "ZipDecode", "ZipEncode", "TiffDecode")
29
30
 
30
31
 
31
32
def _add_directory(path, dir, where=None):
70
71
 
71
72
 
72
73
NAME = 'Pillow'
73
 
VERSION = '1.7.8'
 
74
VERSION = '2.0.0'
74
75
PIL_VERSION = '1.1.7'
75
76
TCL_ROOT = None
76
77
JPEG_ROOT = None
92
93
        _add_directory(include_dirs, "libImaging")
93
94
 
94
95
        #
 
96
        # add configured kits
 
97
 
 
98
        for root in (TCL_ROOT, JPEG_ROOT, TIFF_ROOT, ZLIB_ROOT,
 
99
                     FREETYPE_ROOT, LCMS_ROOT):
 
100
            if isinstance(root, type(())):
 
101
                lib_root, include_root = root
 
102
            else:
 
103
                lib_root = include_root = root
 
104
            _add_directory(library_dirs, lib_root)
 
105
            _add_directory(include_dirs, include_root)
 
106
 
 
107
        #
95
108
        # add platform directories
96
109
 
97
110
        if sys.platform == "cygwin":
114
127
            _add_directory(include_dirs, "/usr/X11/include")
115
128
 
116
129
        elif sys.platform.startswith("linux"):
117
 
            if platform.processor() == "x86_64":
118
 
                _add_directory(library_dirs, "/lib64")
119
 
                _add_directory(library_dirs, "/usr/lib64")
120
 
                _add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
 
130
            for platform_ in (platform.processor(),platform.architecture()[0]):
 
131
                if not platform_: continue
 
132
 
 
133
                if platform_ in ["x86_64", "64bit"]:
 
134
                    _add_directory(library_dirs, "/lib64")
 
135
                    _add_directory(library_dirs, "/usr/lib64")
 
136
                    _add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
 
137
                    break
 
138
                elif platform_ in ["i386", "i686", "32bit"]:
 
139
                    _add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
 
140
                    break
121
141
            else:
122
 
                _add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
 
142
                raise ValueError("Unable to identify Linux platform: `%s`" % platform_)
123
143
 
124
144
            # XXX Kludge. Above /\ we brute force support multiarch. Here we
125
145
            # try Barry's more general approach. Afterward, something should
137
157
        #
138
158
        # locate tkinter libraries
139
159
 
 
160
 
140
161
        if _tkinter:
141
162
            TCL_VERSION = _tkinter.TCL_VERSION[:3]
142
163
 
165
186
            else:
166
187
                TCL_ROOT = None
167
188
 
168
 
        #
169
 
        # add configured kits
170
 
 
171
 
        for root in (TCL_ROOT, JPEG_ROOT, TCL_ROOT, TIFF_ROOT, ZLIB_ROOT,
172
 
                     FREETYPE_ROOT, LCMS_ROOT):
173
 
            if isinstance(root, type(())):
174
 
                lib_root, include_root = root
175
 
            else:
176
 
                lib_root = include_root = root
177
 
            _add_directory(library_dirs, lib_root)
178
 
            _add_directory(include_dirs, include_root)
179
189
 
180
190
        #
181
191
        # add standard directories
204
214
        # look for available libraries
205
215
 
206
216
        class feature:
207
 
            zlib = jpeg = tiff = freetype = tcl = tk = lcms = None
 
217
            zlib = jpeg = tiff = freetype = tcl = tk = lcms = webp = None
208
218
        feature = feature()
209
219
 
210
220
        if _find_include_file(self, "zlib.h"):
222
232
 
223
233
        if _find_library_file(self, "tiff"):
224
234
            feature.tiff = "tiff"
 
235
        if sys.platform == "win32" and _find_library_file(self, "libtiff"):
 
236
            feature.tiff = "libtiff"
 
237
        if sys.platform == "darwin" and _find_library_file(self, "libtiff"):
 
238
            feature.tiff = "libtiff"
225
239
 
226
240
        if _find_library_file(self, "freetype"):
227
241
            # look for freetype2 include files
260
274
            elif _find_library_file(self, "tk" + TCL_VERSION):
261
275
                feature.tk = "tk" + TCL_VERSION
262
276
 
 
277
        if _find_include_file(self, "webp/encode.h") and _find_include_file(self, "webp/decode.h"):
 
278
            if _find_library_file(self, "webp"):
 
279
                feature.webp = "webp"
 
280
 
263
281
        #
264
282
        # core library
265
283
 
277
295
        if feature.zlib:
278
296
            libs.append(feature.zlib)
279
297
            defs.append(("HAVE_LIBZ", None))
 
298
        if feature.tiff:
 
299
            libs.append(feature.tiff)
 
300
            defs.append(("HAVE_LIBTIFF", None))
280
301
        if sys.platform == "win32":
281
302
            libs.extend(["kernel32", "user32", "gdi32"])
282
303
        if struct.unpack("h", "\0\1".encode('ascii'))[0] == 1:
307
328
            exts.append(Extension(
308
329
                "_imagingcms", ["_imagingcms.c"], libraries=["lcms"] + extra))
309
330
 
 
331
        if os.path.isfile("_webp.c") and feature.webp:
 
332
            exts.append(Extension(
 
333
                "_webp", ["_webp.c"], libraries=["webp"]))
 
334
 
 
335
 
310
336
        if sys.platform == "darwin":
311
337
            # locate Tcl/Tk frameworks
312
338
            frameworks = []
353
379
    def summary_report(self, feature, unsafe_zlib):
354
380
 
355
381
        print("-" * 68)
356
 
        print("SETUP SUMMARY (Pillow %s / PIL %s)" % (VERSION, PIL_VERSION))
 
382
        print("SETUP SUMMARY (Pillow %s fork, originally based on PIL %s)" % (VERSION, PIL_VERSION))
357
383
        print("-" * 68)
358
 
        print("version      %s" % VERSION)
 
384
        print("version      %s (Pillow)" % VERSION)
359
385
        v = sys.version.split("[")
360
386
        print("platform     %s %s" % (sys.platform, v[0].strip()))
361
387
        for v in v[1:]:
366
392
            (feature.tcl and feature.tk, "TKINTER"),
367
393
            (feature.jpeg, "JPEG"),
368
394
            (feature.zlib, "ZLIB (PNG/ZIP)"),
369
 
            # (feature.tiff, "experimental TIFF G3/G4 read"),
 
395
            (feature.tiff, "TIFF G3/G4 (experimental)"),
370
396
            (feature.freetype, "FREETYPE2"),
371
397
            (feature.lcms, "LITTLECMS"),
 
398
            (feature.webp, "WEBP"),
372
399
            ]
373
400
 
374
401
        all = 1
380
407
                if option[1] == "TKINTER" and _tkinter:
381
408
                    version = _tkinter.TCL_VERSION
382
409
                    print("(Tcl/Tk %s libraries needed)" % version)
383
 
                print("")
384
410
                all = 0
385
411
 
386
412
        if feature.zlib and unsafe_zlib:
399
425
            print("To add a missing option, make sure you have the required")
400
426
            print("library, and set the corresponding ROOT variable in the")
401
427
            print("setup.py script.")
402
 
            print("\n")
 
428
            print("")
403
429
 
404
430
        print("To check the build, run the selftest.py script.")
 
431
        print("")
405
432
 
406
433
    def check_zlib_version(self, include_dirs):
407
434
        # look for unsafe versions of zlib
433
460
            tmpfile)
434
461
        try:
435
462
            if ret >> 8 == 0:
436
 
                fp = open(tmpfile, 'rb')
 
463
                fp = open(tmpfile, 'r')
437
464
                multiarch_path_component = fp.readline().strip()
438
465
                _add_directory(self.compiler.library_dirs,
439
466
                    '/usr/lib/' + multiarch_path_component)
447
474
    version=VERSION,
448
475
    description='Python Imaging Library (fork)',
449
476
    long_description=(
450
 
        _read('README.rst') +
451
 
        _read('docs/INSTALL.txt') +
452
 
        _read('docs/HISTORY.txt')).decode('utf-8'),
 
477
        _read('README.rst') + b'\n' +
 
478
        _read('docs/HISTORY.txt') + b'\n' +
 
479
        _read('docs/CONTRIBUTORS.txt')).decode('utf-8'),
453
480
    author='Alex Clark (fork author)',
454
481
    author_email='aclark@aclark.net',
455
482
    url='http://github.com/python-imaging/Pillow',
456
 
    use_2to3=True,
457
483
    classifiers=[
458
484
        "Development Status :: 6 - Mature",
459
485
        "Topic :: Multimedia :: Graphics",
462
488
        "Topic :: Multimedia :: Graphics :: Capture :: Screen Capture",
463
489
        "Topic :: Multimedia :: Graphics :: Graphics Conversion",
464
490
        "Topic :: Multimedia :: Graphics :: Viewers",
 
491
        "Programming Language :: Python :: 2",
 
492
        "Programming Language :: Python :: 2.6",
 
493
        "Programming Language :: Python :: 2.7",
 
494
        "Programming Language :: Python :: 3",
 
495
        "Programming Language :: Python :: 3.2",
 
496
        "Programming Language :: Python :: 3.3",
465
497
        ],
466
498
    cmdclass={"build_ext": pil_build_ext},
467
499
    ext_modules=[Extension("_imaging", ["_imaging.c"])],
468
500
    packages=find_packages(),
469
501
    scripts=glob.glob("Scripts/pil*.py"),
 
502
    keywords=["Imaging",],
 
503
    license='Standard PIL License',
470
504
    )