forked from qt-creator/qt-creator
deployqt: Proposed for for Windows deployment, some cleanups.
Change-Id: I16583d70371e69bf6729a4b028a7dbf49b3b02df Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
This commit is contained in:
@@ -37,7 +37,7 @@ import shutil
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
ignoreErrors = False
|
ignoreErrors = False
|
||||||
is_debug_build = False
|
debug_build = False
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "Usage: %s <creator_install_dir> [qmake_path]" % os.path.basename(sys.argv[0])
|
print "Usage: %s <creator_install_dir> [qmake_path]" % os.path.basename(sys.argv[0])
|
||||||
@@ -64,15 +64,15 @@ def which(program):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def check_debug(fpath):
|
def is_debug(fpath):
|
||||||
# bootstrap exception
|
# bootstrap exception
|
||||||
if fpath.endswith('QtCore4d.dll'):
|
if fpath.endswith('QtCore4d.dll'):
|
||||||
return True
|
return True
|
||||||
output = subprocess.check_output(['dumpbin', '/imports', fpath])
|
output = subprocess.check_output(['dumpbin', '/imports', fpath])
|
||||||
return output.find('QtCored4.dll') != -1
|
return output.find('QtCored4.dll') != -1
|
||||||
|
|
||||||
def check_debug_build(install_dir):
|
def is_debug_build(install_dir):
|
||||||
return check_debug(os.path.join(install_dir, 'bin', 'qtcreator.exe'))
|
return is_debug(os.path.join(install_dir, 'bin', 'qtcreator.exe'))
|
||||||
|
|
||||||
def op_failed(details = None):
|
def op_failed(details = None):
|
||||||
if details != None:
|
if details != None:
|
||||||
@@ -117,24 +117,23 @@ def fix_rpaths(chrpath_bin, install_dir):
|
|||||||
filenames = [filename for filename in filenames if check_unix_library_helper(dirpath, filename)]
|
filenames = [filename for filename in filenames if check_unix_library_helper(dirpath, filename)]
|
||||||
fix_rpaths_helper(chrpath_bin, install_dir, dirpath, filenames)
|
fix_rpaths_helper(chrpath_bin, install_dir, dirpath, filenames)
|
||||||
|
|
||||||
def ignore_pattern_helper(filename):
|
def windows_debug_files_filter(filename):
|
||||||
ignore_patterns = ['.lib', '.pdb', '.exp', '.ilk', '.dll']
|
ignore_patterns = ['.lib', '.pdb', '.exp', '.ilk']
|
||||||
for ip in ignore_patterns:
|
for ip in ignore_patterns:
|
||||||
if filename.endswith(ip):
|
if filename.endswith(ip):
|
||||||
return False
|
|
||||||
return True
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def copy_ignore_patterns_helper(dir, filenames):
|
def copy_ignore_patterns_helper(dir, filenames):
|
||||||
if not sys.platform.startswith('win'):
|
if not sys.platform.startswith('win'):
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
useful = filter(ignore_pattern_helper, filenames)
|
if debug_build:
|
||||||
if is_debug_build:
|
wrong_dlls = filter(lambda filename: filename.endswith('.dll') and not is_debug(os.path.join(dir, filename)), filenames)
|
||||||
dlls = filter(lambda filename: filename.endswith('.dll') and check_debug(os.path.join(dir, filename)), filenames)
|
|
||||||
else:
|
else:
|
||||||
dlls = filter(lambda filename: filename.endswith('.dll') and not check_debug(os.path.join(dir, filename)), filenames)
|
wrong_dlls = filter(lambda filename: filename.endswith('.dll') and is_debug(os.path.join(dir, filename)), filenames)
|
||||||
|
|
||||||
filenames = useful + dlls
|
filenames = wrong_dlls + filter(windows_debug_files_filter, filenames)
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir, plugins, imports):
|
def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir, plugins, imports):
|
||||||
@@ -151,10 +150,10 @@ def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir, plugins
|
|||||||
dest = os.path.join(install_dir, 'lib', 'qtcreator')
|
dest = os.path.join(install_dir, 'lib', 'qtcreator')
|
||||||
|
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
if is_debug_build:
|
if debug_build:
|
||||||
libraries = filter(lambda library: check_debug(library), libraries)
|
libraries = filter(lambda library: is_debug(library), libraries)
|
||||||
else:
|
else:
|
||||||
libraries = filter(lambda library: not check_debug(library), libraries)
|
libraries = filter(lambda library: not is_debug(library), libraries)
|
||||||
|
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
print library, '->', dest
|
print library, '->', dest
|
||||||
@@ -210,11 +209,9 @@ def readQmakeVar(qmake_bin, var):
|
|||||||
return pipe.read().rstrip('\n')
|
return pipe.read().rstrip('\n')
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
generateMode = False
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi', ['help', 'ignore-errors'])
|
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hi', ['help', 'ignore-errors'])
|
||||||
except:
|
except:
|
||||||
print str(err)
|
|
||||||
usage()
|
usage()
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
for o, a in opts:
|
for o, a in opts:
|
||||||
@@ -257,8 +254,8 @@ def main():
|
|||||||
tr_catalogs = ['assistant', 'designer', 'qt', 'qt_help']
|
tr_catalogs = ['assistant', 'designer', 'qt', 'qt_help']
|
||||||
|
|
||||||
if sys.platform.startswith('win'):
|
if sys.platform.startswith('win'):
|
||||||
global is_debug_build
|
global debug_build
|
||||||
is_debug_build = check_debug_build(install_dir)
|
debug_build = is_debug_build(install_dir)
|
||||||
|
|
||||||
copy_qt_libs(install_dir, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, plugins, imports)
|
copy_qt_libs(install_dir, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS, QT_INSTALL_IMPORTS, plugins, imports)
|
||||||
copy_translations(install_dir, QT_INSTALL_TRANSLATIONS, tr_catalogs)
|
copy_translations(install_dir, QT_INSTALL_TRANSLATIONS, tr_catalogs)
|
||||||
|
Reference in New Issue
Block a user