summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-12-02 10:59:13 +0100
committerLars Knoll <lars.knoll@qt.io>2021-06-07 12:57:39 +0000
commit1dc882326883b67798a60117f3d69d3cf6e3d187 (patch)
tree742c08d42e28e16ed4f7a8740bb0f21d1e26f1fe /scripts
parentcfcb7178907d3229a04ea79b528335b7dec8bdc6 (diff)
Upgrade quip-generation scripts to use python3
Scripts use docutils; Debian/testing has dropped python2 support for docutils, forcing the upgrade. Ran 2to3 and did as it told me. One print needed parentheses. Changed #! lines and quips.pro to use python3 explicitly. The docutils.core.publish_string() call was returning a bytes object, where output.write() needed a string; so set output encoding. Change-Id: I910548c7402b4bb8a22559793278dc9b5461b94d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-quip-0000.py4
-rwxr-xr-xscripts/quip2html.py9
2 files changed, 6 insertions, 7 deletions
diff --git a/scripts/gen-quip-0000.py b/scripts/gen-quip-0000.py
index d0703ce..f45743a 100755
--- a/scripts/gen-quip-0000.py
+++ b/scripts/gen-quip-0000.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 The Qt Company Ltd.
# Contact: http://www.qt.io/licensing/
@@ -83,4 +83,4 @@ details.
if __name__ == '__main__':
import sys
- print RootQuip(sys.argv[1:]).compose_body()
+ print(RootQuip(sys.argv[1:]).compose_body())
diff --git a/scripts/quip2html.py b/scripts/quip2html.py
index 19d293c..8d83a13 100755
--- a/scripts/quip2html.py
+++ b/scripts/quip2html.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2017 The Qt Company Ltd.
# Contact: http://www.qt.io/licensing/
@@ -10,9 +10,6 @@
Adapted from the python project's similar code for PEPs.
"""
-from __future__ import absolute_import, with_statement
-from __future__ import print_function
-
__docformat__ = 'reStructuredText'
import os, sys, subprocess
@@ -249,7 +246,9 @@ def main(filename, source, output, stderr):
writer_name='html4css1',
writer=QuipWriter(),
# Allow Docutils traceback if there's an exception:
- settings_overrides={'traceback': True, 'halt_level': 2}))
+ settings_overrides={'traceback': True, 'halt_level': 2,
+ # output.write needs a string:
+ 'output_encoding': 'unicode'}))
except DataError as what:
stderr.write('\n'.join(what.args) + '\nin %s\n' % filename)
return 1