diff options
-rw-r--r-- | qtcreator.pro | 2 | ||||
-rw-r--r-- | scripts/common.py | 14 | ||||
-rwxr-xr-x | scripts/createDistPackage.py | 17 | ||||
-rwxr-xr-x | scripts/makedmg.py | 60 | ||||
-rwxr-xr-x | scripts/makedmg.sh | 45 |
5 files changed, 76 insertions, 62 deletions
diff --git a/qtcreator.pro b/qtcreator.pro index d8a95fc222..1738c44649 100644 --- a/qtcreator.pro +++ b/qtcreator.pro @@ -112,7 +112,7 @@ macx { BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app" deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_BINS]\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" \"$$[QT_INSTALL_IMPORTS]\" \"$$[QT_INSTALL_QML]\" codesign.commands = codesign --deep -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\" - dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg + dmg.commands = python -u \"$$PWD/scripts/makedmg.py\" \"$${BASENAME}.dmg\" \"Qt Creator\" \"$$IDE_SOURCE_TREE\" \"$$OUT_PWD/bin\" #dmg.depends = deployqt QMAKE_EXTRA_TARGETS += codesign dmg } else { diff --git a/scripts/common.py b/scripts/common.py index 388ce487fd..b8f640377e 100644 --- a/scripts/common.py +++ b/scripts/common.py @@ -163,3 +163,17 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None): if is_unix_executable(filepath) or is_unix_library(filepath): fix_rpaths_helper(filepath) +def is_debug_file(filepath): + if is_mac_platform(): + return filepath.endswith('.dSYM') or '.dSYM/' in filepath + elif is_linux_platform(): + return filepath.endswith('.debug') + else: + return filepath.endswith('.pdb') + +def is_debug(path, filenames): + return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))] + +def is_not_debug(path, filenames): + files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))] + return [fn for fn in files if not is_debug_file(os.path.join(path, fn))] diff --git a/scripts/createDistPackage.py b/scripts/createDistPackage.py index fc6e7b7aaa..2b0c38ea5f 100755 --- a/scripts/createDistPackage.py +++ b/scripts/createDistPackage.py @@ -45,28 +45,13 @@ def parse_arguments(): parser.add_argument('source_directory', help='source directory with the Qt Creator installation') return parser.parse_args() -def is_debug_file(filepath): - if common.is_mac_platform(): - return filepath.endswith('.dSYM') or '.dSYM/' in filepath - elif common.is_linux_platform(): - return filepath.endswith('.debug') - else: - return filepath.endswith('.pdb') - -def is_debug(path, filenames): - return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))] - -def is_not_debug(path, filenames): - files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))] - return [fn for fn in files if not is_debug_file(os.path.join(path, fn))] - def main(): arguments = parse_arguments() tempdir_base = tempfile.mkdtemp() tempdir = os.path.join(tempdir_base, os.path.basename(arguments.source_directory)) try: common.copytree(arguments.source_directory, tempdir, symlinks=True, - ignore=(is_not_debug if arguments.debug else is_debug)) + ignore=(common.is_not_debug if arguments.debug else common.is_debug)) zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir subprocess.check_call([arguments.sevenzip, 'a', '-mx9', arguments.target_archive, zip_source]) diff --git a/scripts/makedmg.py b/scripts/makedmg.py new file mode 100755 index 0000000000..33721f90a7 --- /dev/null +++ b/scripts/makedmg.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +############################################################################ +# +# Copyright (C) 2018 The Qt Company Ltd. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of Qt Creator. +# +# Commercial License Usage +# Licensees holding valid commercial Qt licenses may use this file in +# accordance with the commercial license agreement provided with the +# Software or, alternatively, in accordance with the terms contained in +# a written agreement between you and The Qt Company. For licensing terms +# and conditions see https://www.qt.io/terms-conditions. For further +# information use the contact form at https://www.qt.io/contact-us. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 3 as published by the Free Software +# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-3.0.html. +# +############################################################################ + +import argparse +import os +import shutil +import subprocess +import tempfile +import time + +import common + +def parse_arguments(): + parser = argparse.ArgumentParser(description='Create Qt Creator disk image, filtering out debug information files.') + parser.add_argument('target_diskimage', help='output .dmg file to create') + parser.add_argument('dmg_volumename', help='volume name to use for the disk image') + parser.add_argument('source_directory', help='directory with the Qt Creator sources') + parser.add_argument('binary_directory', help='directory that contains the Qt Creator.app') + return parser.parse_args() + +def main(): + arguments = parse_arguments() + tempdir_base = tempfile.mkdtemp() + tempdir = os.path.join(tempdir_base, os.path.basename(arguments.binary_directory)) + try: + common.copytree(arguments.binary_directory, tempdir, symlinks=True, ignore=common.is_debug) + os.symlink('/Applications', os.path.join(tempdir, 'Applications')) + shutil.copy(os.path.join(arguments.source_directory, 'LICENSE.GPL3-EXCEPT'), tempdir) + dmg_cmd = ['hdiutil', 'create', '-srcfolder', tempdir, '-volname', arguments.dmg_volumename, + '-format', 'UDBZ', arguments.target_diskimage, '-ov', '-scrub', '-size', '1g', '-verbose'] + subprocess.check_call(dmg_cmd) + # sleep a few seconds to make sure disk image is fully unmounted etc + time.sleep(5) + finally: + shutil.rmtree(tempdir_base) +if __name__ == "__main__": + main() diff --git a/scripts/makedmg.sh b/scripts/makedmg.sh deleted file mode 100755 index befdf42e88..0000000000 --- a/scripts/makedmg.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -############################################################################ -# -# Copyright (C) 2016 The Qt Company Ltd. -# Contact: https://www.qt.io/licensing/ -# -# This file is part of Qt Creator. -# -# Commercial License Usage -# Licensees holding valid commercial Qt licenses may use this file in -# accordance with the commercial license agreement provided with the -# Software or, alternatively, in accordance with the terms contained in -# a written agreement between you and The Qt Company. For licensing terms -# and conditions see https://www.qt.io/terms-conditions. For further -# information use the contact form at https://www.qt.io/contact-us. -# -# GNU General Public License Usage -# Alternatively, this file may be used under the terms of the GNU -# General Public License version 3 as published by the Free Software -# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -# included in the packaging of this file. Please review the following -# information to ensure the GNU General Public License requirements will -# be met: https://www.gnu.org/licenses/gpl-3.0.html. -# -############################################################################ - -[ $# -lt 2 ] && echo "Usage: $(basename $0) <folder> <name.dmg>" && exit 2 -[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2; -sourceFolder="$1" -intermediateFolder=$(mktemp -d "/tmp/packagedir.XXXXX") -finalDMGName="$2" -title="Qt Creator" - -echo Preparing image artifacts... -cp -a "${sourceFolder}/" "${intermediateFolder}" -ln -s /Applications "${intermediateFolder}" -cp "$(dirname "${BASH_SOURCE[0]}")/../LICENSE.GPL3-EXCEPT" "${intermediateFolder}/LICENSE.GPL3-EXCEPT.txt" -echo Creating image... -hdiutil create -srcfolder "${intermediateFolder}" -volname "${title}" -format UDBZ "${finalDMGName}" -ov -scrub -size 1g -verbose -# make sure that the image is umounted etc -sleep 4 - -# clean up -rm -rf "${intermediateFolder}" |