import os import sipconfig from PyQt4 import QtCore sip_inc_dir = "/usr/share/sip/PyQt4" 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_dir, QtCore.PYQT_CONFIGURATION["sip_flags"], basename + ".sip"])) # Create the Makefile. makefile = sipconfig.SIPModuleMakefile(config, build_file) cflags = os.popen ("pkg-config QtGui --cflags").read() libs = os.popen ("pkg-config QtGui --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