aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/doc.qbs11
-rwxr-xr-xdoc/fix-qmlimports.py6
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: