mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	build Mode.c as a common library
This commit is contained in:
		
							parent
							
								
									c889643b7e
								
							
						
					
					
						commit
						0d3c59e277
					
				
							
								
								
									
										23
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								setup.py
									
									
									
									
									
								
							|  | @ -93,7 +93,6 @@ _LIB_IMAGING = ( | ||||||
|     "JpegDecode", |     "JpegDecode", | ||||||
|     "JpegEncode", |     "JpegEncode", | ||||||
|     "Matrix", |     "Matrix", | ||||||
|     "Mode", |  | ||||||
|     "ModeFilter", |     "ModeFilter", | ||||||
|     "Negative", |     "Negative", | ||||||
|     "Offset", |     "Offset", | ||||||
|  | @ -938,17 +937,6 @@ class pil_build_ext(build_ext): | ||||||
| 
 | 
 | ||||||
|         self.summary_report(feature) |         self.summary_report(feature) | ||||||
| 
 | 
 | ||||||
|     def build_extension(self, ext): |  | ||||||
|         # Append the extension name (not including "PIL.") to the temp build directory |  | ||||||
|         # so that each module builds to its own directory. We need to make a (shallow) |  | ||||||
|         # copy of 'self' here so that we don't overwrite this value when running in |  | ||||||
|         # parallel. |  | ||||||
|         import copy |  | ||||||
| 
 |  | ||||||
|         self_copy = copy.copy(self) |  | ||||||
|         self_copy.build_temp = os.path.join(self.build_temp, ext.name[4:]) |  | ||||||
|         build_ext.build_extension(self_copy, ext) |  | ||||||
| 
 |  | ||||||
|     def summary_report(self, feature: ext_feature) -> None: |     def summary_report(self, feature: ext_feature) -> None: | ||||||
|         print("-" * 68) |         print("-" * 68) | ||||||
|         print("PIL SETUP SUMMARY") |         print("PIL SETUP SUMMARY") | ||||||
|  | @ -1013,16 +1001,20 @@ def debug_build() -> bool: | ||||||
|     return hasattr(sys, "gettotalrefcount") or FUZZING_BUILD |     return hasattr(sys, "gettotalrefcount") or FUZZING_BUILD | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | libraries = [ | ||||||
|  |     ("pil_imaging_mode", {"sources": ["src/libImaging/Mode.c"]}), | ||||||
|  | ] | ||||||
|  | 
 | ||||||
| files = ["src/_imaging.c"] | files = ["src/_imaging.c"] | ||||||
| for src_file in _IMAGING: | for src_file in _IMAGING: | ||||||
|     files.append("src/" + src_file + ".c") |     files.append("src/" + src_file + ".c") | ||||||
| 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")) | ||||||
| ext_modules = [ | ext_modules = [ | ||||||
|     Extension("PIL._imaging", files), |     Extension("PIL._imaging", files, libraries=["pil_imaging_mode"]), | ||||||
|     Extension("PIL._imagingft", ["src/_imagingft.c", "src/libImaging/Mode.c"]), |     Extension("PIL._imagingft", ["src/_imagingft.c"], libraries=["pil_imaging_mode"]), | ||||||
|     Extension("PIL._imagingcms", ["src/_imagingcms.c"]), |     Extension("PIL._imagingcms", ["src/_imagingcms.c"]), | ||||||
|     Extension("PIL._webp", ["src/_webp.c", "src/libImaging/Mode.c"]), |     Extension("PIL._webp", ["src/_webp.c"], libraries=["pil_imaging_mode"]), | ||||||
|     Extension("PIL._imagingtk", ["src/_imagingtk.c", "src/Tk/tkImaging.c"]), |     Extension("PIL._imagingtk", ["src/_imagingtk.c", "src/Tk/tkImaging.c"]), | ||||||
|     Extension("PIL._imagingmath", ["src/_imagingmath.c"]), |     Extension("PIL._imagingmath", ["src/_imagingmath.c"]), | ||||||
|     Extension("PIL._imagingmorph", ["src/_imagingmorph.c"]), |     Extension("PIL._imagingmorph", ["src/_imagingmorph.c"]), | ||||||
|  | @ -1038,6 +1030,7 @@ try: | ||||||
|     setup( |     setup( | ||||||
|         cmdclass={"build_ext": pil_build_ext}, |         cmdclass={"build_ext": pil_build_ext}, | ||||||
|         ext_modules=ext_modules, |         ext_modules=ext_modules, | ||||||
|  |         libraries=libraries, | ||||||
|         zip_safe=not (debug_build() or PLATFORM_MINGW), |         zip_safe=not (debug_build() or PLATFORM_MINGW), | ||||||
|     ) |     ) | ||||||
| except RequiredDependencyException as err: | except RequiredDependencyException as err: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user