Go to the documentation of this file.00001 import os
00002 import re
00003 import subprocess
00004 import sys
00005 from PyQt4 import pyqtconfig
00006
00007 if len(sys.argv) != 8:
00008 print('usage: %s build-dir sip-file output_dir include_dirs libs lib_dirs ldflags' % sys.argv[0])
00009 sys.exit(1)
00010
00011
00012 build_dir, sip_file, output_dir, include_dirs, libs, lib_dirs, ldflags = sys.argv[1:]
00013
00014
00015 build_file = 'pyqtscripting.sbf'
00016
00017
00018 config = pyqtconfig.Configuration()
00019
00020
00021
00022
00023 qt_sip_flags = config.pyqt_sip_flags
00024
00025 try:
00026 os.makedirs(build_dir)
00027 except OSError:
00028 pass
00029
00030
00031
00032 cmd = [
00033 config.sip_bin,
00034 '-c', build_dir,
00035 '-b', os.path.join(build_dir, build_file),
00036 '-I', config.pyqt_sip_dir,
00037 '-w'
00038 ]
00039 cmd += qt_sip_flags.split(' ')
00040 cmd.append(sip_file)
00041 subprocess.check_call(cmd)
00042
00043
00044
00045
00046 makefile = pyqtconfig.QtGuiModuleMakefile(
00047 dir=build_dir,
00048 configuration=config,
00049 build_file=build_file
00050 )
00051
00052
00053 default_platform_lib_function = pyqtconfig.QtGuiModuleMakefile.platform_lib
00054
00055
00056 def custom_platform_lib_function(self, clib, framework=0):
00057 if os.path.isabs(clib):
00058 return clib
00059 return default_platform_lib_function(self, clib, framework)
00060 pyqtconfig.QtGuiModuleMakefile.platform_lib = custom_platform_lib_function
00061
00062
00063
00064
00065 def split_paths(paths):
00066 paths = re.split('(?<=[^\\\\]) ', paths)
00067 return paths
00068
00069 for include_dir in split_paths(include_dirs):
00070 include_dir = include_dir.replace('\\', '')
00071 makefile.extra_include_dirs.append(include_dir)
00072 for lib in split_paths(libs):
00073 makefile.extra_libs.append(lib)
00074 for lib_dir in split_paths(lib_dirs):
00075 lib_dir = lib_dir.replace('\\', '')
00076 makefile.extra_lib_dirs.append(lib_dir)
00077 for ldflag in ldflags.split('\\ '):
00078 makefile.LFLAGS.append(ldflag)
00079
00080
00081 makefile._target = '"%s"' % os.path.join(output_dir, makefile._target)
00082
00083
00084 makefile.generate()