mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Added Python 3.5-3.7 AppVeyor builds
This commit is contained in:
parent
fe654a7f8a
commit
afb6ba5626
|
@ -18,8 +18,14 @@ environment:
|
|||
PIP_DIR: bin
|
||||
VENV: YES
|
||||
- PYTHON: C:/Python27-x64
|
||||
- PYTHON: C:/Python34
|
||||
- PYTHON: C:/Python37
|
||||
- PYTHON: C:/Python27
|
||||
- PYTHON: C:/Python37-x64
|
||||
- PYTHON: C:/Python36
|
||||
- PYTHON: C:/Python36-x64
|
||||
- PYTHON: C:/Python35
|
||||
- PYTHON: C:/Python35-x64
|
||||
- PYTHON: C:/Python34
|
||||
- PYTHON: C:/Python34-x64
|
||||
- PYTHON: C:/msys64/mingw32
|
||||
EXECUTABLE: bin/python3
|
||||
|
|
5
setup.py
5
setup.py
|
@ -191,10 +191,11 @@ class pil_build_ext(build_ext):
|
|||
('disable-platform-guessing', None,
|
||||
'Disable platform guessing on Linux'),
|
||||
('debug', None, 'Debug logging')
|
||||
]
|
||||
] + [('add-imaging-libs=', None, 'Add libs to _imaging build')]
|
||||
|
||||
def initialize_options(self):
|
||||
self.disable_platform_guessing = None
|
||||
self.add_imaging_libs = ""
|
||||
build_ext.initialize_options(self)
|
||||
for x in self.feature:
|
||||
setattr(self, 'disable_%s' % x, None)
|
||||
|
@ -598,7 +599,7 @@ class pil_build_ext(build_ext):
|
|||
for src_file in _LIB_IMAGING:
|
||||
files.append(os.path.join("src/libImaging", src_file + ".c"))
|
||||
|
||||
libs = []
|
||||
libs = self.add_imaging_libs.split()
|
||||
defs = []
|
||||
if feature.jpeg:
|
||||
libs.append(feature.jpeg)
|
||||
|
|
|
@ -7,7 +7,7 @@ import getopt
|
|||
import os
|
||||
|
||||
from config import (compilers, compiler_from_env, pythons, pyversion_from_env,
|
||||
VIRT_BASE, X64_EXT)
|
||||
bit_from_env, VIRT_BASE, X64_EXT)
|
||||
|
||||
|
||||
def setup_vms():
|
||||
|
@ -64,7 +64,15 @@ exit
|
|||
"""
|
||||
|
||||
|
||||
def build_one(py_ver, compiler):
|
||||
def vc_setup(compiler, bit):
|
||||
script = ""
|
||||
if compiler['vc_version'] == '2015':
|
||||
arch = "x86" if bit == 32 else "x86_amd64"
|
||||
script = r"""
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %s""" % arch
|
||||
return script
|
||||
|
||||
def build_one(py_ver, compiler, bit):
|
||||
# UNDONE virtual envs if we're not running on appveyor
|
||||
args = {}
|
||||
args.update(compiler)
|
||||
|
@ -78,12 +86,17 @@ def build_one(py_ver, compiler):
|
|||
args['executable'] = "%EXECUTABLE%"
|
||||
|
||||
args['py_ver'] = py_ver
|
||||
if '34' in py_ver:
|
||||
args['tcl_ver'] = '86'
|
||||
else:
|
||||
if '27' in py_ver:
|
||||
args['tcl_ver'] = '85'
|
||||
else:
|
||||
args['tcl_ver'] = '86'
|
||||
|
||||
return r"""
|
||||
if compiler['vc_version'] == '2015':
|
||||
args['imaging_libs'] = ' build_ext --add-imaging-libs=msvcrt'
|
||||
else:
|
||||
args['imaging_libs'] = ''
|
||||
|
||||
script = r"""
|
||||
setlocal EnableDelayedExpansion
|
||||
call "%%ProgramFiles%%\Microsoft SDKs\Windows\%(env_version)s\Bin\SetEnv.Cmd" /Release %(env_flags)s
|
||||
set DISTUTILS_USE_SDK=1
|
||||
|
@ -91,12 +104,13 @@ set LIB=%%LIB%%;%%INCLIB%%\%(inc_dir)s
|
|||
set INCLUDE=%%INCLUDE%%;%%INCLIB%%\%(inc_dir)s;%%INCLIB%%\tcl%(tcl_ver)s\include
|
||||
|
||||
setlocal
|
||||
set LIB=%%LIB%%;C:\Python%(py_ver)s\tcl
|
||||
call %(python_path)s\%(executable)s setup.py %%BLDOPT%%
|
||||
set LIB=%%LIB%%;C:\Python%(py_ver)s\tcl""" + vc_setup(compiler, bit) + r"""
|
||||
call %(python_path)s\%(executable)s setup.py %(imaging_libs)s %%BLDOPT%%
|
||||
endlocal
|
||||
|
||||
endlocal
|
||||
""" % args
|
||||
"""
|
||||
return script % args
|
||||
|
||||
|
||||
def clean():
|
||||
|
@ -111,19 +125,18 @@ def clean():
|
|||
def main(op):
|
||||
scripts = []
|
||||
|
||||
for py_version, compiler_version in pythons.items():
|
||||
for py_version, py_info in pythons.items():
|
||||
py_compilers = compilers[py_info['compiler']][py_info['vc']]
|
||||
scripts.append((py_version,
|
||||
"\n".join([header(op),
|
||||
build_one(py_version,
|
||||
compilers[(compiler_version,
|
||||
32)]),
|
||||
py_compilers[32], 32),
|
||||
footer()])))
|
||||
|
||||
scripts.append(("%s%s" % (py_version, X64_EXT),
|
||||
"\n".join([header(op),
|
||||
build_one("%sx64" % py_version,
|
||||
compilers[(compiler_version,
|
||||
64)]),
|
||||
py_compilers[64], 64),
|
||||
footer()])))
|
||||
|
||||
results = map(run_script, scripts)
|
||||
|
@ -136,10 +149,11 @@ def run_one(op):
|
|||
|
||||
compiler = compiler_from_env()
|
||||
py_version = pyversion_from_env()
|
||||
bit = bit_from_env()
|
||||
|
||||
run_script((py_version,
|
||||
"\n".join([header(op),
|
||||
build_one(py_version, compiler),
|
||||
build_one(py_version, compiler, bit),
|
||||
footer()])
|
||||
))
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@ from untar import untar
|
|||
import os
|
||||
|
||||
from fetch import fetch
|
||||
from config import compilers, compiler_from_env, libs
|
||||
from config import (compilers, all_compilers, compiler_from_env, bit_from_env,
|
||||
libs)
|
||||
from build import vc_setup
|
||||
|
||||
|
||||
def _relpath(*args):
|
||||
|
@ -28,7 +30,7 @@ def mkdirs():
|
|||
os.mkdir(inc_dir)
|
||||
except OSError:
|
||||
pass
|
||||
for compiler in compilers.values():
|
||||
for compiler in all_compilers():
|
||||
try:
|
||||
os.mkdir(os.path.join(inc_dir, compiler['inc_dir']))
|
||||
except OSError:
|
||||
|
@ -48,7 +50,7 @@ def extract_libs():
|
|||
if not os.path.exists(filename):
|
||||
filename = fetch(lib['url'])
|
||||
if name == 'openjpeg':
|
||||
for compiler in compilers.values():
|
||||
for compiler in all_compilers():
|
||||
if not os.path.exists(os.path.join(
|
||||
build_dir, lib['dir']+compiler['inc_dir'])):
|
||||
extract(filename, build_dir)
|
||||
|
@ -148,11 +150,12 @@ endlocal
|
|||
""" % atts
|
||||
|
||||
|
||||
def nmake_libs(compiler):
|
||||
def nmake_libs(compiler, bit):
|
||||
# undone -- pre, makes, headers, libs
|
||||
return r"""
|
||||
script = r"""
|
||||
rem Build libjpeg
|
||||
setlocal
|
||||
""" + vc_setup(compiler, bit) + r"""
|
||||
cd /D %%JPEG%%
|
||||
nmake -f makefile.vc setup-vc6
|
||||
nmake -f makefile.vc clean
|
||||
|
@ -176,6 +179,7 @@ endlocal
|
|||
|
||||
rem Build webp
|
||||
setlocal
|
||||
""" + vc_setup(compiler, bit) + r"""
|
||||
cd /D %%WEBP%%
|
||||
rd /S /Q %%WEBP%%\output\release-static
|
||||
nmake -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output all
|
||||
|
@ -186,6 +190,7 @@ endlocal
|
|||
|
||||
rem Build libtiff
|
||||
setlocal
|
||||
""" + vc_setup(compiler, bit) + r"""
|
||||
rem do after building jpeg and zlib
|
||||
copy %%~dp0\nmake.opt %%TIFF%%
|
||||
|
||||
|
@ -196,9 +201,8 @@ copy /Y /B libtiff\*.dll %%INCLIB%%
|
|||
copy /Y /B libtiff\*.lib %%INCLIB%%
|
||||
copy /Y /B libtiff\tiff*.h %%INCLIB%%
|
||||
endlocal
|
||||
|
||||
|
||||
""" % compiler
|
||||
"""
|
||||
return script % compiler
|
||||
|
||||
|
||||
def msbuild_freetype(compiler):
|
||||
|
@ -273,9 +277,9 @@ endlocal
|
|||
""" % compiler
|
||||
|
||||
|
||||
def add_compiler(compiler):
|
||||
def add_compiler(compiler, bit):
|
||||
script.append(setup_compiler(compiler))
|
||||
script.append(nmake_libs(compiler))
|
||||
script.append(nmake_libs(compiler, bit))
|
||||
|
||||
# script.append(extract_openjpeg(compiler))
|
||||
|
||||
|
@ -293,12 +297,12 @@ script = [header(),
|
|||
|
||||
|
||||
if 'PYTHON' in os.environ:
|
||||
add_compiler(compiler_from_env())
|
||||
add_compiler(compiler_from_env(), bit_from_env())
|
||||
else:
|
||||
# for compiler in compilers.values():
|
||||
# for compiler in all_compilers():
|
||||
# add_compiler(compiler)
|
||||
add_compiler(compilers[(7.0, 32)])
|
||||
# add_compiler(compilers[(7.1, 64)])
|
||||
add_compiler(compilers[7.0][2008][32], 32)
|
||||
# add_compiler(compilers[7.1][2010][64])
|
||||
|
||||
with open('build_deps.cmd', 'w') as f:
|
||||
f.write("\n".join(script))
|
||||
|
|
|
@ -3,12 +3,13 @@ import os
|
|||
SF_MIRROR = 'http://iweb.dl.sourceforge.net'
|
||||
PILLOW_DEPENDS_DIR = 'C:\\pillow-depends\\'
|
||||
|
||||
pythons = { # '26': 7,
|
||||
'27': 7,
|
||||
'pypy2': 7,
|
||||
# '32': 7,
|
||||
'33': 7.1,
|
||||
'34': 7.1}
|
||||
pythons = {'27': {'compiler':7, 'vc':2008},
|
||||
'pypy2': {'compiler':7, 'vc':2008},
|
||||
'33': {'compiler':7.1, 'vc':2010},
|
||||
'34': {'compiler':7.1, 'vc':2010},
|
||||
'35': {'compiler':7.1, 'vc':2015},
|
||||
'36': {'compiler':7.1, 'vc':2015},
|
||||
'37': {'compiler':7.1, 'vc':2015}}
|
||||
|
||||
VIRT_BASE = "c:/vp/"
|
||||
X64_EXT = os.environ.get('X64_EXT', "x64")
|
||||
|
@ -78,38 +79,64 @@ libs = {
|
|||
}
|
||||
|
||||
compilers = {
|
||||
(7, 64): {
|
||||
'env_version': 'v7.0',
|
||||
'vc_version': '2008',
|
||||
'env_flags': '/x64 /xp',
|
||||
'inc_dir': 'msvcr90-x64',
|
||||
'platform': 'x64',
|
||||
'webp_platform': 'x64',
|
||||
},
|
||||
(7, 32): {
|
||||
'env_version': 'v7.0',
|
||||
'vc_version': '2008',
|
||||
'env_flags': '/x86 /xp',
|
||||
'inc_dir': 'msvcr90-x32',
|
||||
'platform': 'Win32',
|
||||
'webp_platform': 'x86',
|
||||
},
|
||||
(7.1, 64): {
|
||||
'env_version': 'v7.1',
|
||||
'vc_version': '2010',
|
||||
'env_flags': '/x64 /vista',
|
||||
'inc_dir': 'msvcr10-x64',
|
||||
'platform': 'x64',
|
||||
'webp_platform': 'x64',
|
||||
},
|
||||
(7.1, 32): {
|
||||
'env_version': 'v7.1',
|
||||
'vc_version': '2010',
|
||||
'env_flags': '/x86 /vista',
|
||||
'inc_dir': 'msvcr10-x32',
|
||||
'platform': 'Win32',
|
||||
'webp_platform': 'x86',
|
||||
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',
|
||||
}
|
||||
}
|
||||
},
|
||||
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',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,11 +160,20 @@ def compiler_from_env():
|
|||
|
||||
for k, v in pythons.items():
|
||||
if k in py:
|
||||
compiler_version = v
|
||||
py_info = v
|
||||
break
|
||||
|
||||
bit = 32
|
||||
if '64' in py:
|
||||
bit = 64
|
||||
bit = bit_from_env()
|
||||
return compilers[py_info['compiler']][py_info['vc']][bit]
|
||||
|
||||
return compilers[(compiler_version, bit)]
|
||||
def bit_from_env():
|
||||
py = os.environ['PYTHON']
|
||||
|
||||
return 64 if '64' in py else 32
|
||||
|
||||
def all_compilers():
|
||||
all = []
|
||||
for vc_compilers in compilers.values():
|
||||
for bit_compilers in vc_compilers.values():
|
||||
all += bit_compilers.values()
|
||||
return all
|
||||
|
|
Loading…
Reference in New Issue
Block a user