Pillow/winbuild/config.py

206 lines
5.8 KiB
Python
Raw Normal View History

2016-08-29 13:48:59 +03:00
import os
2019-09-27 11:18:32 +03:00
SF_MIRROR = "https://iweb.dl.sourceforge.net"
2019-06-13 18:54:57 +03:00
pythons = {
2019-09-23 14:47:45 +03:00
# for AppVeyor
2019-06-13 18:54:57 +03:00
"27": {"compiler": 7, "vc": 2010},
"pypy2": {"compiler": 7, "vc": 2010},
"35": {"compiler": 7.1, "vc": 2015},
"36": {"compiler": 7.1, "vc": 2015},
"pypy3": {"compiler": 7.1, "vc": 2015},
2019-06-13 18:54:57 +03:00
"37": {"compiler": 7.1, "vc": 2015},
2019-11-09 11:13:57 +03:00
"38": {"compiler": 7.1, "vc": 2015},
2019-09-23 14:47:45 +03:00
# for GitHub Actions
2019-09-24 13:59:44 +03:00
"3.5": {"compiler": 7.1, "vc": 2015},
2019-09-23 14:47:45 +03:00
"3.6": {"compiler": 7.1, "vc": 2015},
2019-09-24 13:59:44 +03:00
"3.7": {"compiler": 7.1, "vc": 2015},
2019-06-13 18:54:57 +03:00
}
2016-08-29 13:48:59 +03:00
VIRT_BASE = "c:/vp/"
2019-06-13 18:54:57 +03:00
X64_EXT = os.environ.get("X64_EXT", "x64")
2016-08-29 13:48:59 +03:00
libs = {
2016-08-29 14:53:48 +03:00
# 'openjpeg': {
# 'filename': 'openjpeg-2.0.0-win32-x86.zip',
# 'version': '2.0'
# },
2019-06-13 18:54:57 +03:00
"zlib": {
"url": "http://zlib.net/zlib1211.zip",
2019-10-28 15:11:13 +03:00
"filename": "zlib1211.zip",
2019-06-13 18:54:57 +03:00
"dir": "zlib-1.2.11",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"jpeg": {
"url": "http://www.ijg.org/files/jpegsr9c.zip",
2019-10-28 15:11:13 +03:00
"filename": "jpegsr9c.zip",
2019-06-13 18:54:57 +03:00
"dir": "jpeg-9c",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"tiff": {
2019-11-04 11:07:47 +03:00
"url": "ftp://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
"filename": "tiff-4.1.0.tar.gz",
"dir": "tiff-4.1.0",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"freetype": {
2019-07-07 05:35:37 +03:00
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501
2019-10-28 15:11:13 +03:00
"filename": "freetype-2.10.1.tar.gz",
2019-07-07 05:35:37 +03:00
"dir": "freetype-2.10.1",
2016-08-29 13:48:59 +03:00
},
"lcms-2.7": {
2019-06-13 18:54:57 +03:00
"url": SF_MIRROR + "/project/lcms/lcms/2.7/lcms2-2.7.zip",
2019-10-28 15:11:13 +03:00
"filename": "lcms2-2.7.zip",
2019-06-13 18:54:57 +03:00
"dir": "lcms2-2.7",
2016-08-29 13:48:59 +03:00
},
"lcms-2.8": {
"url": SF_MIRROR + "/project/lcms/lcms/2.8/lcms2-2.8.zip",
2019-10-28 15:11:13 +03:00
"filename": "lcms2-2.8.zip",
"dir": "lcms2-2.8",
},
2019-06-13 18:54:57 +03:00
"ghostscript": {
"url": "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs927/ghostscript-9.27.tar.gz", # noqa: E501
2019-10-28 15:11:13 +03:00
"filename": "ghostscript-9.27.tar.gz",
2019-06-13 18:54:57 +03:00
"dir": "ghostscript-9.27",
2019-01-17 03:15:42 +03:00
},
2019-06-13 18:54:57 +03:00
"tcl-8.5": {
"url": SF_MIRROR + "/project/tcl/Tcl/8.5.19/tcl8519-src.zip",
2019-10-28 15:11:13 +03:00
"filename": "tcl8519-src.zip",
2019-06-13 18:54:57 +03:00
"dir": "",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"tk-8.5": {
"url": SF_MIRROR + "/project/tcl/Tcl/8.5.19/tk8519-src.zip",
2019-10-28 15:11:13 +03:00
"filename": "tk8519-src.zip",
2019-06-13 18:54:57 +03:00
"dir": "",
"version": "8.5.19",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"tcl-8.6": {
"url": SF_MIRROR + "/project/tcl/Tcl/8.6.9/tcl869-src.zip",
2019-10-28 15:11:13 +03:00
"filename": "tcl869-src.zip",
2019-06-13 18:54:57 +03:00
"dir": "",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"tk-8.6": {
"url": SF_MIRROR + "/project/tcl/Tcl/8.6.9/tk869-src.zip",
2019-10-28 15:11:13 +03:00
"filename": "tk869-src.zip",
2019-06-13 18:54:57 +03:00
"dir": "",
"version": "8.6.9",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"webp": {
2019-07-13 14:38:07 +03:00
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.0.3.tar.gz",
2019-10-28 15:11:13 +03:00
"filename": "libwebp-1.0.3.tar.gz",
2019-07-13 14:38:07 +03:00
"dir": "libwebp-1.0.3",
2016-08-29 13:48:59 +03:00
},
2019-06-13 18:54:57 +03:00
"openjpeg": {
"url": "https://github.com/uclouvain/openjpeg/archive/v2.3.1.tar.gz",
2019-10-28 15:11:13 +03:00
"filename": "openjpeg-2.3.1.tar.gz",
2019-06-13 18:54:57 +03:00
"dir": "openjpeg-2.3.1",
2016-08-29 13:48:59 +03:00
},
2019-09-27 11:18:32 +03:00
"jpeg-turbo": {
"url": SF_MIRROR + "/project/libjpeg-turbo/2.0.3/libjpeg-turbo-2.0.3.tar.gz",
2019-10-28 15:11:13 +03:00
"filename": "libjpeg-turbo-2.0.3.tar.gz",
2019-09-27 11:18:32 +03:00
"dir": "libjpeg-turbo-2.0.3",
},
2019-09-27 13:37:54 +03:00
# ba653c8: Merge tag '2.12.5' into msvc
"imagequant": {
"url": "https://github.com/ImageOptim/libimagequant/archive/ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip", # noqa: E501
2019-10-28 15:11:13 +03:00
"filename": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip",
2019-09-27 13:37:54 +03:00
"dir": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971",
},
2019-09-29 23:39:18 +03:00
"harfbuzz": {
"url": "https://github.com/harfbuzz/harfbuzz/archive/2.6.1.zip",
2019-10-28 15:11:13 +03:00
"filename": "harfbuzz-2.6.1.zip",
2019-09-29 23:39:18 +03:00
"dir": "harfbuzz-2.6.1",
},
2019-09-30 02:04:26 +03:00
"fribidi": {
"url": "https://github.com/fribidi/fribidi/archive/v1.0.7.zip",
2019-10-28 15:11:13 +03:00
"filename": "fribidi-1.0.7.zip",
2019-09-30 02:04:26 +03:00
"dir": "fribidi-1.0.7",
},
2019-09-30 11:37:46 +03:00
"libraqm": {
"url": "https://github.com/HOST-Oman/libraqm/archive/v0.7.0.zip",
2019-10-28 15:11:13 +03:00
"filename": "libraqm-0.7.0.zip",
2019-09-30 11:37:46 +03:00
"dir": "libraqm-0.7.0",
},
2016-08-29 13:48:59 +03:00
}
compilers = {
2018-10-08 11:43:11 +03:00
7: {
2019-04-06 04:41:59 +03:00
2010: {
2018-10-08 11:43:11 +03:00
64: {
2019-06-13 18:54:57 +03:00
"env_version": "v7.0",
"vc_version": "2010",
"env_flags": "/x64 /xp",
"inc_dir": "msvcr90-x64",
"platform": "x64",
"webp_platform": "x64",
2018-10-08 11:43:11 +03:00
},
32: {
2019-06-13 18:54:57 +03:00
"env_version": "v7.0",
"vc_version": "2010",
"env_flags": "/x86 /xp",
"inc_dir": "msvcr90-x32",
"platform": "Win32",
"webp_platform": "x86",
},
2018-10-08 11:43:11 +03:00
}
2016-08-29 13:48:59 +03:00
},
2018-10-08 11:43:11 +03:00
7.1: {
2015: {
64: {
2019-06-13 18:54:57 +03:00
"env_version": "v7.1",
"vc_version": "2015",
"env_flags": "/x64 /vista",
"inc_dir": "msvcr10-x64",
"platform": "x64",
"webp_platform": "x64",
2018-10-08 11:43:11 +03:00
},
32: {
2019-06-13 18:54:57 +03:00
"env_version": "v7.1",
"vc_version": "2015",
"env_flags": "/x86 /vista",
"inc_dir": "msvcr10-x32",
"platform": "Win32",
"webp_platform": "x86",
},
2018-10-08 11:43:11 +03:00
}
2019-06-13 18:54:57 +03:00
},
2016-08-29 13:48:59 +03:00
}
2016-08-29 15:06:48 +03:00
def pyversion_from_env():
2019-06-13 18:54:57 +03:00
py = os.environ["PYTHON"]
2016-08-29 13:48:59 +03:00
2019-06-13 18:54:57 +03:00
py_version = "27"
for k in pythons:
2016-08-29 13:48:59 +03:00
if k in py:
py_version = k
break
2019-06-13 18:54:57 +03:00
if "64" in py:
py_version = "%s%s" % (py_version, X64_EXT)
2016-08-29 13:48:59 +03:00
return py_version
2016-08-29 15:06:48 +03:00
def compiler_from_env():
2019-06-13 18:54:57 +03:00
py = os.environ["PYTHON"]
2016-08-29 13:48:59 +03:00
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()
2019-06-13 18:54:57 +03:00
return compilers[py_info["compiler"]][py_info["vc"]][bit]
2018-10-08 11:43:11 +03:00
2018-10-21 10:00:39 +03:00
2018-10-08 11:43:11 +03:00
def bit_from_env():
2019-06-13 18:54:57 +03:00
py = os.environ["PYTHON"]
2018-10-08 11:43:11 +03:00
2019-06-13 18:54:57 +03:00
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