summaryrefslogtreecommitdiff
path: root/repo/qt5-qtwebengine/support-python3.patch
blob: cc5e457e1c18543f5bf2c58beb0e08a6a357e15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
diff -upr a/configure.pri b/configure.pri
--- a/configure.pri	2022-01-21 11:47:42.000000000 +0100
+++ b/configure.pri	2022-03-08 18:45:03.650823421 +0100
@@ -7,20 +7,7 @@ QTWEBENGINE_SOURCE_TREE = $$PWD
 equals(QMAKE_HOST.os, Windows): EXE_SUFFIX = .exe
 
 defineTest(isPythonVersionSupported) {
-    python = $$system_quote($$system_path($$1))
-    python_version = $$system('$$python -c "import sys; print(sys.version_info[0:3])"')
-    python_version ~= s/[()]//g
-    python_version = $$split(python_version, ',')
-    python_major_version = $$first(python_version)
-    greaterThan(python_major_version, 2) {
-        qtLog("Python version 3 is not supported by Chromium.")
-        return(false)
-    }
-    python_minor_version = $$member(python_version, 1)
-    python_patch_version = $$member(python_version, 2)
-    greaterThan(python_major_version, 1): greaterThan(python_minor_version, 6): greaterThan(python_patch_version, 4): return(true)
-    qtLog("Unsupported python version: $${python_major_version}.$${python_minor_version}.$${python_patch_version}.")
-    return(false)
+    return(true)
 }
 
 defineTest(qtConfTest_detectJumboBuild) {
@@ -52,22 +39,22 @@ defineTest(qtConfReport_jumboBuild) {
     qtConfReportPadded($${1}, $$mergeLimit)
 }
 
-defineTest(qtConfTest_detectPython2) {
-    python = $$qtConfFindInPath("python2$$EXE_SUFFIX")
+defineTest(qtConfTest_detectPython) {
+    python = $$qtConfFindInPath("python3$$EXE_SUFFIX")
     isEmpty(python) {
-        qtLog("'python2$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
+        qtLog("'python3$$EXE_SUFFIX' not found in PATH. Checking for 'python$$EXE_SUFFIX'.")
         python = $$qtConfFindInPath("python$$EXE_SUFFIX")
     }
     isEmpty(python) {
-        qtLog("'python$$EXE_SUFFIX' not found in PATH. Giving up.")
+        qtLog("'python3$$EXE_SUFFIX' and 'python$$EXE_SUFFIX' not found in PATH. Giving up.")
         return(false)
     }
     !isPythonVersionSupported($$python) {
-        qtLog("A suitable Python 2 executable could not be located.")
+        qtLog("A suitable Python executable could not be located.")
         return(false)
     }
 
-    # Make tests.python2.location available in configure.json.
+    # Make tests.python.location available in configure.json.
     $${1}.location = $$clean_path($$python)
     export($${1}.location)
     $${1}.cache += location
diff -upr a/mkspecs/features/functions.prf b/mkspecs/features/functions.prf
--- a/mkspecs/features/functions.prf	2022-01-21 11:47:42.000000000 +0100
+++ b/mkspecs/features/functions.prf	2022-03-08 18:45:34.740851611 +0100
@@ -39,11 +39,11 @@ defineReplace(which) {
 
 # Returns the unquoted path to the python executable.
 defineReplace(pythonPath) {
-    isEmpty(QMAKE_PYTHON2) {
+    isEmpty(QMAKE_PYTHON) {
         # Fallback for building QtWebEngine with Qt < 5.8
-        QMAKE_PYTHON2 = python
+        QMAKE_PYTHON = python3
     }
-    return($$QMAKE_PYTHON2)
+    return($$QMAKE_PYTHON)
 }
 
 # Returns the python executable for use with shell / make targets.
diff -upr a/src/buildtools/config/support.pri b/src/buildtools/config/support.pri
--- a/src/buildtools/config/support.pri	2022-01-21 11:47:42.000000000 +0100
+++ b/src/buildtools/config/support.pri	2022-03-08 18:44:25.677455634 +0100
@@ -21,7 +21,7 @@ defineReplace(qtwebengine_checkWebEngine
     !qtwebengine_checkForGperf(QtWebEngine):return(false)
     !qtwebengine_checkForBison(QtWebEngine):return(false)
     !qtwebengine_checkForFlex(QtWebEngine):return(false)
-    !qtwebengine_checkForPython2(QtWebEngine):return(false)
+    !qtwebengine_checkForPython(QtWebEngine):return(false)
     !qtwebengine_checkForNodejs(QtWebEngine):return(false)
     !qtwebengine_checkForSanitizer(QtWebEngine):return(false)
     linux:!qtwebengine_checkForPkgCfg(QtWebEngine):return(false)
@@ -51,7 +51,7 @@ defineReplace(qtwebengine_checkPdfError)
     !qtwebengine_checkForGperf(QtPdf):return(false)
     !qtwebengine_checkForBison(QtPdf):return(false)
     !qtwebengine_checkForFlex(QtPdf):return(false)
-    !qtwebengine_checkForPython2(QtPdf):return(false)
+    !qtwebengine_checkForPython(QtPdf):return(false)
     !qtwebengine_checkForSanitizer(QtPdf):return(false)
     linux:!qtwebengine_checkForPkgCfg(QtPdf):return(false)
     linux:!qtwebengine_checkForHostPkgCfg(QtPdf):return(false)
@@ -147,10 +147,10 @@ defineTest(qtwebengine_checkForFlex) {
     return(true)
 }
 
-defineTest(qtwebengine_checkForPython2) {
+defineTest(qtwebengine_checkForPython) {
     module = $$1
-    !qtConfig(webengine-python2) {
-        qtwebengine_skipBuild("Python version 2 (2.7.5 or later) is required to build $${module}.")
+    !qtConfig(webengine-python) {
+        qtwebengine_skipBuild("Python is required to build $${module}.")
         return(false)
     }
     return(true)
diff -upr a/src/buildtools/configure.json b/src/buildtools/configure.json
--- a/src/buildtools/configure.json	2022-01-21 11:47:42.000000000 +0100
+++ b/src/buildtools/configure.json	2022-03-08 18:44:25.677455634 +0100
@@ -295,9 +295,9 @@
             "label": "system ninja",
             "type": "detectNinja"
         },
-        "webengine-python2": {
-            "label": "python2",
-            "type": "detectPython2",
+        "webengine-python": {
+            "label": "python",
+            "type": "detectPython",
             "log": "location"
         },
         "webengine-winversion": {
@@ -374,7 +374,7 @@
                          && features.webengine-gperf
                          && features.webengine-bison
                          && features.webengine-flex
-                         && features.webengine-python2
+                         && features.webengine-python
                          && features.webengine-nodejs
                          && (!config.sanitizer || features.webengine-sanitizer)
                          && (!config.linux || features.pkg-config)
@@ -400,7 +400,7 @@
                          && features.webengine-gperf
                          && features.webengine-bison
                          && features.webengine-flex
-                         && features.webengine-python2
+                         && features.webengine-python
                          && (!config.sanitizer || features.webengine-sanitizer)
                          && (!config.linux || features.pkg-config)
                          && (!config.linux || features.webengine-host-pkg-config)
@@ -423,12 +423,12 @@
             "autoDetect": "features.private_tests",
             "output": [ "privateFeature" ]
         },
-        "webengine-python2": {
-            "label": "python2",
-            "condition": "tests.webengine-python2",
+        "webengine-python": {
+            "label": "python",
+            "condition": "tests.webengine-python",
             "output": [
                 "privateFeature",
-                { "type": "varAssign", "name": "QMAKE_PYTHON2", "value": "tests.webengine-python2.location" }
+                { "type": "varAssign", "name": "QMAKE_PYTHON", "value": "tests.webengine-python.location" }
             ]
         },
         "webengine-gperf": {