aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts/main.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-05 10:57:21 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-06 10:30:57 +0200
commit776789ef3ccaf4b09fcc02754c6725379ce45651 (patch)
treef34448a8053686a60faf01bedc69d7a1442e25fd /build_scripts/main.py
parent6cbcaae4ae36912a7812e9c3930bbb2434bbf736 (diff)
setup.py: Make it possible to access QtInfo from several sources
- Turn it into a singleton. - Move the qtchooser resolving code into QtInfo. - Delay-initialize the dictionary. Task-number: PYSIDE-807 Change-Id: I3be2f3d0e0e9bc8aa61e1ec90ea37f7078c7f0bb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'build_scripts/main.py')
-rw-r--r--build_scripts/main.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index cec822d7c..84f839b78 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -180,23 +180,13 @@ if OPTION["QMAKE"] is not None and os.path.exists(OPTION["QMAKE"]):
if OPTION["CMAKE"] is not None and os.path.exists(OPTION["CMAKE"]):
OPTION["CMAKE"] = os.path.abspath(OPTION["CMAKE"])
-QMAKE_COMMAND = None
-# Checking whether qmake executable exists
-if OPTION["QMAKE"] is not None and os.path.exists(OPTION["QMAKE"]):
- # Looking whether qmake path is a link and whether the link exists
- if os.path.islink(OPTION["QMAKE"]) and os.path.lexists(OPTION["QMAKE"]):
- # Set -qt=X here.
- if "qtchooser" in os.readlink(OPTION["QMAKE"]):
- QMAKE_COMMAND = [OPTION["QMAKE"], "-qt={}".format(OPTION["QT_VERSION"])]
-if not QMAKE_COMMAND:
- QMAKE_COMMAND = [OPTION["QMAKE"]]
-
-if len(QMAKE_COMMAND) == 0 or QMAKE_COMMAND[0] is None:
+if len(OPTION["QMAKE"]) == 0:
print("qmake could not be found.")
sys.exit(1)
-if not os.path.exists(QMAKE_COMMAND[0]):
- print("'{}' does not exist.".format(QMAKE_COMMAND[0]))
+if not os.path.exists(OPTION["QMAKE"]):
+ print("'{}' does not exist.".format(OPTION["QMAKE"]))
sys.exit(1)
+
if OPTION["CMAKE"] is None:
OPTION["CMAKE"] = find_executable("cmake")
@@ -289,7 +279,8 @@ def prepare_sub_modules():
# Single global instance of QtInfo to be used later in multiple code
# paths.
-qtinfo = QtInfo(QMAKE_COMMAND)
+qtinfo = QtInfo()
+qtinfo.setup(OPTION["QMAKE"], OPTION["QT_VERSION"])
def get_qt_version():