Pillow/winbuild/config.py

181 lines
5.0 KiB
Python
Raw Normal View History

2016-08-29 13:48:59 +03:00
import os
SF_MIRROR = 'http://iweb.dl.sourceforge.net'
2016-08-29 14:53:48 +03:00
PILLOW_DEPENDS_DIR = 'C:\\pillow-depends\\'
2016-08-29 13:48:59 +03:00
2018-10-21 09:45:30 +03:00
pythons = {'27': {'compiler': 7, 'vc': 2008},
'pypy2': {'compiler': 7, 'vc': 2008},
'34': {'compiler': 7.1, 'vc': 2010},
'35': {'compiler': 7.1, 'vc': 2015},
'36': {'compiler': 7.1, 'vc': 2015},
'37': {'compiler': 7.1, 'vc': 2015}}
2016-08-29 13:48:59 +03:00
VIRT_BASE = "c:/vp/"
X64_EXT = os.environ.get('X64_EXT', "x64")
libs = {
2016-08-29 14:53:48 +03:00
# 'openjpeg': {
# 'filename': 'openjpeg-2.0.0-win32-x86.zip',
# 'version': '2.0'
# },
2016-08-29 13:48:59 +03:00
'zlib': {
2017-01-17 11:36:04 +03:00
'url': 'http://zlib.net/zlib1211.zip',
'filename': PILLOW_DEPENDS_DIR + 'zlib1211.zip',
'dir': 'zlib-1.2.11',
2016-08-29 13:48:59 +03:00
},
'jpeg': {
2018-05-18 13:56:55 +03:00
'url': 'http://www.ijg.org/files/jpegsr9c.zip',
'filename': PILLOW_DEPENDS_DIR + 'jpegsr9c.zip',
'dir': 'jpeg-9c',
2016-08-29 13:48:59 +03:00
},
'tiff': {
2017-11-22 21:10:42 +03:00
'url': 'ftp://download.osgeo.org/libtiff/tiff-4.0.9.zip',
'filename': PILLOW_DEPENDS_DIR + 'tiff-4.0.9.zip',
'dir': 'tiff-4.0.9',
2016-08-29 13:48:59 +03:00
},
'freetype': {
2018-05-04 12:35:59 +03:00
'url': 'https://download.savannah.gnu.org/releases/freetype/freetype-2.9.1.tar.gz',
'filename': PILLOW_DEPENDS_DIR + 'freetype-2.9.1.tar.gz',
'dir': 'freetype-2.9.1',
2016-08-29 13:48:59 +03:00
},
'lcms': {
'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip',
2016-08-29 14:53:48 +03:00
'filename': PILLOW_DEPENDS_DIR + 'lcms2-2.7.zip',
2016-08-29 13:48:59 +03:00
'dir': 'lcms2-2.7',
},
'tcl-8.5': {
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip',
2016-08-29 14:53:48 +03:00
'filename': PILLOW_DEPENDS_DIR + 'tcl8519-src.zip',
2016-08-29 13:48:59 +03:00
'dir': '',
},
'tk-8.5': {
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tk8519-src.zip',
2016-08-29 14:53:48 +03:00
'filename': PILLOW_DEPENDS_DIR + 'tk8519-src.zip',
2016-08-29 13:48:59 +03:00
'dir': '',
'version': '8.5.19',
},
'tcl-8.6': {
2017-12-23 00:26:56 +03:00
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.8/tcl868-src.zip',
'filename': PILLOW_DEPENDS_DIR + 'tcl868-src.zip',
2016-08-29 13:48:59 +03:00
'dir': '',
},
'tk-8.6': {
2017-12-23 00:26:56 +03:00
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.8/tk868-src.zip',
'filename': PILLOW_DEPENDS_DIR + 'tk868-src.zip',
2016-08-29 13:48:59 +03:00
'dir': '',
2017-12-23 00:26:56 +03:00
'version': '8.6.8',
2016-08-29 13:48:59 +03:00
},
'webp': {
2018-04-23 03:27:40 +03:00
'url': 'http://downloads.webmproject.org/releases/webp/libwebp-1.0.0.tar.gz',
'filename': PILLOW_DEPENDS_DIR + 'libwebp-1.0.0.tar.gz',
'dir': 'libwebp-1.0.0',
2016-08-29 13:48:59 +03:00
},
'openjpeg': {
2017-10-05 12:11:31 +03:00
'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.3.0/openjpeg-2.3.0.tar.gz',
'filename': PILLOW_DEPENDS_DIR + 'openjpeg-2.3.0.tar.gz',
'dir': 'openjpeg-2.3.0',
2016-08-29 13:48:59 +03:00
},
}
compilers = {
2018-10-08 11:43:11 +03:00
7: {
2008: {
64: {
'env_version': 'v7.0',
'vc_version': '2008',
'env_flags': '/x64 /xp',
'inc_dir': 'msvcr90-x64',
'platform': 'x64',
'webp_platform': 'x64',
},
32: {
'env_version': 'v7.0',
'vc_version': '2008',
'env_flags': '/x86 /xp',
'inc_dir': 'msvcr90-x32',
'platform': 'Win32',
'webp_platform': 'x86',
}
}
2016-08-29 13:48:59 +03:00
},
2018-10-08 11:43:11 +03:00
7.1: {
2010: {
64: {
'env_version': 'v7.1',
'vc_version': '2010',
'env_flags': '/x64 /vista',
'inc_dir': 'msvcr10-x64',
'platform': 'x64',
'webp_platform': 'x64',
},
32: {
'env_version': 'v7.1',
'vc_version': '2010',
'env_flags': '/x86 /vista',
'inc_dir': 'msvcr10-x32',
'platform': 'Win32',
'webp_platform': 'x86',
}
},
2015: {
64: {
'env_version': 'v7.1',
'vc_version': '2015',
'env_flags': '/x64 /vista',
'inc_dir': 'msvcr10-x64',
'platform': 'x64',
'webp_platform': 'x64',
},
32: {
'env_version': 'v7.1',
'vc_version': '2015',
'env_flags': '/x86 /vista',
'inc_dir': 'msvcr10-x32',
'platform': 'Win32',
'webp_platform': 'x86',
}
}
}
2016-08-29 13:48:59 +03:00
}
2016-08-29 15:06:48 +03:00
def pyversion_from_env():
2016-08-29 13:48:59 +03:00
py = os.environ['PYTHON']
py_version = '27'
for k in pythons:
2016-08-29 13:48:59 +03:00
if k in py:
py_version = k
break
if '64' in py:
py_version = '%s%s' % (py_version, X64_EXT)
return py_version
2016-08-29 15:06:48 +03:00
def compiler_from_env():
2016-08-29 13:48:59 +03:00
py = os.environ['PYTHON']
for k, v in pythons.items():
if k in py:
2018-10-08 11:43:11 +03:00
py_info = v
2016-08-29 13:48:59 +03:00
break
2018-10-08 11:43:11 +03:00
bit = bit_from_env()
return compilers[py_info['compiler']][py_info['vc']][bit]
2018-10-21 10:00:39 +03:00
2018-10-08 11:43:11 +03:00
def bit_from_env():
py = os.environ['PYTHON']
return 64 if '64' in py else 32
2016-08-29 13:48:59 +03:00
2018-10-21 10:00:39 +03:00
2018-10-08 11:43:11 +03:00
def all_compilers():
all = []
for vc_compilers in compilers.values():
for bit_compilers in vc_compilers.values():
all += bit_compilers.values()
return all