aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2020-02-19 21:02:51 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-02-21 19:34:18 +0000
commit9a84e6931d64a153b5c6f605d1d2555abf91592d (patch)
treeb53e66bcd2c9ab82cf9d570fe8247636fb0d1d14
parent8c300ef4c78e8bd759e0b6f0cabe07cb12c708e3 (diff)
Use python3 in Travis for building docs and running clang-tidy
Change-Id: I2f0d72abdf12a4e64b79bf9a3c02b32cf4cbeed6 Reviewed-by: Richard Weickelt <richard@weickelt.de> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--.travis.yml9
-rw-r--r--doc/doc.qbs11
-rwxr-xr-xdoc/fix-qmlimports.py6
-rw-r--r--docker-compose.yml2
-rw-r--r--docker/bionic/Dockerfile7
-rwxr-xr-xscripts/run-analyzer.sh5
6 files changed, 25 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index 8065c71c6..53af0534b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -95,7 +95,7 @@ jobs:
before_install:
- ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QT_VERSION} qtbase qtdeclarative qttools qtscript qtscxml
- ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QTCREATOR_VERSION} qtcreator
- - pip2 install --user beautifulsoup4 lxml
+ - pip3 install --user beautifulsoup4 lxml
script:
- ccache -s
- qbs setup-toolchains --detect
@@ -125,16 +125,15 @@ jobs:
BUILD_OPTIONS="config:release modules.cpp.compilerWrapper:clcache"
QMAKE_PATH=${QT_INSTALL_DIR}/${QT_VERSION}/msvc2017_64/bin/qmake.exe
PATH="${QT_INSTALL_DIR}/Tools/QtCreator/bin:/c/Python38:/c/Python39:/c/Python38/Scripts:/c/Python39/Scripts:${PATH}"
- WITH_DOCS=0
QBS_BUILD_PROFILE=qt
CLCACHE_DIR="${HOME}/.ccache"
before_install:
# Install Qbs and Qt
- ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QT_VERSION} --toolchain win64_msvc2017_64 qtbase qtdeclarative qttools qtscript
- ./scripts/install-qt.sh -d ${QT_INSTALL_DIR} --version ${QTCREATOR_VERSION} qtcreator
- - choco install python
- - pip install git+https://github.com/frerich/clcache.git@cae73d8255d78db8ba11e23c51fd2c9a89e7475b
- - pip install conan
+ - choco install python3
+ - pip3 install git+https://github.com/frerich/clcache.git@cae73d8255d78db8ba11e23c51fd2c9a89e7475b
+ - pip3 install conan beautifulsoup4 lxml
before_script:
- clcache -s
after_script:
diff --git a/doc/doc.qbs b/doc/doc.qbs
index 8ba331a61..8d7da8d04 100644
--- a/doc/doc.qbs
+++ b/doc/doc.qbs
@@ -1,6 +1,7 @@
import qbs 1.0
import qbs.File
import qbs.FileInfo
+import qbs.Probes
Project {
references: ["man/man.qbs"]
@@ -16,6 +17,12 @@ Project {
Depends { name: "qbsbuildconfig" }
Depends { name: "qbsversion" }
+ Probes.BinaryProbe {
+ id: pythonProbe
+ names: ["python3", "python"] // on Windows, there's no python3
+ }
+ property string _pythonExe: pythonProbe.found ? pythonProbe.filePath : undefined
+
files: [
"../README.md",
"../CONTRIBUTING.md",
@@ -59,9 +66,11 @@ Project {
outputFileTags: ["qdoc-html", "qbsdoc.dummy"] // TODO: Hack. Rule injection to the rescue?
outputArtifacts: [{filePath: "dummy", fileTags: ["qbsdoc.dummy"]}]
prepare: {
+ if (!product._pythonExe)
+ throw "Python executable was not found";
var scriptPath = explicitlyDependsOn["qbsdoc.fiximports"][0].filePath;
var htmlDir = FileInfo.path(FileInfo.path(inputs["qdoc-png"][0].filePath));
- var fixCmd = new Command("python", [scriptPath, htmlDir]);
+ var fixCmd = new Command(product._pythonExe, [scriptPath, htmlDir]);
fixCmd.description = "fixing bogus QML import statements";
return [fixCmd];
}
diff --git a/doc/fix-qmlimports.py b/doc/fix-qmlimports.py
index 93fdb437a..bb022d25b 100755
--- a/doc/fix-qmlimports.py
+++ b/doc/fix-qmlimports.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#############################################################################
##
## Copyright (C) 2017 The Qt Company Ltd.
@@ -121,7 +121,7 @@ if __name__ == '__main__':
if not (fileCount % progStep):
print('.', end='')
sys.stdout.flush()
- with open(html, 'r+') as file_:
+ with open(html, 'r+', encoding='utf8') as file_:
try:
soup = BeautifulSoup(file_, 'lxml')
actions = []
@@ -145,7 +145,7 @@ if __name__ == '__main__':
if 'lxml' in str(e):
print('(If using pip, try \"pip install lxml\")', file=sys.stderr)
quit(1)
- for k, v in modified.iteritems():
+ for k, v in modified.items():
print ('\n\t', k, 'in %d files' % v, end='')
pb = pre_blocks.get(k, 0)
if pb:
diff --git a/docker-compose.yml b/docker-compose.yml
index 18f316e7b..ea4a8c5a1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,7 +15,7 @@ services:
bionic:
<< : *linux
hostname: bionic
- image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-5.12.6_1.14.1-3
+ image: ${DOCKER_USER:-qbsbuild}/qbsdev:bionic-5.12.6_1.14.1-4
build:
dockerfile: docker/bionic/Dockerfile
context: .
diff --git a/docker/bionic/Dockerfile b/docker/bionic/Dockerfile
index 31c124e6b..0a702109c 100644
--- a/docker/bionic/Dockerfile
+++ b/docker/bionic/Dockerfile
@@ -142,7 +142,8 @@ RUN apt-get update -qq && \
protobuf-compiler \
protobuf-compiler-grpc \
psmisc \
- python-pip \
+ python3-pip \
+ python3-setuptools \
p7zip-full \
subversion \
unzip \
@@ -150,7 +151,9 @@ RUN apt-get update -qq && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100 && \
update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-8 100 && \
- pip install beautifulsoup4 lxml # for building the documentation
+ update-alternatives --install /usr/bin/python python /usr/bin/python3 100 && \
+ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 100 && \
+ pip install beautifulsoup4 lxml pyyaml
ENV LLVM_INSTALL_DIR=/usr/lib/llvm-8
diff --git a/scripts/run-analyzer.sh b/scripts/run-analyzer.sh
index 8d45cc9f5..926e3453f 100755
--- a/scripts/run-analyzer.sh
+++ b/scripts/run-analyzer.sh
@@ -93,12 +93,11 @@ qbs generate -g clangdb -f "$QBS_SRC_DIR/qbs.qbs" $BUILD_OPTIONS
SCRIPT="
import json
import os
-import sets
import sys
dbFile = sys.argv[1]
blacklist = ['json.cpp']
-seenFiles = sets.Set()
+seenFiles = set()
patched_db = []
with open(dbFile, 'r') as f:
db = json.load(f)
@@ -111,7 +110,7 @@ with open(dbFile, 'r') as f:
with open(dbFile, 'w') as f:
f.write(json.dumps(patched_db, indent=2))
"
-python -c "${SCRIPT}" analyzer/compile_commands.json
+python3 -c "${SCRIPT}" analyzer/compile_commands.json
RUN_CLANG_TIDY+=" -p analyzer -clang-tidy-binary ${CLANG_TIDY} -j ${CPU_COUNT} -header-filter=\".*qbs.*\.h$\" -quiet"
${RUN_CLANG_TIDY} 2>/dev/null | tee results.txt