Форум сайта python.su
0
http://soft-ee.com/qt-visual-studio/
''' Created on 16.05.2012 @author: Dima ''' import time import argparse from os.path import abspath, dirname from sys import argv import os, sys from subprocess import Popen, PIPE global separator_string separator_string = " " def subprocess(request): print(request) p = Popen(request, stdout=PIPE, stdin = PIPE, shell= True) text = p.communicate("y\n".encode()) retcode = p.wait() print(text[0].decode('cp866')) print("exit", "code: %d" % retcode, sep=separator_string) return retcode def main(argv): parser = argparse.ArgumentParser(description=separator_string.join(['Build', 'Qt', 'with', 'configuration']), epilog=separator_string.join(['Tested', 'on', 'Python 3.2.2', 'OS Windows XP'])) parser.add_argument('-qtd', '--qt_dir', dest='qt_dir' , help=separator_string.join(['Set', 'a', 'path', 'to', 'Qt', 'dir' ]), default = argv[0]) parser.add_argument('-ctl', '--conf_type_link', dest = 'conf_type_link', help=separator_string.join(['Set', 'a', 'type', 'link', 'Qt' ]), default= "'-shared'") parser.add_argument('-ctb', '--conf_type_build', dest='conf_type_build' , help=separator_string.join(['Set', 'a', 'type', 'build', 'Qt']), default = "'-debug-and-release'") parser.add_argument('-cspec', '--conf_spec', dest='conf_specification' , help=separator_string.join(['Set', 'a', 'specification', 'build', 'Qt' ]), default = "'win32-msvc2010'") parser.add_argument('-fout', '--lout_file', dest='stream_log_out_file_name', help=separator_string.join(['Set', 'a', 'name', 'for', 'the', 'output', 'file'])) parser.add_argument('-ferr', '--lerr_file', dest='stream_log_err_file_name', help=separator_string.join(['Set', 'a', 'name', 'for', 'the' , 'error' , 'output', 'file'])) options = parser.parse_args() conf_specification = options.conf_specification.replace("'","") qt_dir = options.qt_dir.replace("'","") conf_type_link = options.conf_type_link.replace("'","") conf_type_build = options.conf_type_build.replace("'","") script_start_up_dir = dirname(abspath(argv[0])) print('Script', "is" , "launched", "in" , 'dir: %s' % script_start_up_dir, sep=separator_string) print("Args: %s" % options) request = [os.path.join("C:/", "Program Files", "Microsoft Visual Studio 10.0", "Common7", "Tools", "vsvars32.bat")] subprocess(request) os.system("PAUSE") saveout = sys.stdout saveerr = sys.stderr if options.stream_log_out_file_name: stream_log_out_file = open(options.stream_log_out_file_name, 'w') sys.stdout = stream_log_out_file sys.stderr = stream_log_out_file if options.stream_log_err_file_name: stream_log_err_file = open(options.stream_log_err_file_name, 'w') sys.stderr = stream_log_err_file start_time = time.clock() print ('Setting', 'up' ,'a', 'Qt' ,'environment...', sep=separator_string) os.environ['QTDIR'] = qt_dir print("--", "QTDIR", "set" ,"to" ,"%s"%os.environ['QTDIR']) os.environ['PATH']= "%s;%s"%(os.path.join(os.environ['QTDIR'],"bin"),os.environ['PATH']) print("--", "Added", "%s"%os.path.join(os.environ['QTDIR'],"bin"), "to", "PATH") os.environ['QMAKESPEC']= conf_specification print("--", "QMAKESPEC" ,"set" ,"to" , os.environ['QMAKESPEC']) os.chdir(qt_dir) print ("Configuration", "Qt", sep=separator_string) request = [ "configure.exe", conf_type_link, conf_type_build, "-opensource", "-qt-zlib", "-qt-libpng", "-qt-libmng", "-qt-libjpeg", "-no-crt", "-nomake", "demos", "-nomake", "examples", "-no-qt3support", "-no-qmake", ] subprocess(request) os.chdir("qmake") print ("Compile", "qmake", sep=separator_string) request = [ os.path.join(script_start_up_dir,"jom", "jom.exe"), "-j", "%d"%4, "-f", "makefile.win32"] subprocess(request) request = [ os.path.join(script_start_up_dir,"jom", "jom.exe"), "-f", "makefile.win32", "clean"] subprocess(request) os.chdir(qt_dir) print ("Compile", "Qt", sep=separator_string) request = [ os.path.join(script_start_up_dir,"jom", "jom.exe"), "-j", "%d"%4] subprocess(request) now_time = time.clock() print("Time:", time.strftime('%H:%M:%S', time.gmtime(start_time - now_time)),sep= separator_string) if options.stream_log_out_file_name: sys.stdout = stream_log_out_file stream_log_out_file.close() if options.stream_log_err_file_name: sys.stderr = stream_log_err_file stream_log_err_file.close() sys.stdout = saveout sys.stderr = saveerr os.system("PAUSE") if __name__ == '__main__': main(argv[1:])
Compile qmake ['C:\\workspace\\QtBuild\\src\\qtbuild\\jom\\jom.exe', '-j', '4', '-f', 'makefile.win32'] jom 1.0.11 - empower your cores jom: C:\Qt\4.8.1\qmake\makefile.win32 [qmake_pch.obj] Error 1 cl -c -Fo./ -W3 -nologo -O2 /MP -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian -Igenerators\integrity -I..\include -I..\include\QtCore -I..\include -I..\include\QtCore -I..\src\corelib\global -I..\src\corelib\xml -I..\mkspecs\win32-msvc2010 -I..\tools\shared -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -c -Yc -Fpqmake_pch.pch -TP qmake_pch.h "cl" не является внутренней или внешней командой, исполняемой программой или пакетным файлом. exit code: 2
request = [os.path.join("C:/", "Program Files", "Microsoft Visual Studio 10.0", "Common7", "Tools", "vsvars32.bat")] subprocess(request)
Отредактировано daimonkor (Май 18, 2012 11:30:38)
Офлайн
0
def subprocess(request): print(request) print(os.environ) p = Popen(request, stdout=PIPE, stdin = PIPE, shell= True, env=os.environ) text = p.communicate("y\n".encode()) retcode = p.wait() print(text[0].decode('cp866')) print("exit", "code: %d" % retcode, sep=separator_string) return retcode
Compile qmake ['C:\\workspace\\QtBuild\\src\\qtbuild\\jom\\jom.exe', '-j', '4', '-f', 'makefile.win32'] environ({'TMP': 'C:\\DOCUME~1\\Dima\\LOCALS~1\\Temp', 'PYTHONIOENCODING': 'UTF-8', 'COMPUTERNAME': 'PC', 'USERDOMAIN': 'PC', 'VS100COMNTOOLS': 'C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\Tools\\', 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files', 'PROCESSOR_IDENTIFIER': 'x86 Family 6 Model 15 Stepping 11, GenuineIntel', 'PROGRAMFILES': 'C:\\Program Files', 'PROCESSOR_REVISION': '0f0b', 'QTDIR': 'C:\\Qt\\4.8.1', 'PATH': 'C:\\Qt\\4.8.1\\bin;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\\Program Files\\ImageMagick-6.6.4-Q16;C:\\Program Files\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\PC Connectivity Solution\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\Program Files\\VisualSVN\\bin;;C:\\Program Files\\CMake 2.8\\bin;C:\\Program Files\\doxygen\\bin;C:\\Program Files\\Graphviz 2.28\\bin;C:\\Program Files\\TortoiseSVN\\bin;C:\\Python32;C:\\Qt\\4.8.0\\bin;C:\\Qt\\4.8.1\\bin;C:\\eclipse-SDK-3.7.2-win32\\eclipse;', 'EMAIL': 'C:\\Documents and Settings\\Dima\\Application Data\\The Bat!', 'TEMP': 'C:\\DOCUME~1\\Dima\\LOCALS~1\\Temp', 'PROCESSOR_ARCHITECTURE': 'x86', 'QMAKESPEC': 'win32-msvc2010', 'ALLUSERSPROFILE': 'C:\\Documents and Settings\\All Users', 'PYDEV_CONSOLE_ENCODING': 'UTF-8', 'SESSIONNAME': 'Console', 'HOMEPATH': '\\Documents and Settings\\Dima', 'DJANGO_SETTINGS_MODULE': 'QtBuild.settings', 'USERNAME': 'Dima', 'LOGONSERVER': '\\\\PC', 'PROMPT': '$P$G', 'COMSPEC': 'C:\\WINDOWS\\system32\\cmd.exe', 'SYSTEMROOT': 'C:\\WINDOWS', 'PYTHONPATH': 'C:\\eclipse-SDK-3.7.2-win32\\eclipse\\plugins\\org.python.pydev_2.5.0.2012040618\\PySrc\\pydev_sitecustomize;C:\\workspace\\QtBuild\\src;C:\\eclipse-SDK-3.7.2-win32\\eclipse\\plugins\\org.python.pydev_2.4.0.2012020116\\PySrc;C:\\WINDOWS\\system32\\python32.zip;C:\\Python32\\DLLs;C:\\Python32\\lib;C:\\Python32;C:\\Python32\\lib\\site-packages', 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH', 'CLIENTNAME': 'Console', 'FP_NO_HOST_CHECK': 'NO', 'WINDIR': 'C:\\WINDOWS', 'HOMEDRIVE': 'C:', 'APPDATA': 'C:\\Documents and Settings\\Dima\\Application Data', 'SYSTEMDRIVE': 'C:', 'PYDEV_COMPLETER_PYTHONPATH': 'C:\\eclipse-SDK-3.7.2-win32\\eclipse\\plugins\\org.python.pydev_2.5.0.2012040618\\PySrc', 'NUMBER_OF_PROCESSORS': '4', 'PROCESSOR_LEVEL': '6', 'OS': 'Windows_NT', 'USERPROFILE': 'C:\\Documents and Settings\\Dima'}) jom 1.0.11 - empower your cores jom: C:\Qt\4.8.1\qmake\makefile.win32 [qmake_pch.obj] Error 1 cl -c -Fo./ -W3 -nologo -O2 /MP -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac -Igenerators\symbian -Igenerators\integrity -I..\include -I..\include\QtCore -I..\include -I..\include\QtCore -I..\src\corelib\global -I..\src\corelib\xml -I..\mkspecs\win32-msvc2010 -I..\tools\shared -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -c -Yc -Fpqmake_pch.pch -TP qmake_pch.h "cl" не является внутренней или внешней командой, исполняемой программой или пакетным файлом. exit code: 2
Отредактировано daimonkor (Май 18, 2012 14:02:55)
Офлайн