diff options
author | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-02-19 21:02:51 +0100 |
---|---|---|
committer | Ivan Komissarov <ABBAPOH@gmail.com> | 2020-02-21 19:34:18 +0000 |
commit | 9a84e6931d64a153b5c6f605d1d2555abf91592d (patch) | |
tree | b53e66bcd2c9ab82cf9d570fe8247636fb0d1d14 /doc | |
parent | 8c300ef4c78e8bd759e0b6f0cabe07cb12c708e3 (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>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/doc.qbs | 11 | ||||
-rwxr-xr-x | doc/fix-qmlimports.py | 6 |
2 files changed, 13 insertions, 4 deletions
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: |