-
Notifications
You must be signed in to change notification settings - Fork 732
Expand file tree
/
Copy pathbuilder.py
More file actions
53 lines (41 loc) · 1.84 KB
/
Copy pathbuilder.py
File metadata and controls
53 lines (41 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import sys
from setuptools import build_meta as _orig
from setuptools.build_meta import * # noqa: F401,F403
from setuptools.dist import Distribution
WAYLAND_FFI_BUILD = "./libqtile/backend/wayland/cffi/build.py"
def wants_wayland(config_settings):
if config_settings:
for key in ["Backend", "backend"]:
value = config_settings.get(key, "").lower()
if value == "wayland":
return True
if value == "x11":
return False
return None
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
"""If wayland backend is requested, build it!"""
if config_settings is None:
config_settings = {}
wayland_requested = wants_wayland(config_settings)
if wayland_requested is not False:
try:
from libqtile.backend.wayland.cffi.build import ffi_compile
ffi_compile(verbose=bool(wayland_requested))
except Exception as e:
if wayland_requested:
sys.exit(f"Wayland backend requested but backend could not be built: {e}")
else:
print(f"Wayland backend was not built: {e}")
else:
print("Wayland backend disabled")
# Write library paths to file, if they are specified at build time via
# --config-settings=PANGO_PATH=...
libs = ["PANGO", "PANGOCAIRO", "GOBJECT", "XCBCURSOR", "FONTCONFIG"]
if set(libs).intersection(config_settings.keys()):
with open("libqtile/_build_config.py", "w") as f:
f.write("# This file is generated at build time by builder.py\n")
for lib in libs:
p = lib + "_PATH"
f.write(f"{p} = {config_settings.get(lib)!r}\n")
Distribution.has_ext_modules = lambda self: True
return _orig.build_wheel(wheel_directory, config_settings, metadata_directory)