writers: add writeGuile[Bin] (#364531)
[NixPkgs.git] / pkgs / development / python-modules / pyqt / pyqt5-fix-dbus-mainloop-support.patch
blob2f559dcfe6a9685e2eb9220459109c9938d36dd7
1 From 944d5467e1655aac20a14325631df6daccaf5804 Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Sun, 3 Mar 2019 01:13:46 +0100
4 Subject: [PATCH] Fix building on Nix
6 ./configure.py tries to find dbus-python header in dbus-1 includedir
7 obtained from pkg-config or from --dbus flag. Unfortunately, when supplied,
8 it also uses the flag for locating dbus-1 headers. This fails on Nix,
9 since every package is installed into its own immutable tree so we cannot
10 use a single directory for both dbus-python and dbus-1. We can fix this by
11 using pkg-config for finding dbus-python headers too.
13 Additionally, the build system also tries to install the dbus support module
14 to dbus-python tree. Often, it is possible to handle this in pkgconfig as well [1]
15 but unfortunately, dbus-python does not export the moduledir in its pc file
16 so I have decided to solve this with an extra configure flag.
18 [1]: https://www.bassi.io/articles/2018/03/15/pkg-config-and-paths/
19 ---
20 configure.py | 13 +++++++++++--
21 1 file changed, 11 insertions(+), 2 deletions(-)
23 diff --git a/configure.py b/configure.py
24 index c6663e4..65e7da7 100644
25 --- a/configure.py
26 +++ b/configure.py
27 @@ -905,6 +905,9 @@ class TargetConfiguration:
28 if opts.pydbusincdir is not None:
29 self.pydbus_inc_dir = opts.pydbusincdir
31 + if opts.pydbusmoduledir is not None:
32 + self.pydbus_module_dir = opts.pydbusmoduledir
34 if opts.pyuicinterpreter is not None:
35 self.pyuic_interpreter = opts.pyuicinterpreter
37 @@ -1191,6 +1194,11 @@ def create_optparser(target_config):
38 metavar="DIR",
39 help="the directory containing the dbus/dbus-python.h header is "
40 "DIR [default: supplied by pkg-config]")
41 + g.add_option("--dbus-moduledir", dest='pydbusmoduledir', type='string',
42 + default=None, action='callback', callback=store_abspath,
43 + metavar="DIR",
44 + help="the directory where dbus support module will be installed to"
45 + "DIR [default: obtained from dbus.mainloop python module]")
46 p.add_option_group(g)
48 # Installation.
49 @@ -2277,7 +2285,7 @@ def check_dbus(target_config, verbose):
51 inform("Checking to see if the dbus support module should be built...")
53 - cmd = 'pkg-config --cflags-only-I --libs dbus-1'
54 + cmd = 'pkg-config --cflags-only-I --libs dbus-1 dbus-python'
56 if verbose:
57 sys.stdout.write(cmd + "\n")
58 @@ -2307,7 +2315,8 @@ def check_dbus(target_config, verbose):
59 inform("The Python dbus module doesn't seem to be installed.")
60 return
62 - target_config.pydbus_module_dir = dbus.mainloop.__path__[0]
63 + if target_config.pydbus_module_dir == '':
64 + target_config.pydbus_module_dir = dbus.mainloop.__path__[0]
66 # Try and find dbus-python.h. We don't use pkg-config because it is broken
67 # for dbus-python (at least for versions up to and including v0.81.0).
68 diff --git a/project.py b/project.py
69 index fe9fbce..9ae1ca1 100644
70 --- a/project.py
71 +++ b/project.py
72 @@ -261,7 +261,7 @@ del find_qt
73 dbus_lib_dirs = []
74 dbus_libs = []
76 - args = ['pkg-config', '--cflags-only-I', '--libs dbus-1']
77 + args = ['pkg-config', '--cflags-only-I', '--libs dbus-1', 'dbus-python']
79 for line in self.read_command_pipe(args, fatal=False):
80 for flag in line.strip().split():