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