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