diff options
| author | Dominik Holland <dominik.holland@qt.io> | 2021-10-27 12:42:38 +0200 |
|---|---|---|
| committer | Dominik Holland <dominik.holland@qt.io> | 2021-12-07 06:15:26 +0100 |
| commit | c39926232ee04ded0ebbe971aeb047b6d92ee4d8 (patch) | |
| tree | 3ef659a62d82ce142962263ea399ab2f835e965a /src/tools/ifcodegen/fix-macos-virtualenv.sh | |
| parent | 0ee4da26755fffec0beb157ddf11c8684f2f9b10 (diff) | |
The virtualenv created on an newer macoOS systems doesn't work out
of the box when copying the executables because of a broken code signature.
The signature needs to be recreated ad-hoc, but as we need to use pip3
for the package installation this needs to be done right after the
virtualenv is created.
Fixes: AUTOSUITE-1645
Change-Id: Ie79c9fb20af95abf93aed1bc7edbcd6e5f00cee4
Reviewed-by: Robert Griebl <robert.griebl@qt.io>
(cherry picked from commit f19607dc79930b0d5acebc7e894eae18f202ffbc)
Diffstat (limited to 'src/tools/ifcodegen/fix-macos-virtualenv.sh')
| -rwxr-xr-x | src/tools/ifcodegen/fix-macos-virtualenv.sh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tools/ifcodegen/fix-macos-virtualenv.sh b/src/tools/ifcodegen/fix-macos-virtualenv.sh new file mode 100755 index 00000000..6c59cc26 --- /dev/null +++ b/src/tools/ifcodegen/fix-macos-virtualenv.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +############################################################################# +## +## Copyright (C) 2021 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the QtInterfaceFramework module of the Qt Toolkit. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## 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. +## +## $QT_END_LICENSE$ +## +############################################################################# + +SCRIPT=$(dirname $0) +usage() +{ + echo "fix-macos-virtualenv.sh <virtualenv>" + exit 1 +} + +[ "$#" -lt 1 ] && usage +VIRTUALENV="${@: -1}" +[ ! -d "$VIRTUALENV" ] && usage +[ ! -d "$VIRTUALENV/lib" ] && usage +VIRTUALENV_LIB=$VIRTUALENV/lib +for file in "$VIRTUALENV_LIB"/python* ; do + if [[ -d $file ]] ; then + LIB_FOLDER=$file + PYTHON_VERSION=$(basename "$file") + break + fi +done + +if [ "$(uname)" != "Darwin" ]; then + exit 1 +fi + +mkdir bk +cp $VIRTUALENV/bin/python bk +mv -f bk/python $VIRTUALENV/bin/python +rmdir bk +codesign -s - --preserve-metadata=identifier,entitlements,flags,runtime -f $VIRTUALENV/bin/python +ln -sf python $VIRTUALENV/bin/python3 +ln -sf python $VIRTUALENV/bin/$PYTHON_VERSION |
