rcc: Remove support for Python2
Qt for Python only supports Python3. Change-Id: I7b13b1f9482579b1e1128d15ee5734d063a7c4b8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
This commit is contained in:
parent
0e96e1fb75
commit
3fb039ca23
@ -267,14 +267,16 @@ int runRcc(int argc, char *argv[])
|
||||
library.setFormat(RCCResourceLibrary::Binary);
|
||||
if (parser.isSet(generatorOption)) {
|
||||
auto value = parser.value(generatorOption);
|
||||
if (value == QLatin1String("cpp"))
|
||||
if (value == QLatin1String("cpp")) {
|
||||
library.setFormat(RCCResourceLibrary::C_Code);
|
||||
else if (value == QLatin1String("python"))
|
||||
library.setFormat(RCCResourceLibrary::Python3_Code);
|
||||
else if (value == QLatin1String("python2"))
|
||||
library.setFormat(RCCResourceLibrary::Python2_Code);
|
||||
else
|
||||
} else if (value == QLatin1String("python")) {
|
||||
library.setFormat(RCCResourceLibrary::Python_Code);
|
||||
} else if (value == QLatin1String("python2")) { // ### fixme Qt 7: remove
|
||||
qWarning("Format python2 is no longer supported, defaulting to python.");
|
||||
library.setFormat(RCCResourceLibrary::Python_Code);
|
||||
} else {
|
||||
errorMsg = QLatin1String("Invalid generator: ") + value;
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.isSet(passOption)) {
|
||||
@ -338,8 +340,7 @@ int runRcc(int argc, char *argv[])
|
||||
switch (library.format()) {
|
||||
case RCCResourceLibrary::C_Code:
|
||||
case RCCResourceLibrary::Pass1:
|
||||
case RCCResourceLibrary::Python3_Code:
|
||||
case RCCResourceLibrary::Python2_Code:
|
||||
case RCCResourceLibrary::Python_Code:
|
||||
mode = QIODevice::WriteOnly | QIODevice::Text;
|
||||
break;
|
||||
case RCCResourceLibrary::Pass2:
|
||||
|
@ -177,8 +177,7 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
|
||||
{
|
||||
const bool text = lib.m_format == RCCResourceLibrary::C_Code;
|
||||
const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python3_Code
|
||||
|| lib.m_format == RCCResourceLibrary::Python2_Code;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
|
||||
//some info
|
||||
if (text || pass1) {
|
||||
if (m_language != QLocale::C) {
|
||||
@ -253,8 +252,7 @@ qint64 RCCFileInfo::writeDataBlob(RCCResourceLibrary &lib, qint64 offset,
|
||||
const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
|
||||
const bool pass2 = lib.m_format == RCCResourceLibrary::Pass2;
|
||||
const bool binary = lib.m_format == RCCResourceLibrary::Binary;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python3_Code
|
||||
|| lib.m_format == RCCResourceLibrary::Python2_Code;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
|
||||
|
||||
//capture the offset
|
||||
m_dataOffset = offset;
|
||||
@ -391,8 +389,7 @@ qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset)
|
||||
{
|
||||
const bool text = lib.m_format == RCCResourceLibrary::C_Code;
|
||||
const bool pass1 = lib.m_format == RCCResourceLibrary::Pass1;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python3_Code
|
||||
|| lib.m_format == RCCResourceLibrary::Python2_Code;
|
||||
const bool python = lib.m_format == RCCResourceLibrary::Python_Code;
|
||||
|
||||
// capture the offset
|
||||
m_nameOffset = offset;
|
||||
@ -1003,8 +1000,7 @@ inline void RCCResourceLibrary::write2HexDigits(quint8 number)
|
||||
void RCCResourceLibrary::writeHex(quint8 tmp)
|
||||
{
|
||||
switch (m_format) {
|
||||
case RCCResourceLibrary::Python3_Code:
|
||||
case RCCResourceLibrary::Python2_Code:
|
||||
case RCCResourceLibrary::Python_Code:
|
||||
if (tmp >= 32 && tmp < 127 && tmp != '"' && tmp != '\\') {
|
||||
writeChar(char(tmp));
|
||||
} else {
|
||||
@ -1102,11 +1098,8 @@ bool RCCResourceLibrary::writeHeader()
|
||||
writeString("** WARNING! All changes made in this file will be lost!\n");
|
||||
writeString( "*****************************************************************************/\n\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python2_Code:
|
||||
writeString("# Resource object code (Python ");
|
||||
writeChar(m_format == Python3_Code ? '3' : '2');
|
||||
writeString(")\n");
|
||||
case Python_Code:
|
||||
writeString("# Resource object code (Python 3)\n");
|
||||
writeString("# Created by: object code\n");
|
||||
writeString("# Created by: The Resource Compiler for Qt version ");
|
||||
writeByteArray(QT_VERSION_STR);
|
||||
@ -1138,12 +1131,9 @@ bool RCCResourceLibrary::writeDataBlobs()
|
||||
case C_Code:
|
||||
writeString("static const unsigned char qt_resource_data[] = {\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python_Code:
|
||||
writeString("qt_resource_data = b\"\\\n");
|
||||
break;
|
||||
case Python2_Code:
|
||||
writeString("qt_resource_data = \"\\\n");
|
||||
break;
|
||||
case Binary:
|
||||
m_dataOffset = m_out.size();
|
||||
break;
|
||||
@ -1177,8 +1167,7 @@ bool RCCResourceLibrary::writeDataBlobs()
|
||||
case C_Code:
|
||||
writeString("\n};\n\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python2_Code:
|
||||
case Python_Code:
|
||||
writeString("\"\n\n");
|
||||
break;
|
||||
case Pass1:
|
||||
@ -1201,12 +1190,9 @@ bool RCCResourceLibrary::writeDataNames()
|
||||
case Pass1:
|
||||
writeString("static const unsigned char qt_resource_name[] = {\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python_Code:
|
||||
writeString("qt_resource_name = b\"\\\n");
|
||||
break;
|
||||
case Python2_Code:
|
||||
writeString("qt_resource_name = \"\\\n");
|
||||
break;
|
||||
case Binary:
|
||||
m_namesOffset = m_out.size();
|
||||
break;
|
||||
@ -1241,8 +1227,7 @@ bool RCCResourceLibrary::writeDataNames()
|
||||
case Pass1:
|
||||
writeString("\n};\n\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python2_Code:
|
||||
case Python_Code:
|
||||
writeString("\"\n\n");
|
||||
break;
|
||||
default:
|
||||
@ -1267,12 +1252,9 @@ bool RCCResourceLibrary::writeDataStructure()
|
||||
case Pass1:
|
||||
writeString("static const unsigned char qt_resource_struct[] = {\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python_Code:
|
||||
writeString("qt_resource_struct = b\"\\\n");
|
||||
break;
|
||||
case Python2_Code:
|
||||
writeString("qt_resource_struct = \"\\\n");
|
||||
break;
|
||||
case Binary:
|
||||
m_treeOffset = m_out.size();
|
||||
break;
|
||||
@ -1328,8 +1310,7 @@ bool RCCResourceLibrary::writeDataStructure()
|
||||
case Pass1:
|
||||
writeString("\n};\n\n");
|
||||
break;
|
||||
case Python3_Code:
|
||||
case Python2_Code:
|
||||
case Python_Code:
|
||||
writeString("\"\n\n");
|
||||
break;
|
||||
default:
|
||||
@ -1540,7 +1521,7 @@ bool RCCResourceLibrary::writeInitializer()
|
||||
p[i++] = (m_overallFlags >> 8) & 0xff;
|
||||
p[i++] = (m_overallFlags >> 0) & 0xff;
|
||||
}
|
||||
} else if (m_format == Python3_Code || m_format == Python2_Code) {
|
||||
} else if (m_format == Python_Code) {
|
||||
writeString("def qInitResources():\n");
|
||||
writeString(" QtCore.qRegisterResourceData(0x");
|
||||
write2HexDigits(m_formatVersion);
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
bool readFiles(bool listMode, QIODevice &errorDevice);
|
||||
|
||||
enum Format { Binary, C_Code, Pass1, Pass2, Python3_Code, Python2_Code };
|
||||
enum Format { Binary, C_Code, Pass1, Pass2, Python_Code };
|
||||
void setFormat(Format f) { m_format = f; }
|
||||
Format format() const { return m_format; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user