mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
Merge pull request #2095 from hugovk/depends
Windows build: fetch dependencies from pillow-depends
This commit is contained in:
commit
a00e4aa934
|
@ -1,4 +1,4 @@
|
||||||
#/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -6,7 +6,8 @@ import sys
|
||||||
import getopt
|
import getopt
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from config import *
|
from config import (compilers, compiler_from_env, pythons, pyversion_from_env,
|
||||||
|
VIRT_BASE, X64_EXT)
|
||||||
|
|
||||||
|
|
||||||
def setup_vms():
|
def setup_vms():
|
||||||
|
@ -131,8 +132,8 @@ def main(op):
|
||||||
|
|
||||||
def run_one(op):
|
def run_one(op):
|
||||||
|
|
||||||
compiler = compiler_fromEnv()
|
compiler = compiler_from_env()
|
||||||
py_version = pyversion_fromEnv()
|
py_version = pyversion_from_env()
|
||||||
|
|
||||||
run_script((py_version,
|
run_script((py_version,
|
||||||
"\n".join([header(op),
|
"\n".join([header(op),
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
from fetch import fetch
|
|
||||||
from unzip import unzip
|
from unzip import unzip
|
||||||
from untar import untar
|
from untar import untar
|
||||||
import os
|
import os
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from config import bin_libs, compilers, compiler_fromEnv, libs
|
from config import compilers, compiler_from_env, libs
|
||||||
|
|
||||||
|
|
||||||
def _relpath(*args):
|
def _relpath(*args):
|
||||||
|
@ -59,10 +58,10 @@ def extract(src, dest):
|
||||||
return untar(src, dest)
|
return untar(src, dest)
|
||||||
|
|
||||||
|
|
||||||
def fetch_libs():
|
def extract_libs():
|
||||||
for name, lib in libs.items():
|
for name, lib in libs.items():
|
||||||
if name == 'openjpeg':
|
if name == 'openjpeg':
|
||||||
filename = check_hash(fetch(lib['url']), lib['hash'])
|
filename = check_hash(lib['filename'], lib['hash'])
|
||||||
for compiler in compilers.values():
|
for compiler in compilers.values():
|
||||||
if not os.path.exists(os.path.join(
|
if not os.path.exists(os.path.join(
|
||||||
build_dir, lib['dir']+compiler['inc_dir'])):
|
build_dir, lib['dir']+compiler['inc_dir'])):
|
||||||
|
@ -71,12 +70,7 @@ def fetch_libs():
|
||||||
os.path.join(
|
os.path.join(
|
||||||
build_dir, lib['dir']+compiler['inc_dir']))
|
build_dir, lib['dir']+compiler['inc_dir']))
|
||||||
else:
|
else:
|
||||||
extract(check_hash(fetch(lib['url']), lib['hash']), build_dir)
|
extract(check_hash(lib['filename'], lib['hash']), build_dir)
|
||||||
|
|
||||||
|
|
||||||
def extract_binlib():
|
|
||||||
lib = bin_libs['openjpeg']
|
|
||||||
extract(lib['filename'], build_dir)
|
|
||||||
|
|
||||||
|
|
||||||
def extract_openjpeg(compiler):
|
def extract_openjpeg(compiler):
|
||||||
|
@ -306,13 +300,14 @@ def add_compiler(compiler):
|
||||||
|
|
||||||
|
|
||||||
mkdirs()
|
mkdirs()
|
||||||
fetch_libs()
|
extract_libs()
|
||||||
# extract_binlib()
|
script = [header(),
|
||||||
script = [header(), cp_tk(libs['tk-8.5']['version'], libs['tk-8.6']['version'])]
|
cp_tk(libs['tk-8.5']['version'],
|
||||||
|
libs['tk-8.6']['version'])]
|
||||||
|
|
||||||
|
|
||||||
if 'PYTHON' in os.environ:
|
if 'PYTHON' in os.environ:
|
||||||
add_compiler(compiler_fromEnv())
|
add_compiler(compiler_from_env())
|
||||||
else:
|
else:
|
||||||
# for compiler in compilers.values():
|
# for compiler in compilers.values():
|
||||||
# add_compiler(compiler)
|
# add_compiler(compiler)
|
||||||
|
|
|
@ -1,145 +1,154 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
SF_MIRROR = 'http://iweb.dl.sourceforge.net'
|
SF_MIRROR = 'http://iweb.dl.sourceforge.net'
|
||||||
|
PILLOW_DEPENDS_DIR = 'C:\\pillow-depends\\'
|
||||||
pythons = { # '26': 7,
|
|
||||||
'27': 7,
|
pythons = { # '26': 7,
|
||||||
# '32': 7,
|
'27': 7,
|
||||||
'33': 7.1,
|
# '32': 7,
|
||||||
'34': 7.1}
|
'33': 7.1,
|
||||||
|
'34': 7.1}
|
||||||
VIRT_BASE = "c:/vp/"
|
|
||||||
X64_EXT = os.environ.get('X64_EXT', "x64")
|
VIRT_BASE = "c:/vp/"
|
||||||
|
X64_EXT = os.environ.get('X64_EXT', "x64")
|
||||||
libs = {
|
|
||||||
'zlib': {
|
libs = {
|
||||||
'url': 'http://zlib.net/zlib128.zip',
|
# 'openjpeg': {
|
||||||
'hash': 'md5:126f8676442ffbd97884eb4d6f32afb4',
|
# 'filename': 'openjpeg-2.0.0-win32-x86.zip',
|
||||||
'dir': 'zlib-1.2.8',
|
# 'hash': 'sha1:xxx',
|
||||||
},
|
# 'version': '2.0'
|
||||||
'jpeg': {
|
# },
|
||||||
'url': 'http://www.ijg.org/files/jpegsr9b.zip',
|
'zlib': {
|
||||||
'hash': 'md5:a21b8024d78ba05857a75272b4fa95ec', # not found - generated by wiredfool
|
'url': 'http://zlib.net/zlib128.zip',
|
||||||
'dir': 'jpeg-9b',
|
'filename': PILLOW_DEPENDS_DIR + 'zlib128.zip',
|
||||||
},
|
'hash': 'md5:126f8676442ffbd97884eb4d6f32afb4',
|
||||||
'tiff': {
|
'dir': 'zlib-1.2.8',
|
||||||
'url': 'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.6.zip',
|
},
|
||||||
'hash': 'md5:f5b485d750b2001255ed64224b98b857',
|
'jpeg': {
|
||||||
'dir': 'tiff-4.0.6',
|
'url': 'http://www.ijg.org/files/jpegsr9b.zip',
|
||||||
},
|
'filename': PILLOW_DEPENDS_DIR + 'jpegsr9b.zip',
|
||||||
'freetype': {
|
'hash': 'md5:a21b8024d78ba05857a75272b4fa95ec', # not found - generated by wiredfool
|
||||||
'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz',
|
'dir': 'jpeg-9b',
|
||||||
'hash': 'md5:31b2276515d9ee1c7f37d9c9f4f3145a',
|
},
|
||||||
'dir': 'freetype-2.6.5',
|
'tiff': {
|
||||||
},
|
'url': 'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.6.zip',
|
||||||
'lcms': {
|
'filename': PILLOW_DEPENDS_DIR + 'tiff-4.0.6.zip',
|
||||||
'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip',
|
'hash': 'md5:f5b485d750b2001255ed64224b98b857',
|
||||||
'hash': 'sha1:7ff1a5b721ca719760ba6eb4ec6f38d5e65381cf',
|
'dir': 'tiff-4.0.6',
|
||||||
'dir': 'lcms2-2.7',
|
},
|
||||||
},
|
'freetype': {
|
||||||
'tcl-8.5': {
|
'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz',
|
||||||
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip',
|
'filename': PILLOW_DEPENDS_DIR + 'freetype-2.6.5.tar.gz',
|
||||||
'hash': 'sha1:9de57fd34bd688716c16c978db96fa16a5fde924',
|
'hash': 'md5:31b2276515d9ee1c7f37d9c9f4f3145a',
|
||||||
'dir': '',
|
'dir': 'freetype-2.6.5',
|
||||||
},
|
},
|
||||||
'tk-8.5': {
|
'lcms': {
|
||||||
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tk8519-src.zip',
|
'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip',
|
||||||
'hash': 'sha1:78d0d2c81e024e0b48bfd7b2cc16718f08f46ed9',
|
'filename': PILLOW_DEPENDS_DIR + 'lcms2-2.7.zip',
|
||||||
'dir': '',
|
'hash': 'sha1:7ff1a5b721ca719760ba6eb4ec6f38d5e65381cf',
|
||||||
'version': '8.5.19',
|
'dir': 'lcms2-2.7',
|
||||||
},
|
},
|
||||||
'tcl-8.6': {
|
'tcl-8.5': {
|
||||||
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.5/tcl865-src.zip',
|
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip',
|
||||||
'hash': 'md5:932e360acb40ec760ebeed659bc893de',
|
'filename': PILLOW_DEPENDS_DIR + 'tcl8519-src.zip',
|
||||||
'dir': '',
|
'hash': 'sha1:9de57fd34bd688716c16c978db96fa16a5fde924',
|
||||||
},
|
'dir': '',
|
||||||
'tk-8.6': {
|
},
|
||||||
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.5/tk865-src.zip',
|
'tk-8.5': {
|
||||||
'hash': 'md5:f2f5802a5a3b1f70b906e6930db12089',
|
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tk8519-src.zip',
|
||||||
'dir': '',
|
'filename': PILLOW_DEPENDS_DIR + 'tk8519-src.zip',
|
||||||
'version': '8.6.5',
|
'hash': 'sha1:78d0d2c81e024e0b48bfd7b2cc16718f08f46ed9',
|
||||||
},
|
'dir': '',
|
||||||
'webp': {
|
'version': '8.5.19',
|
||||||
'url': 'http://downloads.webmproject.org/releases/webp/libwebp-0.5.0.tar.gz',
|
},
|
||||||
'hash': 'sha1:d3de815b272fcf88fc4f2dc1ab65d176bcb8df68',
|
'tcl-8.6': {
|
||||||
'dir': 'libwebp-0.5.0',
|
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.5/tcl865-src.zip',
|
||||||
},
|
'filename': PILLOW_DEPENDS_DIR + 'tcl865-src.zip',
|
||||||
'openjpeg': {
|
'hash': 'md5:932e360acb40ec760ebeed659bc893de',
|
||||||
'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.1.0/openjpeg-2.1.0.tar.gz',
|
'dir': '',
|
||||||
'hash': 'md5:f6419fcc233df84f9a81eb36633c6db6',
|
},
|
||||||
'dir': 'openjpeg-2.1.0',
|
'tk-8.6': {
|
||||||
},
|
'url': SF_MIRROR+'/project/tcl/Tcl/8.6.5/tk865-src.zip',
|
||||||
}
|
'filename': PILLOW_DEPENDS_DIR + 'tk865-src.zip',
|
||||||
|
'hash': 'md5:f2f5802a5a3b1f70b906e6930db12089',
|
||||||
bin_libs = {
|
'dir': '',
|
||||||
'openjpeg': {
|
'version': '8.6.5',
|
||||||
'filename': 'openjpeg-2.0.0-win32-x86.zip',
|
},
|
||||||
'hash': 'sha1:xxx',
|
'webp': {
|
||||||
'version': '2.0'
|
'url': 'http://downloads.webmproject.org/releases/webp/libwebp-0.5.0.tar.gz',
|
||||||
},
|
'filename': PILLOW_DEPENDS_DIR + 'libwebp-0.5.0.tar.gz',
|
||||||
}
|
'hash': 'sha1:d3de815b272fcf88fc4f2dc1ab65d176bcb8df68',
|
||||||
|
'dir': 'libwebp-0.5.0',
|
||||||
compilers = {
|
},
|
||||||
(7, 64): {
|
'openjpeg': {
|
||||||
'env_version': 'v7.0',
|
'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.1.0/openjpeg-2.1.0.tar.gz',
|
||||||
'vc_version': '2008',
|
'filename': PILLOW_DEPENDS_DIR + 'openjpeg-2.1.0.tar.gz',
|
||||||
'env_flags': '/x64 /xp',
|
'hash': 'md5:f6419fcc233df84f9a81eb36633c6db6',
|
||||||
'inc_dir': 'msvcr90-x64',
|
'dir': 'openjpeg-2.1.0',
|
||||||
'platform': 'x64',
|
},
|
||||||
'webp_platform': 'x64',
|
}
|
||||||
},
|
|
||||||
(7, 32): {
|
compilers = {
|
||||||
'env_version': 'v7.0',
|
(7, 64): {
|
||||||
'vc_version': '2008',
|
'env_version': 'v7.0',
|
||||||
'env_flags': '/x86 /xp',
|
'vc_version': '2008',
|
||||||
'inc_dir': 'msvcr90-x32',
|
'env_flags': '/x64 /xp',
|
||||||
'platform': 'Win32',
|
'inc_dir': 'msvcr90-x64',
|
||||||
'webp_platform': 'x86',
|
'platform': 'x64',
|
||||||
},
|
'webp_platform': 'x64',
|
||||||
(7.1, 64): {
|
},
|
||||||
'env_version': 'v7.1',
|
(7, 32): {
|
||||||
'vc_version': '2010',
|
'env_version': 'v7.0',
|
||||||
'env_flags': '/x64 /vista',
|
'vc_version': '2008',
|
||||||
'inc_dir': 'msvcr10-x64',
|
'env_flags': '/x86 /xp',
|
||||||
'platform': 'x64',
|
'inc_dir': 'msvcr90-x32',
|
||||||
'webp_platform': 'x64',
|
'platform': 'Win32',
|
||||||
},
|
'webp_platform': 'x86',
|
||||||
(7.1, 32): {
|
},
|
||||||
'env_version': 'v7.1',
|
(7.1, 64): {
|
||||||
'vc_version': '2010',
|
'env_version': 'v7.1',
|
||||||
'env_flags': '/x86 /vista',
|
'vc_version': '2010',
|
||||||
'inc_dir': 'msvcr10-x32',
|
'env_flags': '/x64 /vista',
|
||||||
'platform': 'Win32',
|
'inc_dir': 'msvcr10-x64',
|
||||||
'webp_platform': 'x86',
|
'platform': 'x64',
|
||||||
},
|
'webp_platform': 'x64',
|
||||||
}
|
},
|
||||||
|
(7.1, 32): {
|
||||||
|
'env_version': 'v7.1',
|
||||||
def pyversion_fromEnv():
|
'vc_version': '2010',
|
||||||
py = os.environ['PYTHON']
|
'env_flags': '/x86 /vista',
|
||||||
|
'inc_dir': 'msvcr10-x32',
|
||||||
py_version = '27'
|
'platform': 'Win32',
|
||||||
for k in pythons.keys():
|
'webp_platform': 'x86',
|
||||||
if k in py:
|
},
|
||||||
py_version = k
|
}
|
||||||
break
|
|
||||||
|
|
||||||
if '64' in py:
|
def pyversion_from_env():
|
||||||
py_version = '%s%s' % (py_version, X64_EXT)
|
py = os.environ['PYTHON']
|
||||||
|
|
||||||
return py_version
|
py_version = '27'
|
||||||
|
for k in pythons.keys():
|
||||||
|
if k in py:
|
||||||
def compiler_fromEnv():
|
py_version = k
|
||||||
py = os.environ['PYTHON']
|
break
|
||||||
|
|
||||||
for k, v in pythons.items():
|
if '64' in py:
|
||||||
if k in py:
|
py_version = '%s%s' % (py_version, X64_EXT)
|
||||||
compiler_version = v
|
|
||||||
break
|
return py_version
|
||||||
|
|
||||||
bit = 32
|
|
||||||
if '64' in py:
|
def compiler_from_env():
|
||||||
bit = 64
|
py = os.environ['PYTHON']
|
||||||
|
|
||||||
return compilers[(compiler_version, bit)]
|
for k, v in pythons.items():
|
||||||
|
if k in py:
|
||||||
|
compiler_version = v
|
||||||
|
break
|
||||||
|
|
||||||
|
bit = 32
|
||||||
|
if '64' in py:
|
||||||
|
bit = 64
|
||||||
|
|
||||||
|
return compilers[(compiler_version, bit)]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user