From 5a0104f64d5baf9277271722ad6b68092f1e36a2 Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 29 Aug 2016 14:53:48 +0300 Subject: [PATCH] Extract libs from pillow-depends --- winbuild/build_dep.py | 17 +++++------------ winbuild/config.py | 36 +++++++++++++++++------------------- winbuild/fetch.py | 2 +- 3 files changed, 23 insertions(+), 32 deletions(-) diff --git a/winbuild/build_dep.py b/winbuild/build_dep.py index 02c4edb6a..dc71b7b8d 100644 --- a/winbuild/build_dep.py +++ b/winbuild/build_dep.py @@ -1,10 +1,9 @@ -from fetch import fetch from unzip import unzip from untar import untar import os import hashlib -from config import bin_libs, compilers, compiler_fromEnv, libs +from config import compilers, compiler_fromEnv, libs def _relpath(*args): @@ -59,10 +58,10 @@ def extract(src, dest): return untar(src, dest) -def fetch_libs(): +def extract_libs(): for name, lib in libs.items(): if name == 'openjpeg': - filename = check_hash(fetch(lib['url']), lib['hash']) + filename = check_hash(lib['filename'], lib['hash']) for compiler in compilers.values(): if not os.path.exists(os.path.join( build_dir, lib['dir']+compiler['inc_dir'])): @@ -71,12 +70,7 @@ def fetch_libs(): os.path.join( build_dir, lib['dir']+compiler['inc_dir'])) else: - extract(check_hash(fetch(lib['url']), lib['hash']), build_dir) - - -def extract_binlib(): - lib = bin_libs['openjpeg'] - extract(lib['filename'], build_dir) + extract(check_hash(lib['filename'], lib['hash']), build_dir) def extract_openjpeg(compiler): @@ -306,8 +300,7 @@ def add_compiler(compiler): mkdirs() -fetch_libs() -# extract_binlib() +extract_libs() script = [header(), cp_tk(libs['tk-8.5']['version'], libs['tk-8.6']['version'])] diff --git a/winbuild/config.py b/winbuild/config.py index 41f2e934f..189bebd01 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -1,6 +1,7 @@ import os SF_MIRROR = 'http://iweb.dl.sourceforge.net' +PILLOW_DEPENDS_DIR = 'C:\\pillow-depends\\' pythons = { # '26': 7, '27': 7, @@ -12,73 +13,70 @@ VIRT_BASE = "c:/vp/" X64_EXT = os.environ.get('X64_EXT', "x64") libs = { + # 'openjpeg': { + # 'filename': 'openjpeg-2.0.0-win32-x86.zip', + # 'hash': 'sha1:xxx', + # 'version': '2.0' + # }, 'zlib': { - 'url': 'http://zlib.net/zlib128.zip', + 'filename': PILLOW_DEPENDS_DIR + 'zlib128.zip', 'hash': 'md5:126f8676442ffbd97884eb4d6f32afb4', 'dir': 'zlib-1.2.8', }, 'jpeg': { - 'url': 'http://www.ijg.org/files/jpegsr9b.zip', + 'filename': PILLOW_DEPENDS_DIR + 'jpegsr9b.zip', 'hash': 'md5:a21b8024d78ba05857a75272b4fa95ec', # not found - generated by wiredfool 'dir': 'jpeg-9b', }, 'tiff': { - 'url': 'ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.6.zip', + 'filename': PILLOW_DEPENDS_DIR + 'tiff-4.0.6.zip', 'hash': 'md5:f5b485d750b2001255ed64224b98b857', 'dir': 'tiff-4.0.6', }, 'freetype': { - 'url': 'http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz', + 'filename': PILLOW_DEPENDS_DIR + 'freetype-2.6.5.tar.gz', 'hash': 'md5:31b2276515d9ee1c7f37d9c9f4f3145a', 'dir': 'freetype-2.6.5', }, 'lcms': { - 'url': SF_MIRROR+'/project/lcms/lcms/2.7/lcms2-2.7.zip', + 'filename': PILLOW_DEPENDS_DIR + 'lcms2-2.7.zip', 'hash': 'sha1:7ff1a5b721ca719760ba6eb4ec6f38d5e65381cf', 'dir': 'lcms2-2.7', }, 'tcl-8.5': { - 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip', + 'filename': PILLOW_DEPENDS_DIR + 'tcl8519-src.zip', 'hash': 'sha1:9de57fd34bd688716c16c978db96fa16a5fde924', 'dir': '', }, 'tk-8.5': { - 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tk8519-src.zip', + 'filename': PILLOW_DEPENDS_DIR + 'tk8519-src.zip', 'hash': 'sha1:78d0d2c81e024e0b48bfd7b2cc16718f08f46ed9', 'dir': '', 'version': '8.5.19', }, 'tcl-8.6': { - 'url': SF_MIRROR+'/project/tcl/Tcl/8.6.5/tcl865-src.zip', + 'filename': PILLOW_DEPENDS_DIR + 'tcl865-src.zip', 'hash': 'md5:932e360acb40ec760ebeed659bc893de', 'dir': '', }, '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', 'dir': '', 'version': '8.6.5', }, 'webp': { - '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', }, 'openjpeg': { - 'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.1.0/openjpeg-2.1.0.tar.gz', + 'filename': PILLOW_DEPENDS_DIR + 'openjpeg-2.1.0.tar.gz', 'hash': 'md5:f6419fcc233df84f9a81eb36633c6db6', 'dir': 'openjpeg-2.1.0', }, } -bin_libs = { - 'openjpeg': { - 'filename': 'openjpeg-2.0.0-win32-x86.zip', - 'hash': 'sha1:xxx', - 'version': '2.0' - }, -} - compilers = { (7, 64): { 'env_version': 'v7.0', diff --git a/winbuild/fetch.py b/winbuild/fetch.py index 1ab3e7208..7d140fd35 100644 --- a/winbuild/fetch.py +++ b/winbuild/fetch.py @@ -1,5 +1,5 @@ -import sys import os +import sys import urllib.parse import urllib.request