Skip to content

Commit 3ad5e2a

Browse files
committed
Use PyQt5 module path to find SIP bindings (#105)
`sipconfig._pkg_config['default_mod_dir']` is currently used to find the PyQt5 SIP bindings, but this location is determined by where SIP is installed, which may not be the same as where PyQt5 is installed. A real world example of this is in Nix, where each package is installed to a separate isolated directory. Instead, we can use `PyQt5.__path__[0]`, which will always point to the location of the PyQt5 module.
1 parent 43d8309 commit 3ad5e2a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cmake/sip_configure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import subprocess
66
import sys
77

8+
import PyQt5
89
from PyQt5 import QtCore
910
import sipconfig
1011

@@ -62,7 +63,7 @@ def get_sip_dir_flags(config):
6263
sip_flags = QtCore.PYQT_CONFIGURATION['sip_flags']
6364

6465
# Archlinux installs sip files here by default
65-
default_sip_dir = os.path.join(sipconfig._pkg_config['default_mod_dir'], 'PyQt5', 'bindings')
66+
default_sip_dir = os.path.join(PyQt5.__path__[0], 'bindings')
6667
if os.path.exists(default_sip_dir):
6768
return default_sip_dir, sip_flags
6869

0 commit comments

Comments
 (0)