From fca48bce00940f2aff54b6f8543649dbaf4f2dee Mon Sep 17 00:00:00 2001 From: Dominik Holland Date: Fri, 2 Jun 2017 16:52:05 +0200 Subject: ivigenerator: virtualenv fixes for windows and refactoring Inside the virtualenv we only need to call 'python' and 'pip'. There is no need to add a suffix on windows or use the full path. Removed the check for pip in PATH as we only need to have it packaged in the virtualenv, so we are just checking whether the module works in the python installation and hope it also works in the created virtualenv. Added more clear errors in case python is not found or the submodules are not cloned. Change-Id: If6473785edc4e57c9eb62934cc18daf692b04476 Reviewed-by: Robert Griebl --- mkspecs/features/ivigenerator.prf | 2 +- src/tools/ivigenerator/qface_internal_build.pri | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mkspecs/features/ivigenerator.prf b/mkspecs/features/ivigenerator.prf index 487dcbe..fcbd729 100644 --- a/mkspecs/features/ivigenerator.prf +++ b/mkspecs/features/ivigenerator.prf @@ -31,7 +31,7 @@ else: IVI_GENERATOR_PATH = $$QTIVI_ROOT/src/tools/ivigenerator win32: VIRTUALENV_ACTIVATION = $$VIRTUALENV_PATH/Scripts/activate && else: VIRTUALENV_ACTIVATION = . $$VIRTUALENV_PATH/bin/activate && -IVI_GENERATOR = $$VIRTUALENV_ACTIVATION python3 $$IVI_GENERATOR_PATH/generate.py +IVI_GENERATOR = $$VIRTUALENV_ACTIVATION python $$IVI_GENERATOR_PATH/generate.py # TODO make this work with multiple input files, or only support one QFACE_SOURCE qface_sources.output = $$QFACE_OUTPUT_DIR/$${QFACE_MODULE_NAME}.pri diff --git a/src/tools/ivigenerator/qface_internal_build.pri b/src/tools/ivigenerator/qface_internal_build.pri index 699d2eb..35e6455 100644 --- a/src/tools/ivigenerator/qface_internal_build.pri +++ b/src/tools/ivigenerator/qface_internal_build.pri @@ -5,6 +5,8 @@ debug_and_release:build_pass:CONFIG(release, debug|release) { return(); } +!exists($$QFACE_SOURCE_DIR): error("Couldn't find $$QFACE_SOURCE_DIR: Please make sure all submodules are initialized") + message("Checking for a valid python & pip installation") PYTHON3_PATH = $$(PYTHON3_PATH) @@ -21,17 +23,13 @@ for (python3_exe, PYTHON3_NAMES) { } isEmpty(PYTHON3_EXE) { - error("You need to have python (Python version >=3.x) in your PATH to install qface.") + error("Didn't find a valid python3 installation in PATH or PYTHON3_PATH $$escape_expand(\n)Please make sure it is setup accordingly.") } -PIP3_PATH = $$(PIP3_PATH) -PIP3_EXE = "pip3" # even normal Python installs on Windows use 'pip3' -!isEmpty(PIP3_PATH): PIP3_EXE = $$shell_path($$PIP3_PATH/$$PIP3_EXE) -win32: PIP3_EXE = $${PIP3_EXE}.exe -message("Checking for pip executable: $$PIP3_EXE") -pip_version = $$system("$$PIP3_EXE --version") +message("Checking for pip installation") +pip_version = $$system("$$PYTHON3_EXE -m pip --version") isEmpty(pip_version) { - error("You need to have $${PIP3_EXE} (Python version >=3.x) in your PATH to install qface") + error("Didn't find pip with your python installation at: $$PYTHON3_EXE $$escape_expand(\n)Please make sure it is installed.") } VIRTUALENV_EXE = "$$PYTHON3_EXE -m virtualenv" @@ -60,8 +58,8 @@ qtivi_qface_install.depends = qtivi_qface_virtualenv qtivi_qface_install.depends += $$QFACE_SOURCE_DIR/setup.py qtivi_qface_install.depends += $$QFACE_SOURCE_DIR/requirements.txt qtivi_qface_install.commands = $$VIRTUALENV_ACTIVATION \ - $$PIP3_EXE install -e $$QFACE_SOURCE_DIR $$escape_expand(\n\t) \ - @echo "Installed qface development version into qtivi_qface_install.target" $$escape_expand(\n\t) + pip3 install -e $$QFACE_SOURCE_DIR $$escape_expand(\n\t) \ + @echo "Installed qface development version into qtivi_qface_virtualenv" $$escape_expand(\n\t) win32: qtivi_qface_install.commands += @COPY /B $$shell_path($$OUT_PWD/forceRebuild)+,, $$shell_path($$OUT_PWD/forceRebuild) else: qtivi_qface_install.commands += @touch $$OUT_PWD/forceRebuild QMAKE_EXTRA_TARGETS += qtivi_qface_install -- cgit v1.2.1