Exemplo n.º 1
0
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)
        if common.is_mac_platform():
            app_path = [
                app for app in os.listdir(tempdir) if app.endswith('.app')
            ][0]
            common.codesign(os.path.join(tempdir, app_path))
        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', '1500m',
            '-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)
Exemplo n.º 2
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'),
                           os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clangd.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-tidy.exe'),
                           clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
        for libsource in libsources:
            deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
        clangdbinary = os.path.join(llvm_install_dir, 'bin', 'clangd')
        clangtidybinary = os.path.join(llvm_install_dir, 'bin', 'clang-tidy')
        clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        deployinfo.append((clangbinary, clangbinary_targetdir))
        deployinfo.append((clangdbinary, clangbinary_targetdir))
        deployinfo.append((clangtidybinary, clangbinary_targetdir))
        # copy link target if clang is actually a symlink
        if os.path.islink(clangbinary):
            linktarget = os.readlink(clangbinary)
            deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
                               os.path.join(clangbinary_targetdir, linktarget)))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process
        print("removing libclang RPATHs...")
        for source, target in deployinfo:
            if not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Exemplo n.º 3
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'libclang.dll'),
                           os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clang-cl.exe'),
                           clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin', 'clangd.exe'),
                           clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        libsources = glob(os.path.join(llvm_install_dir, 'lib', 'libclang.so*'))
        for libsource in libsources:
            deployinfo.append((libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        clangbinary = os.path.join(llvm_install_dir, 'bin', 'clang')
        clangdbinary = os.path.join(llvm_install_dir, 'bin', 'clangd')
        clangbinary_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        deployinfo.append((clangbinary, clangbinary_targetdir))
        deployinfo.append((clangdbinary, clangbinary_targetdir))
        # copy link target if clang is actually a symlink
        if os.path.islink(clangbinary):
            linktarget = os.readlink(clangbinary)
            deployinfo.append((os.path.join(os.path.dirname(clangbinary), linktarget),
                               os.path.join(clangbinary_targetdir, linktarget)))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator', 'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process
        print("removing libclang RPATHs...")
        for source, target in deployinfo:
            if not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Exemplo n.º 4
0
def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir, qt_qml_dir, plugins):
    print("copying Qt libraries...")

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print(library, '->', lib_dest)
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                pass
        else:
            shutil.copy(library, lib_dest)

    print("Copying plugins:", plugins)
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print("Copying qt quick 2 imports")
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)

    print("Copying qtdiag")
    bin_dest = target_qt_prefix_path if common.is_windows_platform() else os.path.join(target_qt_prefix_path, 'bin')
    qtdiag_src = os.path.join(qt_bin_dir, 'qtdiag.exe' if common.is_windows_platform() else 'qtdiag')
    if not os.path.exists(bin_dest):
        os.makedirs(bin_dest)
    shutil.copy(qtdiag_src, bin_dest)
Exemplo n.º 5
0
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=(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])
    finally:
        shutil.rmtree(tempdir_base)
Exemplo n.º 6
0
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)
Exemplo n.º 7
0
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=(common.is_not_debug if arguments.debug else common.is_debug))
        # on macOS we might have to codesign (again) to account for removed debug info
        if not arguments.debug:
            common.codesign(tempdir)
        # package
        zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir
        subprocess.check_call([arguments.sevenzip, 'a',
            arguments.target_archive, zip_source])
    finally:
        shutil.rmtree(tempdir_base)
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=(common.is_not_debug if arguments.debug else common.is_debug))
        # on macOS we might have to codesign (again) to account for removed debug info
        if not arguments.debug:
            common.codesign(tempdir)
        # package
        zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir
        subprocess.check_call([arguments.sevenzip, 'a', '-mmt2',
            arguments.target_archive, zip_source])
    finally:
        shutil.rmtree(tempdir_base)
Exemplo n.º 9
0
def copy_regexp(regexp, source_directory, target_directory, verbose):
    def ignore(directory, filenames):
        relative_dir = os.path.relpath(directory, source_directory)
        file_target_dir = os.path.join(target_directory, relative_dir)
        ignored = []
        for filename in filenames:
            relative_file_path = os.path.normpath(os.path.join(relative_dir, filename))
            relative_file_path = relative_file_path.replace(os.sep, '/')
            if os.path.isdir(os.path.join(directory, filename)):
                relative_file_path += '/' # let directories end with slash
            if not regexp.match(relative_file_path):
                ignored.append(filename)
            elif verbose and os.path.isfile(os.path.join(directory, filename)):
                print(os.path.normpath(os.path.join(file_target_dir, filename)))
        return ignored

    common.copytree(source_directory, target_directory, symlinks=True, ignore=ignore)
Exemplo n.º 10
0
def copy_regexp(regexp, source_directory, target_directory, verbose):
    def ignore(directory, filenames):
        relative_dir = os.path.relpath(directory, source_directory)
        file_target_dir = os.path.join(target_directory, relative_dir)
        ignored = []
        for filename in filenames:
            relative_file_path = os.path.normpath(os.path.join(relative_dir, filename))
            relative_file_path = relative_file_path.replace(os.sep, '/')
            if os.path.isdir(os.path.join(directory, filename)):
                relative_file_path += '/' # let directories end with slash
            if not regexp.match(relative_file_path):
                ignored.append(filename)
            elif verbose and os.path.isfile(os.path.join(directory, filename)):
                print(os.path.normpath(os.path.join(file_target_dir, filename)))
        return ignored

    common.copytree(source_directory, target_directory, symlinks=True, ignore=ignore)
Exemplo n.º 11
0
def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        dest = os.path.join(install_dir, 'bin')
    else:
        dest = os.path.join(install_dir, 'lib', 'qtcreator')

    if common.is_windows_platform():
        if debug_build:
            libraries = filter(lambda library: is_debug(library), libraries)
        else:
            libraries = filter(lambda library: not is_debug(library), libraries)

    for library in libraries:
        print library, '->', dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(dest, os.path.basename(library)))
            except:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, dest)

    copy_ignore_func = None
    if common.is_windows_platform():
        copy_ignore_func = copy_ignore_patterns_helper

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(install_dir, 'bin', 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            common.copytree(pluginPath, target, ignore=copy_ignore_func, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(install_dir, 'bin', 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            common.copytree(import_path, target, ignore=copy_ignore_func, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(install_dir, 'bin', 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        common.copytree(qt_qml_dir, target, ignore=copy_ignore_func, symlinks=True)
Exemplo n.º 12
0
def copy_qt_libs(target_qt_prefix_path, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print library, '->', lib_dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)
Exemplo n.º 13
0
def copy_qt_libs(target_qt_prefix_path, qt_libs_dir, qt_plugin_dir, qt_import_dir, qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    if common.is_windows_platform():
        libraries = [lib for lib in libraries if not is_ignored_windows_file(debug_build, '', lib)]

    for library in libraries:
        print library, '->', lib_dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath, target, ignore=ignored_qt_lib_files, symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path, target, ignore=ignored_qt_lib_files, symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(target_qt_prefix_path, 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        print('{0} -> {1}'.format(qt_qml_dir, target))
        common.copytree(qt_qml_dir, target, ignore=ignored_qt_lib_files, symlinks=True)
Exemplo n.º 14
0
def copy_libs(target_qt_prefix_path, qt_plugin_dir, qt_import_dir, qt_qml_dir,
              plugins, imports, qmlimports, qtlibs):
    print("copying Qt libraries...")
    if common.is_windows_platform():
        lib_dest = os.path.join(target_qt_prefix_path)
    else:
        lib_dest = os.path.join(target_qt_prefix_path, 'lib')

    if not os.path.exists(lib_dest):
        os.makedirs(lib_dest)

    for library in qtlibs:
        print(library, '->', lib_dest)
        if os.path.islink(library):
            linkto = os.readlink(library)
            print("is link:", library, linkto, os.path.realpath(library))
            shutil.copy(os.path.realpath(library), lib_dest)
            try:
                os.symlink(linkto,
                           os.path.join(lib_dest, os.path.basename(library)))
            except OSError:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, lib_dest)

    print("Copying plugins:", plugins)
    for plugin in plugins:
        target = os.path.join(target_qt_prefix_path, 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            print('{0} -> {1}'.format(pluginPath, target))
            common.copytree(pluginPath,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)

    print("Copying imports:", imports)
    for qtimport in imports:
        target = os.path.join(target_qt_prefix_path, 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            print('{0} -> {1}'.format(import_path, target))
            common.copytree(import_path,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print("Copying qt quick 2 imports")
        for qmlimport in qmlimports:
            source = os.path.join(qt_qml_dir, qmlimport)
            target = os.path.join(target_qt_prefix_path, 'qml', qmlimport)
            if (os.path.exists(target)):
                shutil.rmtree(target)
            print('{0} -> {1}'.format(source, target))
            common.copytree(source,
                            target,
                            ignore=ignored_qt_lib_files,
                            symlinks=True)
Exemplo n.º 15
0
def package_qtcreator(args, paths):
    if not args.no_zip:
        if not args.no_qtcreator:
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'qtcreator' + args.zip_infix + '.7z'),
                zipPatternForApp(paths)
            ], paths.install)
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'qtcreator' + args.zip_infix + '_dev.7z'), '*'
            ], paths.dev_install)
            if args.with_debug_info:
                common.check_print_call([
                    '7z', 'a', '-mmt' + args.zip_threads,
                    os.path.join(paths.result, 'qtcreator' + args.zip_infix +
                                 '-debug.7z'), '*'
                ], paths.debug_install)
        if common.is_windows_platform():
            common.check_print_call([
                '7z', 'a', '-mmt' + args.zip_threads,
                os.path.join(paths.result,
                             'wininterrupt' + args.zip_infix + '.7z'), '*'
            ], paths.wininterrupt_install)
            if not args.no_cdb:
                common.check_print_call([
                    '7z', 'a', '-mmt' + args.zip_threads,
                    os.path.join(paths.result, 'qtcreatorcdbext' +
                                 args.zip_infix + '.7z'), '*'
                ], paths.qtcreatorcdbext_install)

    if common.is_mac_platform() and not args.no_qtcreator:
        if args.keychain_unlock_script:
            common.check_print_call([args.keychain_unlock_script],
                                    paths.install)
        if os.environ.get('SIGNING_IDENTITY'):
            signed_install_path = paths.install + '-signed'
            common.copytree(paths.install, signed_install_path, symlinks=True)
            apps = [
                d for d in os.listdir(signed_install_path)
                if d.endswith('.app')
            ]
            if apps:
                app = apps[0]
                common.codesign(os.path.join(signed_install_path, app))
                if not args.no_zip:
                    common.check_print_call([
                        '7z', 'a', '-mmt' + args.zip_threads,
                        os.path.join(
                            paths.result,
                            'qtcreator' + args.zip_infix + '-signed.7z'), app
                    ], signed_install_path)
        if not args.no_dmg:
            common.check_print_call([
                'python', '-u',
                os.path.join(paths.src, 'scripts', 'makedmg.py'),
                'qt-creator' + args.zip_infix + '.dmg', 'Qt Creator',
                paths.src, paths.install
            ], paths.result)
Exemplo n.º 16
0
def deploy_libclang(install_dir, llvm_install_dir, chrpath_bin):
    # contains pairs of (source, target directory)
    deployinfo = []
    resourcesource = os.path.join(llvm_install_dir, 'lib', 'clang')
    if common.is_windows_platform():
        clangbindirtarget = os.path.join(install_dir, 'bin', 'clang', 'bin')
        if not os.path.exists(clangbindirtarget):
            os.makedirs(clangbindirtarget)
        clanglibdirtarget = os.path.join(install_dir, 'bin', 'clang', 'lib')
        if not os.path.exists(clanglibdirtarget):
            os.makedirs(clanglibdirtarget)
        deployinfo.append(
            (os.path.join(llvm_install_dir, 'bin',
                          'libclang.dll'), os.path.join(install_dir, 'bin')))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang-cl.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clangd.exe'), clangbindirtarget))
        deployinfo.append((os.path.join(llvm_install_dir, 'bin',
                                        'clang-tidy.exe'), clangbindirtarget))
        deployinfo.append(
            (os.path.join(llvm_install_dir, 'bin',
                          'clazy-standalone.exe'), clangbindirtarget))
        resourcetarget = os.path.join(clanglibdirtarget, 'clang')
    else:
        # libclang -> Qt Creator libraries
        libsources = glob(os.path.join(llvm_install_dir, 'lib',
                                       'libclang.so*'))
        for libsource in libsources:
            deployinfo.append(
                (libsource, os.path.join(install_dir, 'lib', 'qtcreator')))
        # clang binaries -> clang libexec
        clangbinary_targetdir = os.path.join(install_dir, 'libexec',
                                             'qtcreator', 'clang', 'bin')
        if not os.path.exists(clangbinary_targetdir):
            os.makedirs(clangbinary_targetdir)
        for binary in ['clang', 'clangd', 'clang-tidy', 'clazy-standalone']:
            binary_filepath = os.path.join(llvm_install_dir, 'bin', binary)
            deployinfo.append((binary_filepath, clangbinary_targetdir))
            # add link target if binary is actually a symlink (to a binary in the same directory)
            if os.path.islink(binary_filepath):
                linktarget = os.readlink(binary_filepath)
                deployinfo.append(
                    (os.path.join(os.path.dirname(binary_filepath),
                                  linktarget),
                     os.path.join(clangbinary_targetdir, linktarget)))
        clanglibs_targetdir = os.path.join(install_dir, 'libexec', 'qtcreator',
                                           'clang', 'lib')
        # support libraries (for clazy) -> clang libexec
        if not os.path.exists(clanglibs_targetdir):
            os.makedirs(clanglibs_targetdir)
        for lib_pattern in ['ClazyPlugin.so', 'libclang-cpp.so*']:
            for lib in glob(os.path.join(llvm_install_dir, 'lib',
                                         lib_pattern)):
                deployinfo.append((lib, clanglibs_targetdir))
        resourcetarget = os.path.join(install_dir, 'libexec', 'qtcreator',
                                      'clang', 'lib', 'clang')

    print("copying libclang...")
    for source, target in deployinfo:
        print(source, '->', target)
        copyPreservingLinks(source, target)

    if common.is_linux_platform():
        # libclang was statically compiled, so there is no need for the RPATHs
        # and they are confusing when fixing RPATHs later in the process.
        # Also fix clazy-standalone RPATH.
        print("fixing Clang RPATHs...")
        for source, target in deployinfo:
            filename = os.path.basename(source)
            targetfilepath = target if not os.path.isdir(
                target) else os.path.join(target, filename)
            if filename == 'clazy-standalone':
                subprocess.check_call(
                    [chrpath_bin, '-r', '$ORIGIN/../lib', targetfilepath])
            elif not os.path.islink(target):
                targetfilepath = target if not os.path.isdir(
                    target) else os.path.join(target, os.path.basename(source))
                subprocess.check_call([chrpath_bin, '-d', targetfilepath])

    print(resourcesource, '->', resourcetarget)
    if (os.path.exists(resourcetarget)):
        shutil.rmtree(resourcetarget)
    common.copytree(resourcesource, resourcetarget, symlinks=True)
Exemplo n.º 17
0
def copy_qt_libs(install_dir, qt_libs_dir, qt_plugin_dir, qt_import_dir,
                 qt_qml_dir, plugins, imports):
    print "copying Qt libraries..."

    if common.is_windows_platform():
        libraries = glob(os.path.join(qt_libs_dir, '*.dll'))
    else:
        libraries = glob(os.path.join(qt_libs_dir, '*.so.*'))

    if common.is_windows_platform():
        dest = os.path.join(install_dir, 'bin')
    else:
        dest = os.path.join(install_dir, 'lib', 'qtcreator')

    if common.is_windows_platform():
        if debug_build:
            libraries = filter(lambda library: is_debug(library), libraries)
        else:
            libraries = filter(lambda library: not is_debug(library),
                               libraries)

    for library in libraries:
        print library, '->', dest
        if os.path.islink(library):
            linkto = os.readlink(library)
            try:
                os.symlink(linkto, os.path.join(dest,
                                                os.path.basename(library)))
            except:
                op_failed("Link already exists!")
        else:
            shutil.copy(library, dest)

    copy_ignore_func = None
    if common.is_windows_platform():
        copy_ignore_func = copy_ignore_patterns_helper

    print "Copying plugins:", plugins
    for plugin in plugins:
        target = os.path.join(install_dir, 'bin', 'plugins', plugin)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        pluginPath = os.path.join(qt_plugin_dir, plugin)
        if (os.path.exists(pluginPath)):
            common.copytree(pluginPath,
                            target,
                            ignore=copy_ignore_func,
                            symlinks=True)

    print "Copying imports:", imports
    for qtimport in imports:
        target = os.path.join(install_dir, 'bin', 'imports', qtimport)
        if (os.path.exists(target)):
            shutil.rmtree(target)
        import_path = os.path.join(qt_import_dir, qtimport)
        if os.path.exists(import_path):
            common.copytree(import_path,
                            target,
                            ignore=copy_ignore_func,
                            symlinks=True)

    if (os.path.exists(qt_qml_dir)):
        print "Copying qt quick 2 imports"
        target = os.path.join(install_dir, 'bin', 'qml')
        if (os.path.exists(target)):
            shutil.rmtree(target)
        common.copytree(qt_qml_dir,
                        target,
                        ignore=copy_ignore_func,
                        symlinks=True)