@@ -98,38 +98,26 @@ def finalize_options(self):
98
98
include_dirs = [cairo .get_include ()],
99
99
)]
100
100
101
- tmp_include_dir = Path (self .get_finalized_command ("build" ).build_base ,
102
- "include" )
103
- tmp_include_dir .mkdir (parents = True , exist_ok = True )
104
- # On Arch Linux, the python-pillow (Arch) package
105
- # includes a version of ``raqm.h`` that is both invalid
106
- # (https://bugs.archlinux.org/task/57492) and now outdated (it is
107
- # missing a declaration for `raqm_version_string`), but placed in an
108
- # non-overridable directory for distutils. Thus, on that distro, force
109
- # the use of a cleanly downloaded header.
101
+ # NOTE: Versions <= 8.2 of Arch Linux's python-pillow package included
102
+ # *into a non-overridable distutils header directory* a ``raqm.h`` that
103
+ # is both invalid (https://bugs.archlinux.org/task/57492) and outdated
104
+ # (missing a declaration for `raqm_version_string`). It is thus not
105
+ # possible to build mplcairo with such an old distro package installed.
110
106
try :
111
- is_arch = "Arch Linux" in Path ("/etc/os-release" ).read_text ()
112
- except OSError :
113
- is_arch = False
114
- if is_arch :
115
- has_pkgconfig_raqm = False
116
- else :
117
- try :
118
- get_pkgconfig (f"--atleast-version={ MIN_RAQM_VERSION } " , "raqm" )
119
- except (FileNotFoundError , CalledProcessError ):
120
- has_pkgconfig_raqm = False
121
- else :
122
- has_pkgconfig_raqm = True
123
- if has_pkgconfig_raqm :
124
- ext .extra_compile_args += get_pkgconfig ("--cflags" , "raqm" )
125
- else :
107
+ get_pkgconfig (f"--atleast-version={ MIN_RAQM_VERSION } " , "raqm" )
108
+ except (FileNotFoundError , CalledProcessError ):
109
+ tmp_include_dir = Path (
110
+ self .get_finalized_command ("build" ).build_base , "include" )
111
+ tmp_include_dir .mkdir (parents = True , exist_ok = True )
126
112
(tmp_include_dir / "raqm-version.h" ).write_text ("" ) # Touch it.
127
113
with urllib .request .urlopen (
128
114
f"https://raw.githubusercontent.com/HOST-Oman/libraqm/"
129
115
f"v{ MIN_RAQM_VERSION } /src/raqm.h" ) as request , \
130
116
(tmp_include_dir / "raqm.h" ).open ("wb" ) as file :
131
117
file .write (request .read ())
132
118
ext .include_dirs += [tmp_include_dir ]
119
+ else :
120
+ ext .extra_compile_args += get_pkgconfig ("--cflags" , "raqm" )
133
121
134
122
if os .name == "posix" :
135
123
get_pkgconfig (f"--atleast-version={ MIN_CAIRO_VERSION } " , "cairo" )
0 commit comments