From d268fcb2ee2867b5a1323c480ce08a67551263df Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Sun, 7 Mar 2021 17:43:16 -0500 Subject: [PATCH] Added support for QT6 Be warned, support for QT6 remain untested. Fixed up build.py to be forgiving if some lib files are missing. Removed the use of QRegExp since it has been deprecated. --- build.py | 40 +++++++++++++++++++++++++++----------- docs/README.md | 4 +++- src/cmd_objs/bookmarks.cpp | 4 ++-- src/common.cpp | 2 +- src/common.h | 6 ++---- src/gen_file.cpp | 8 ++++---- src/session.h | 1 - 7 files changed, 41 insertions(+), 24 deletions(-) diff --git a/build.py b/build.py index fde8650..c5e37f6 100644 --- a/build.py +++ b/build.py @@ -109,21 +109,27 @@ def verbose_copy(src, dst): print("cpy: " + src + " --> " + dst) if os.path.isdir(src): - files = os.listdir(src) - - for file in files: - tree_src = src + os.path.sep + file - tree_dst = dst + os.path.sep + file + if os.path.exists(dst) and os.path.isdir(dst): + shutil.rmtree(dst) - if os.path.isdir(tree_src): - if not os.path.exists(tree_dst): - os.makedirs(tree_dst) + try: + # ignore errors thrown by shutil.copytree() + # it's likely not actually failing to copy + # the directory but still throws errors if + # it fails to apply the same file stats as + # the source. this type of errors can be + # ignored. + shutil.copytree(src, dst) - verbose_copy(tree_src, tree_dst) - - else: + except: + pass + + elif os.path.exists(src): shutil.copyfile(src, dst) + else: + print("wrn: " + src + " does not exists. skipping.") + def linux_build_app_dir(app_ver, app_name, app_target, qt_bin): if not os.path.exists("app_dir/linux/platforms"): os.makedirs("app_dir/linux/platforms") @@ -169,10 +175,14 @@ def linux_build_app_dir(app_ver, app_name, app_target, qt_bin): if "/usr/lib/x86_64-linux-gnu/qt5/bin" == qt_bin: verbose_copy(qt_bin + "/../../libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5") verbose_copy(qt_bin + "/../../libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5") + verbose_copy(qt_bin + "/../../libQt6DBus.so.6", "app_dir/linux/lib/libQt6DBus.so.6") + verbose_copy(qt_bin + "/../../libQt6XcbQpa.so.6", "app_dir/linux/lib/libQt6XcbQpa.so.6") else: verbose_copy(qt_bin + "/../lib/libQt5DBus.so.5", "app_dir/linux/lib/libQt5DBus.so.5") verbose_copy(qt_bin + "/../lib/libQt5XcbQpa.so.5", "app_dir/linux/lib/libQt5XcbQpa.so.5") + verbose_copy(qt_bin + "/../lib/libQt6DBus.so.6", "app_dir/linux/lib/libQt6DBus.so.6") + verbose_copy(qt_bin + "/../lib/libQt6XcbQpa.so.6", "app_dir/linux/lib/libQt5XcbQpa.so.6") verbose_copy("templates/linux_run_script.sh", "app_dir/linux/" + app_target + ".sh") verbose_copy("templates/linux_uninstall.sh", "app_dir/linux/uninstall.sh") @@ -253,6 +263,14 @@ def main(): else: cd() + if platform.system() == "Linux": + if os.path.exists("build/linux"): + shutil.rmtree("build/linux") + + elif platform.system() == "Windows": + if os.path.exists("build/windows"): + shutil.rmtree("build/windows") + result = subprocess.run([qt_bin + os.sep + "qmake", "-config", "release"]) if result.returncode == 0: diff --git a/docs/README.md b/docs/README.md index 64e6945..11443c1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -94,6 +94,8 @@ For Linux you need the following packages to successfully build/install: ``` qtbase5-dev libssl-dev +libgl1-mesa-dev +libxcb1-dev gcc make python3 @@ -118,4 +120,4 @@ while running the install script, it will ask you to input 1 of 3 options: ***exit*** - Cancel the installation. --local or -installer can be passed as command line options for install.py to explicitly select one of the above options without pausing for user input. \ No newline at end of file +-local or -installer can be passed as command line options for install.py to explicitly select one of the above options without pausing for user input. diff --git a/src/cmd_objs/bookmarks.cpp b/src/cmd_objs/bookmarks.cpp index b98c3d8..c4ab20e 100644 --- a/src/cmd_objs/bookmarks.cpp +++ b/src/cmd_objs/bookmarks.cpp @@ -111,12 +111,12 @@ void SaveBookmark::dataIn(const QString &argsLine) { if (activeHook()) { - if (QRegExp("y", Qt::CaseInsensitive).exactMatch(argsLine)) + if ("y" == argsLine.toLower()) { run(baseName, baseArgs); term(); } - else if (QRegExp("n", Qt::CaseInsensitive).exactMatch(argsLine)) + else if ("n" == argsLine.toLower()) { term(); } diff --git a/src/common.cpp b/src/common.cpp index caefc18..7f63bf3 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -350,7 +350,7 @@ QString getParam(const QString &key, const QStringList &args) QString ret; - int pos = args.indexOf(QRegExp(key, Qt::CaseInsensitive)); + int pos = args.indexOf(QRegularExpression(key, QRegularExpression::CaseInsensitiveOption)); if (pos != -1) { diff --git a/src/common.h b/src/common.h index 263c389..7d26f41 100644 --- a/src/common.h +++ b/src/common.h @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -59,8 +58,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -75,7 +73,7 @@ #define CONFIG_FILENAME "config_v3.json" #define APP_NAME "Cmdr" #define APP_TARGET "cmdr" -#define APP_VERSION "3.4" +#define APP_VERSION "3.5" enum TypeID : quint8 { diff --git a/src/gen_file.cpp b/src/gen_file.cpp index ac1b53e..fbd6b86 100644 --- a/src/gen_file.cpp +++ b/src/gen_file.cpp @@ -259,8 +259,8 @@ void Genfile::setGenfileType(quint8 typeId) QByteArray Genfile::autoFill(const QByteArray &data) { - QStringList args = parseArgs(data, -1); - int ind = args.indexOf(QRegExp("-len", Qt::CaseInsensitive)); + auto args = parseArgs(data, -1); + auto ind = args.indexOf(QRegularExpression("-len", QRegularExpression::CaseInsensitiveOption)); if (ind == -1) { @@ -374,7 +374,7 @@ void Genfile::dataIn(const QByteArray &data) { auto ans = QString(data); - if (QRegExp("y", Qt::CaseInsensitive).exactMatch(ans)) + if ("y" == ans.toLower()) { emit unsetUserIO(GEN_HOOK); @@ -382,7 +382,7 @@ void Genfile::dataIn(const QByteArray &data) setupForWriting(); } - else if (QRegExp("n", Qt::CaseInsensitive).exactMatch(ans)) + else if ("n" == ans.toLower()) { finished(); } diff --git a/src/session.h b/src/session.h index f2f8386..ca555f6 100644 --- a/src/session.h +++ b/src/session.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include