aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--src/tools/ivigenerator/deploy-virtualenv-files.txt147
-rw-r--r--src/tools/ivigenerator/deploy-virtualenv.bat91
-rwxr-xr-xsrc/tools/ivigenerator/deploy-virtualenv.sh83
-rw-r--r--src/tools/ivigenerator/qface_internal_build.pri16
5 files changed, 335 insertions, 3 deletions
diff --git a/.gitattributes b/.gitattributes
index 1a045fa..2b545f2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,3 +2,4 @@
.gitignore export-ignore
.gitattributes export-ignore
.commit-template export-ignore
+*.bat text eol=crlf
diff --git a/src/tools/ivigenerator/deploy-virtualenv-files.txt b/src/tools/ivigenerator/deploy-virtualenv-files.txt
new file mode 100644
index 0000000..4874cd7
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv-files.txt
@@ -0,0 +1,147 @@
+LICENSE.txt
+_*.py
+abc.py
+aifc.py
+antigravity.py
+argparse.py
+ast.py
+asynchat.py
+asyncore.py
+bdb.py
+binhex.py
+bz2.py
+cProfile.py
+calendar.py
+cgi.py
+cgitb.py
+chunk.py
+cmd.py
+code.py
+codeop.py
+colorsys.py
+compileall.py
+configparser.py
+contextlib.py
+crypt.py
+csv.py
+datetime.py
+decimal.py
+difflib.py
+dis.py
+doctest.py
+dummy_threading.py
+filecmp.py
+fileinput.py
+formatter.py
+fractions.py
+ftplib.py
+getopt.py
+getpass.py
+gettext.py
+glob.py
+gzip.py
+imaplib.py
+imghdr.py
+inspect.py
+ipaddress.py
+lzma.py
+macpath.py
+macurl2path.py
+mailbox.py
+mailcap.py
+mimetypes.py
+modulefinder.py
+netrc.py
+nntplib.py
+nturl2path.py
+numbers.py
+opcode.py
+optparse.py
+pathlib.py
+pdb.py
+pickle.py
+pickletools.py
+pipes.py
+pkgutil.py
+platform.py
+plistlib.py
+poplib.py
+pprint.py
+profile.py
+pstats.py
+pty.py
+py_compile.py
+pyclbr.py
+pydoc.py
+queue.py
+quopri.py
+runpy.py
+sched.py
+secrets.py
+selectors.py
+shelve.py
+shlex.py
+signal.py
+smtpd.py
+smtplib.py
+sndhdr.py
+socket.py
+socketserver.py
+ssl.py
+statistics.py
+string.py
+stringprep.py
+subprocess.py
+sunau.py
+symbol.py
+symtable.py
+sysconfig.py
+tabnanny.py
+telnetlib.py
+textwrap.py
+this.py
+threading.py
+timeit.py
+trace.py
+traceback.py
+tracemalloc.py
+tty.py
+turtle.py
+typing.py
+uu.py
+uuid.py
+wave.py
+webbrowser.py
+xdrlib.py
+zipapp.py
+zipfile.py
+enum.py
+asyncio
+collections
+concurrent
+config-*
+ctypes
+curses
+dbm
+distutils
+email
+encodings
+ensurepip
+html
+http
+idlelib
+importlib
+json
+lib-dynload
+lib2to3
+logging
+multiprocessing
+pydoc_data
+sqlite3
+tkinter
+turtledemo
+unittest
+urllib
+venv
+wsgiref
+xml
diff --git a/src/tools/ivigenerator/deploy-virtualenv.bat b/src/tools/ivigenerator/deploy-virtualenv.bat
new file mode 100644
index 0000000..e5e0b92
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv.bat
@@ -0,0 +1,91 @@
+@ECHO OFF
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2017 Pelagicore AG
+:: Contact: https://www.qt.io/licensing/
+::
+:: This file is part of the QtIvi module of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:GPL-EXCEPT-QTAS$
+:: Commercial License Usage
+:: Licensees holding valid commercial Qt Automotive Suite 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$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+SET SCRIPT=%~dp0
+
+IF %1%=="" (
+ call:usage
+)
+
+SET VIRTUALENV=%1%
+IF NOT EXIST %VIRTUALENV% (
+ call:usage
+)
+
+IF NOT EXIST %VIRTUALENV%\Lib (
+ call:usage
+)
+
+SET VIRTUALENV_LIB=%VIRTUALENV%\lib
+SET LIB_FOLDER=%VIRTUALENV_LIB%
+FOR %%F in (%VIRTUALENV_LIB%\python*) DO (
+ IF EXIST %%~fF (
+ SET LIB_FOLDER=%%~fF
+ SET PYTHON_VERSION=%%~nF
+ )
+)
+
+IF NOT EXIST %LIB_FOLDER%\orig-prefix.txt (
+ echo "orig-prefix.txt doesn't exist";
+ exit 1
+)
+
+SET /p ORIG_PREFIX=<%LIB_FOLDER%\orig-prefix.txt
+SET ORIG_LIB=%ORIG_PREFIX%\lib\%PYTHON_VERSION%
+IF NOT EXIST "%ORIG_LIB%" (
+ echo "%ORIG_LIB% doesn't exist"
+ exit 1
+)
+
+echo "copying files from %ORIG_LIB% to %VIRTUALENV_LIB%"
+FOR /f %%i in (%SCRIPT%\deploy-virtualenv-files.txt) DO (
+ IF EXIST "%ORIG_LIB%%%i\" (
+ IF NOT EXIST %VIRTUALENV_LIB%\%%i mkdir %VIRTUALENV_LIB%\%%i
+ xcopy %ORIG_LIB%%%i %VIRTUALENV_LIB%\%%i /E /Q /H /Y >NUL 2>&1
+ ) else (
+ xcopy %ORIG_LIB%%%i %VIRTUALENV_LIB% /H /Q /Y >NUL 2>&1
+ )
+)
+
+IF EXIST %ORIG_PREFIX%\DLLs\ (
+ IF NOT EXIST %VIRTUALENV%\DLLs mkdir %VIRTUALENV%\DLLs
+ xcopy %ORIG_PREFIX%\DLLs %VIRTUALENV%\DLLs /E /Q /H /Y >NUL 2>&1
+)
+
+echo "done"
+
+EXIT /B %ERRORLEVEL%
+
+:: Functions
+
+:usage
+echo "deploy-virtualenv.bat <virtualenv>"
+EXIT 1
+
+
diff --git a/src/tools/ivigenerator/deploy-virtualenv.sh b/src/tools/ivigenerator/deploy-virtualenv.sh
new file mode 100755
index 0000000..b86f661
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+#############################################################################
+##
+## Copyright (C) 2017 Pelagicore AG
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the QtIvi module of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT-QTAS$
+## Commercial License Usage
+## Licensees holding valid commercial Qt Automotive Suite 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 "deploy-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
+[ ! -d "$LIB_FOLDER" ] && usage
+if [[ ! -e "$LIB_FOLDER/orig-prefix.txt" ]] ; then
+ echo "orig-prefix.txt doesn't exist";
+ exit 1
+fi
+
+ORIG_PREFIX=$(<"$LIB_FOLDER"/orig-prefix.txt)
+ORIG_LIB=$ORIG_PREFIX/lib/$PYTHON_VERSION
+if [[ ! -d "$ORIG_LIB" ]] ; then
+ echo "$ORIG_LIB doesn't exist"
+ exit 1
+fi
+
+if [[ ! -e "$SCRIPT/deploy-virtualenv-files.txt" ]] ; then
+ echo "$SCRIPT/deploy-virtualenv-files.txt doesn't exist";
+ exit 1
+fi
+
+echo "copying files from $ORIG_LIB to $LIB_FOLDER"
+FILES=$(<$SCRIPT/deploy-virtualenv-files.txt)
+for file in ${FILES} ; do
+ expand_wildcard=($ORIG_LIB/$file)
+ [ ! -e "$expand_wildcard" ] && continue;
+ cp -af "$ORIG_LIB"/$file "$LIB_FOLDER/"
+done
+
+if [ "$(readlink -- "$VIRTUALENV/lib64")" != "lib" ] ; then
+ rm -f "$VIRTUALENV/lib64"
+ cd "$VIRTUALENV"
+ ln -s lib lib64
+ cd -
+fi
+
+echo "done"
diff --git a/src/tools/ivigenerator/qface_internal_build.pri b/src/tools/ivigenerator/qface_internal_build.pri
index 7c66e02..23459fc 100644
--- a/src/tools/ivigenerator/qface_internal_build.pri
+++ b/src/tools/ivigenerator/qface_internal_build.pri
@@ -15,10 +15,14 @@ VIRTUALENV_EXE = $$QMAKE_PYTHON3_LOCATION -m virtualenv
VIRTUALENV_EXE += " -p $$QMAKE_PYTHON3_LOCATION"
# Use a Python virtualenv for installing qface, so we don't pollute the user environment
+# On some systems virtualenv --always-copy doesn't work (https://github.com/pypa/virtualenv/issues/565).
+# To workaround the problem, we need to manually create the folder and create the virtualenv from
+# inside
qtivi_qface_virtualenv.target = qtivi_qface_virtualenv
qtivi_qface_virtualenv.commands = \
- $$VIRTUALENV_EXE $${qtivi_qface_virtualenv.target} $$escape_expand(\n\t) \
- $$VIRTUALENV_EXE --relocatable $${qtivi_qface_virtualenv.target} $$escape_expand(\n\t) \
+ $(MKDIR) $${qtivi_qface_virtualenv.target} $$escape_expand(\n\t) \
+ cd $${qtivi_qface_virtualenv.target} && $$VIRTUALENV_EXE --always-copy . $$escape_expand(\n\t) \
+ cd $${qtivi_qface_virtualenv.target} && $$VIRTUALENV_EXE --relocatable . $$escape_expand(\n\t) \
@echo "Set up virtualenv for qface, name: $$qtivi_qface_virtualenv.target"
QMAKE_EXTRA_TARGETS += qtivi_qface_virtualenv
@@ -43,7 +47,13 @@ win32: qtivi_qface_install.commands += @COPY /B $$shell_path($$OUT_PWD/forceRebu
else: qtivi_qface_install.commands += @touch $$OUT_PWD/forceRebuild
QMAKE_EXTRA_TARGETS += qtivi_qface_install
-PRE_TARGETDEPS += $${qtivi_qface_install.target}
+# We need to make the virtualenv first deployable
+# Otherwise it still needs some modules from the system
+unix: deploy-virtualenv.commands = $$PWD/deploy-virtualenv.sh qtivi_qface_virtualenv
+else: deploy-virtualenv.commands = $$PWD/deploy-virtualenv.bat qtivi_qface_virtualenv
+deploy-virtualenv.depends = $${qtivi_qface_install.target}
+QMAKE_EXTRA_TARGETS += deploy-virtualenv
+PRE_TARGETDEPS += deploy-virtualenv
virtualenv.files = $$OUT_PWD/qtivi_qface_virtualenv
virtualenv.path = $$[QT_HOST_BINS]/ivigenerator