#!/bin/env python -B import os import sipconfig from PyQt5 import QtCore sip_inc_fedora = "/usr/share/python3-sip/PyQt5" sip_inc_fedora_35 = "/usr/lib64/python3.10/site-packages/PyQt5/bindings" sip_inc_fedora_38 = "/usr/lib64/python3.11/site-packages/PyQt5/bindings" sip_inc_debian = "/usr/share/sip/PyQt5" sip_inc_debian_11 = "/usr/lib/python3/dist-packages/PyQt5/bindings" sip_inc_archlinux = "/usr/lib/python3.10/site-packages/PyQt5/bindings" basename = "highlight" # The name of the SIP build file generated by SIP and used by the build system. build_file = basename + ".sbf" # Get the SIP configuration information. config = sipconfig.Configuration() # print ("sip_flags", QtCore.PYQT_CONFIGURATION["sip_flags"]) # Run SIP to generate the code. os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, "-I" + sip_inc_fedora, "-I" + sip_inc_fedora_35, "-I" + sip_inc_fedora_38, "-I" + sip_inc_debian, "-I" + sip_inc_debian_11, "-I" + sip_inc_archlinux, QtCore.PYQT_CONFIGURATION["sip_flags"], basename + ".sip"])) # Create the Makefile. makefile = sipconfig.SIPModuleMakefile(config, build_file) # makefile.extra_include_dirs = [ "/usr/include/qt5", # "/usr/include/qt5/QtCore", # "/usr/include/qt5/QtGui", # "/usr/include/qt5/QtWidgets", # "/usr/include/qt5/QtDesigner" # ] # makefile.extra_libs = ["Qt5Widgets", "Qt5Gui", "Qt5Core", "Qt5Designer", "Qt5DesignerComponents" ] cflags = os.popen ("pkg-config Qt5Widgets --cflags").read() libs = os.popen ("pkg-config Qt5Widgets --libs").read() makefile.extra_cxxflags = cflags.split () makefile.extra_lflags = libs.split () # Generate the Makefile itself. makefile.generate() # https://github.com/zanton/hello-sip-pyqt5