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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
# Copyright (C) 2019 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
from enum import Enum
class OS(Enum):
"""Defines properties of OS types.
Enumeration names are exact matches for the platform targets reported by
the database.\n
Tuple values are as follows, with explanation:\n
[1] OS name/version pair values that are read and accepted by the blacklist.
This is what is written to BLACKLIST files.\n
[2] The family os OSs the target belongs to. This is used when checking how
many of a given OS family are currently failing.\n
[3] "canBe" list. This list describes which platforms apply to a given OS target.
This is used when determining which oses should be included under platform terms
such as "xcb"\n
[4] The general platform term used to describe the OS, such as "linux", "osx", or "windows"
"""
openSUSE_15_0 = ("opensuse-leap", "suse",
["*", "linux", "xcb", "wayland", "openwfd", "directfb", "minimal"], "linux")
openSUSE_42_3 = ("opensuse-42.3", "suse",
["*", "linux", "xcb", "wayland", "openwfd", "directfb", "minimal"], "linux")
SLES_15 = ("sles-15.0", "suse", ["*", "linux", "xcb",
"wayland", "openwfd", "directfb", "minimal"], "linux")
SLED_15 = ("sled-15.0", "suse",
["*", "linux", "xcb", "wayland", "openwfd", "minimal"], "linux")
Ubuntu_16_04 = ("ubuntu-16.04", "ubuntu", ["*", "linux", "ubuntu",
"xcb", "directfb", "wayland", "openwfd", "minimal"], "linux")
Ubuntu_18_04 = ("ubuntu-18.04", "ubuntu", ["*", "linux", "ubuntu",
"xcb", "directfb", "wayland", "openwfd", "minimal"], "linux")
RHEL_6_6 = ("rhel-6.6", "rhel", ["*", "linux", "rhel", "xcb",
"wayland", "directfb", "openwfd", "minimal"], "linux")
RHEL_7_4 = ("rhel-7.4", "rhel", ["*", "linux", "rhel", "xcb",
"wayland", "directfb", "openwfd", "minimal"], "linux")
RHEL_7_6 = ("rhel-7.6", "rhel", ["*", "linux", "rhel", "xcb",
"wayland", "directfb", "openwfd", "minimal"], "linux")
OSX_10_11 = ("osx-10.11", "osx",
["*", "osx", "cocoa", "directfb", "minimal", "offscreen"], "osx")
MacOS_10_12 = ("osx-10.12", "osx",
["*", "osx", "cocoa", "directfb", "minimal", "offscreen"], "osx")
MacOS_10_13 = ("osx-10.13", "osx",
["*", "osx", "cocoa", "directfb", "minimal", "offscreen"], "osx")
MacOS_10_14 = ("osx-10.14", "osx",
["*", "osx", "cocoa", "directfb", "minimal", "offscreen"], "osx")
Windows_7 = ("windows-7sp1", "windows-7sp1",
["*", "windows", "windows-7", "kms", "minimal", "offscreen"], "windows")
Windows_10 = ("windows-10", "windows-10",
["*", "windows", "windows-10", "kms", "minimal", "offscreen"], "windows")
WinRT_10 = ("winrt", "winrt", [
"*", "windows", "winrt", "kms", "minimal", "offscreen"], "windows")
Android_ANY = ("android", "android", [
"*", "linuxfb", "eglfs", "directfb", "openwfd", "minimal"], "android")
QEMU = ("b2qt", "b2qt", ["*", "linuxfb",
"eglfs", "directfb", "minimal"], "b2qt")
def __init__(self, normalizedValue: str, osFamily: str, canBe: list, isOfType: str):
"""Make the tuple values named so the can be retrieved with a
simple accessor like OS.RHEL_7_4.normalizedValue"""
self.normalizedValue = normalizedValue
self.osFamily = osFamily
self.canBe = canBe
self.isOfType = isOfType
@classmethod
def count(cls, typeRequested: str) -> int:
count = 0
for entry in cls:
if entry.isOfType == typeRequested or typeRequested in entry.normalizedValue:
count += 1
return count
@classmethod
def getFamily(cls, normalizedValue: str) -> str:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.osFamily
return ""
@classmethod
def getType(cls, normalizedValue: str) -> str:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.isOfType
return ""
@classmethod
def getCanBe(cls, normalizedValue: str) -> list:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.canBe
return []
@classmethod
def getFamilyMembers(cls, familyName: str) -> list:
return [entry.normalizedValue for entry in cls if (entry.osFamily == familyName or
familyName == '*')]
@classmethod
def getTypeMembers(cls, typeName: str) -> list:
return [entry.normalizedValue for entry in cls if (entry.isOfType == typeName or
typeName == '*')]
class COMPILER(Enum):
"""Mainly used when determining MSVC compilers
to blacklist."""
GCC = "gcc"
Clang = "clang"
Mingw73 = "mingw-7.3"
MSVC2015 = "msvc-2015"
MSVC2017 = "msvc-2017"
MSVC2019 = "msvc-2019"
@classmethod
def getNormalizedValue(cls, requestName: str) -> str:
for entry in cls:
if entry.name == requestName:
return entry.value
elif entry.value == requestName:
return entry.value
return ""
@classmethod
def isCompiler(cls, requestName: str) -> bool:
for entry in cls:
if requestName == entry.value:
return True
return False
class PLATFORM(Enum):
"""Defines properties of PLATFORM types.
Tuple values are as follows, with explanation:\n
[1] Platform name values that are read and accepted by the blacklist.
This is what is written to BLACKLIST files.\n
[2] "canBe" list. This list describes which platforms apply to a given OS target.
This is used when determining which oses should be included under platform terms
such as "xcb"\n
[3] Describes the base OS type if the platform itself describes some version or
distribution of an OS.\n
[4] Denotes if the platform type is a base type that cannot be whitelisted, such as linux,
windows, or osx.\n
General platform names that are acceptable in blacklists can be found at
https://doc.qt.io/qt-5/qguiapplication.html#platformName-prop
\n
The canBe values show relations so the tool can blacklist
platforms with exceptions such as "xcb !ubuntu"""
ALL = ("*", [], "", True)
ANDROID = ("android", ["eglfs", "linuxfb", "directfb",
"minimal", "offscreen", "linux", "*"], "", False)
COCOA = ("cocoa", ["osx", "directfb", "minimal",
"directfb", "offscreen", "*"], "", False)
# QSysInfo::ProductType() returns "osx" for all macOS systems,
# regardless of Apple naming convention
OSX = ("osx", ["directfb", "minimal", "directfb",
"offscreen", "*"], "osx", True)
DIRECTFB = ("directfb", ["osx", "android", "cocoa",
"qnx", "linux", "rhel", "ubuntu", "*"], "", False)
EGLFS = ("eglfs", ["android", "ios", "qnx", "windows",
"windows_10", "linux", "rhel", "ubuntu", "*"], "", False)
IOS = ("ios", ["*"], "ios", True)
KMS = ("kms", ["windows", "windows-10", "*"], "", False)
LINUXFB = ("linuxfb", ["linux", "rhel", "ubuntu",
"windows", "windows-10", "osx", "*"], "", False)
MINIMAL = ("minimal", ["linux", "rhel", "ubuntu",
"windows", "windows-10", "osx", "*"], "", False)
OFFSCREEN = ("offscreen", ["osx", "android", "cocoa", "ios", "qnx",
"windows", "windows_10", "linux", "rhel", "ubuntu", "*"], "", False)
OPENWFD = ("openwfd", ["osx", "android", "cocoa", "ios", "qnx",
"windows", "windows_10", "linux", "rhel", "ubuntu", "*"], "", False)
QNX = ("qnx", ["*"], "", True)
WINDOWS = ("windows", ["kms", "minimal", "*"], "windows", True)
WINDOWS_10 = ("windows-10", ["kms", "windows",
"minimal", "offscreen", "*"], "windows", False)
WAYLAND = ("wayland", ["linux", "rhel", "ubuntu", "*"], "", False)
XCB = ("xcb", ["linux", "rhel", "ubuntu", "*"], "", False)
LINUX = ("linux", ["*", "eglfs", "directfb", "linuxfb",
"offscreen", "minimal", "xcb"], "linux", True)
RHEL = ("rhel", ["linux", "directfb", "eglfs", "linuxfb",
"minimal", "offscreen", "openwfd", "xcb", "*"], "linux", False)
UBUNTU = ("ubuntu", ["linux", "directfb", "eglfs", "linuxfb",
"minimal", "offscreen", "openwfd", "xcb", "*"], "linux", False)
def __init__(self, normalizedValue: str, canBe: list, osFamily: str, isRootType: bool):
self.normalizedValue = normalizedValue
self.canBe = canBe
self.osFamily = osFamily
self.isRootType = isRootType
@classmethod
def getNormalizedValue(cls, requestName: str) -> str:
for entry in cls:
if entry.name == requestName:
return entry.normalizedValue
elif entry.normalizedValue == requestName:
return entry.normalizedValue
return ""
@classmethod
def getCanBe(cls, normalizedValue: str) -> list:
if normalizedValue == '*':
return [x.normalizedValue for x in cls if x.normalizedValue != '*']
else:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.canBe
return []
@classmethod
def getFamily(cls, normalizedValue: str) -> str:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.osFamily
return ""
@classmethod
def getIsRootType(cls, normalizedValue: str) -> bool:
for entry in cls:
if entry.normalizedValue == normalizedValue:
return entry.isRootType
return False
|