Workaround for sip version mismatch on Arch

This commit is contained in:
Kovid Goyal 2021-05-13 08:40:37 +05:30
parent d368c4f96e
commit 73a312dd64
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 19 additions and 0 deletions

View File

@ -487,6 +487,10 @@ class Build(Command):
os.rename(self.j(self.d(target), 'libheadless.dylib'), self.j(self.d(target), 'headless.so'))
def create_sip_build_skeleton(self, src_dir, ext):
from setup.build_environment import pyqt_sip_abi_version
abi_version = ''
if pyqt_sip_abi_version():
abi_version = f'abi-version = "{pyqt_sip_abi_version()}"'
sipf = ext.sip_files[0]
needs_exceptions = 'true' if ext.needs_exceptions else 'false'
with open(os.path.join(src_dir, 'pyproject.toml'), 'w') as f:
@ -504,6 +508,7 @@ project-factory = "pyqtbuild:PyQtProject"
[tool.sip.project]
sip-files-dir = "."
{abi_version}
[tool.sip.bindings.pictureflow]
headers = {ext.headers}

View File

@ -7,12 +7,26 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, subprocess, re, shutil
from functools import lru_cache
from setup import ismacos, iswindows, is64bit, islinux, ishaiku
NMAKE = RC = msvc = MT = win_inc = win_lib = win_cc = win_ld = None
@lru_cache(maxsize=2)
def pyqt_sip_abi_version():
import PyQt5
if getattr(PyQt5, '__file__', None):
bindings_path = os.path.join(os.path.dirname(PyQt5.__file__), 'bindings', 'QtCore', 'QtCore.toml')
if os.path.exists(bindings_path):
with open(bindings_path) as f:
raw = f.read()
m = re.search(r'^sip-abi-version\s*=\s*"(.+?)"', raw, flags=re.MULTILINE)
if m is not None:
return m.group(1)
def merge_paths(a, b):
a = [os.path.normcase(os.path.normpath(x)) for x in a.split(os.pathsep)]
for q in b.split(os.pathsep):