def main (module): # The name of the SIP build file generated by SIP and used by the build # system. sipy_sip_dir = "sipfiles/" module = sipy_sip_dir+module + '.sip' build_file = "bundle"+".sbf" target = module+".so" # Get the extra SIP flags needed by the imported qt module. Note that # this normally only includes those flags (-x and -t) that relate to SIP's # versioning system. qt_sip_flags = qtconfigdict["sip_flags"] # sip_bin = current_env_path + "/bin/sip" sip_bin = find_executable('sip') pyqt_sip_dir = dirname(dirname(sip_bin)) + "/share/sip/PyQt5" # Get the PyQt configuration information. config = sipconfig.Configuration() # Run SIP to generate the code. Note that we tell SIP where to find the qt # module's specification files using the -I flag. errcode = os.system(" ".join([sip_bin, "-e","-c", ".", "-b", build_file, "-I", pyqt_sip_dir, qt_sip_flags, module])) if errcode != 0: print('sip exited with non zero error code: {}'.format(errcode)) # We are going to install the SIP specification file for this module and # its configuration module. installs = [] installs.append([module, os.path.join(pyqt_sip_dir, "isis3")]) isis_root = os.getenv("ISISROOT") if not isis_root: raise("Please set ISIS") extra_libs = ["$(ALLLIBS)", "-Wl,-rpath,"+isis_root+"/lib", "-Wl,-rpath,"+isis_root+"/3rdParty/lib"] makefile = ModuleMakefile(configuration=config, build_file=build_file, installs=installs) makefile.extra_cxxflags = ["$(ALLINCDIRS)", "-Wstrict-aliasing=0", "-Wno-unused-variable"] makefile.extra_lflags = ["$(ALLLIBDIRS)"] makefile.extra_include_dirs = [x[0] for x in os.walk('incs/')] makefile.extra_lib_dirs = [isis_root + '/3rdParty/lib', isis_root + 'lib'] makefile.generate() # add import line for isismake.os isis_makefile = "include " + isis_root + "/make/isismake.os" with open("Makefile", 'r+') as f: content = f.read() content = content.replace("LIBS =", "LIBS = " + ' '.join(extra_libs)) f.seek(0, 0) f.write(isis_makefile + '\n\n' + content)
def build(): from sipconfig import ModuleMakefile, Configuration old_pwd = os.path.abspath(os.path.dirname(__file__)) new_pwd = old_pwd + '/qcustomplot' os.chdir(new_pwd) config = Configuration() makefile = ModuleMakefile(configuration=config, build_file=BUILD_FILE) makefile.extra_include_dirs = [ '/usr/include', '/usr/include/qt5', '/usr/include/qt5/QtCore', '/usr/include/qt5/QtWidgets', '/usr/include/qt5/QtGui', '/usr/include/qt5/QtPrintSupport' ] makefile.extra_libs = ['qcustomplot'] makefile.extra_lib_dirs = ["/usr/lib64"] makefile.generate() status = os.system('make -j2') if status: print('Error!') os.chdir(old_pwd)
def build(): from sipconfig import ModuleMakefile, Configuration old_pwd = os.path.abspath(os.path.dirname(__file__)) new_pwd = old_pwd + '/qcustomplot' os.chdir(new_pwd) config = Configuration() makefile = ModuleMakefile(configuration=config, build_file=BUILD_FILE) makefile.extra_include_dirs = ['/usr/include', '/usr/include/qt5', '/usr/include/qt5/QtCore', '/usr/include/qt5/QtWidgets', '/usr/include/qt5/QtGui', '/usr/include/qt5/QtPrintSupport'] makefile.extra_libs = ['qcustomplot'] makefile.extra_lib_dirs = ["/usr/lib64"] makefile.generate() status = os.system('make -j2') if status: print('Error!') os.chdir(old_pwd)
def main(module): # The name of the SIP build file generated by SIP and used by the build # system. build_file = "bundle" + ".sbf" target = module + ".so" # Get the extra SIP flags needed by the imported qt module. Note that # this normally only includes those flags (-x and -t) that relate to SIP's # versioning system. qt_sip_flags = qtconfigdict["sip_flags"] current_env_path = commandOutput("conda", ["info"]) # search the output of conda info for the current environment path for item in current_env_path.split("\n"): if "default environment" in item: current_env_path = item.strip().split(' ')[3] sip_bin = current_env_path + "/bin/sip" pyqt_sip_dir = current_env_path + "/share/sip/PyQt5" # Get the PyQt configuration information. config = sipconfig.Configuration() # Run SIP to generate the code. Note that we tell SIP where to find the qt # module's specification files using the -I flag. os.system(" ".join([ sip_bin, "-c", ".", "-b", build_file, "-I", pyqt_sip_dir, qt_sip_flags, module + ".sip" ])) # We are going to install the SIP specification file for this module and # its configuration module. installs = [] installs.append([module + ".sip", os.path.join(pyqt_sip_dir, "isis3")]) isis_root = os.getenv("ISISROOT") if not isis_root: raise ("Please set ISIS") extra_cxxflags = ["$(ALLINCDIRS)"] extra_libs = [ "$(ALLLIBS)", "-Wl,-rpath," + isis_root + "/lib", "-Wl,-rpath," + isis_root + "/3rdParty/lib" ] extra_lib_dirs = ["$(ALLLIBDIRS)"] makefile = ModuleMakefile(configuration=config, build_file=build_file, installs=installs) makefile.extra_cxxflags = extra_cxxflags makefile.extra_lflags = extra_lib_dirs makefile.generate() # add import line for isismake.os isis_makefile = "include " + isis_root + "/make/isismake.os" with open("Makefile", 'r+') as f: content = f.read() content = content.replace("LIBS =", "LIBS = " + ' '.join(extra_libs)) f.seek(0, 0) f.write(isis_makefile + '\n\n' + content)
) # Add the library we are wrapping. The name doesn't include any platform # specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the # ".dll" extension on Windows). if config.platform.startswith('win32'): libname = 'qcustomplot1' makefile.generator = "NMAKE" else: libname = 'qcustomplot' makefile.extra_include_dirs = ['/usr/include', '/usr/include/qt5', '/usr/include/qt5/QtCore', '/usr/include/qt5/QtWidgets', '/usr/include/qt5/QtGui', '/usr/include/qt5/QtPrintSupport'] makefile.extra_libs = [libname] makefile.extra_lib_dirs = ["/usr/lib64"] # Generate the Makefile itself. makefile.generate() # Now we create the configuration module. This is done by merging a Python # dictionary (whose values are normally determined dynamically) with a # (static) template. content = { # Publish where the SIP specifications for this module will be # installed. "qcustomplot_sip_dir": config.default_sip_dir, # Publish the set of SIP flags needed by this module. As these are the # same flags needed by the qt module we could leave it out, but this # allows us to change the flags at a later date without breaking # scripts that import the configuration module. "qcustomplot_sip_flags": pyqt_sip_flags }