Add libraqm package; enable in py-pillow (#32619)
* Add libraqm package * py-pillow: Add optional raqm dependency/variant * Use sha256 * Use " instead of ' * Use more explicit import * Only add raqm from @8.4.0: * Make the docstring shorter to satisfy flake * Add conflict, silence warning, adjust version Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
		
							
								
								
									
										19
									
								
								var/spack/repos/builtin/packages/libraqm/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								var/spack/repos/builtin/packages/libraqm/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other | ||||||
|  | # Spack Project Developers. See the top-level COPYRIGHT file for details. | ||||||
|  | # | ||||||
|  | # SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||||||
|  | 
 | ||||||
|  | from spack.package import * | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | class Libraqm(MesonPackage): | ||||||
|  |     """Raqm provides a convenient API for the logic of complex text layout.""" | ||||||
|  | 
 | ||||||
|  |     homepage = "https://github.com/HOST-Oman/libraqm" | ||||||
|  |     url = "https://github.com/HOST-Oman/libraqm/releases/download/v0.9.0/raqm-0.9.0.tar.xz" | ||||||
|  |     git = "https://github.com/HOST-Oman/libraqm.git" | ||||||
|  | 
 | ||||||
|  |     version("0.9.0", sha256="9ed6fdf41da6391fc9bf7038662cbe412c330aa6eb22b19704af2258e448107c") | ||||||
|  | 
 | ||||||
|  |     depends_on("freetype") | ||||||
|  |     depends_on("harfbuzz") | ||||||
| @@ -25,6 +25,7 @@ class PyPillowBase(PythonPackage): | |||||||
|     variant("jpeg2000", default=False, description="JPEG 2000 functionality") |     variant("jpeg2000", default=False, description="JPEG 2000 functionality") | ||||||
|     variant("imagequant", when="@3.3:", default=False, description="Improved color quantization") |     variant("imagequant", when="@3.3:", default=False, description="Improved color quantization") | ||||||
|     variant("xcb", when="@7.1:", default=False, description="X11 screengrab support") |     variant("xcb", when="@7.1:", default=False, description="X11 screengrab support") | ||||||
|  |     variant("raqm", when="@8.2:", default=False, description="RAQM support") | ||||||
| 
 | 
 | ||||||
|     # Required dependencies |     # Required dependencies | ||||||
|     # https://pillow.readthedocs.io/en/latest/installation.html#notes |     # https://pillow.readthedocs.io/en/latest/installation.html#notes | ||||||
| @@ -52,6 +53,10 @@ class PyPillowBase(PythonPackage): | |||||||
|     depends_on("openjpeg", when="+jpeg2000") |     depends_on("openjpeg", when="+jpeg2000") | ||||||
|     depends_on("libimagequant", when="+imagequant") |     depends_on("libimagequant", when="+imagequant") | ||||||
|     depends_on("libxcb", when="+xcb") |     depends_on("libxcb", when="+xcb") | ||||||
|  |     depends_on("libraqm", when="+raqm") | ||||||
|  | 
 | ||||||
|  |     # Conflicting options | ||||||
|  |     conflicts("+raqm", when="~freetype") | ||||||
| 
 | 
 | ||||||
|     def patch(self): |     def patch(self): | ||||||
|         """Patch setup.py to provide library and include directories |         """Patch setup.py to provide library and include directories | ||||||
| @@ -70,7 +75,7 @@ def patch(self): | |||||||
| 
 | 
 | ||||||
|         def variant_to_cfg(variant): |         def variant_to_cfg(variant): | ||||||
|             able = "enable" if "+" + variant in self.spec else "disable" |             able = "enable" if "+" + variant in self.spec else "disable" | ||||||
|             return "{0}-{1}=1\n".format(able, variant) |             return "{0}_{1}=1\n".format(able, variant) | ||||||
| 
 | 
 | ||||||
|         with open("setup.cfg", "a") as setup: |         with open("setup.cfg", "a") as setup: | ||||||
|             setup.write("[build_ext]\n") |             setup.write("[build_ext]\n") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ondřej Čertík
					Ondřej Čertík