Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/FindPyQt5.py
1 | # Copyright (c) 2014, Simon Edwards <simon@simonzone.com> | 1 | # Copyright (c) 2014, Simon Edwards <simon@simonzone.com> | ||
---|---|---|---|---|---|
2 | # Redistribution and use is allowed according to the terms of the BSD license. | 2 | # Redistribution and use is allowed according to the terms of the BSD license. | ||
3 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | 3 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
4 | 4 | | |||
5 | import PyQt5.Qt | 5 | import PyQt5.Qt | ||
6 | import sys | 6 | import sys | ||
7 | import os.path | 7 | import os.path | ||
8 | 8 | | |||
9 | print("pyqt_version:%06.0x" % PyQt5.Qt.PYQT_VERSION) | 9 | print("pyqt_version:%06.0x" % PyQt5.Qt.PYQT_VERSION) | ||
10 | print("pyqt_version_str:%s" % PyQt5.Qt.PYQT_VERSION_STR) | 10 | print("pyqt_version_str:%s" % PyQt5.Qt.PYQT_VERSION_STR) | ||
11 | 11 | | |||
12 | pyqt_version_tag = "" | 12 | pyqt_version_tag = "" | ||
13 | in_t = False | 13 | in_t = False | ||
14 | for item in PyQt5.Qt.PYQT_CONFIGURATION["sip_flags"].split(' '): | 14 | pyqt_config_list = PyQt5.Qt.PYQT_CONFIGURATION["sip_flags"].split(' ') | ||
15 | for item in pyqt_config_list: | ||||
15 | if item == "-t": | 16 | if item == "-t": | ||
16 | in_t = True | 17 | in_t = True | ||
17 | elif in_t: | 18 | elif in_t: | ||
18 | if item.startswith("Qt_5"): | 19 | if item.startswith("Qt_5"): | ||
19 | pyqt_version_tag = item | 20 | pyqt_version_tag = item | ||
20 | else: | 21 | else: | ||
21 | in_t = False | 22 | in_t = False | ||
22 | print("pyqt_version_tag:%s" % pyqt_version_tag) | 23 | print("pyqt_version_tag:%s" % pyqt_version_tag) | ||
23 | 24 | | |||
25 | try: | ||||
26 | index_n = pyqt_config_list.index('-n') | ||||
27 | pyqt_sip_name = '-n' + pyqt_config_list[index_n + 1] | ||||
28 | print("pyqt_sip_name:%s" % pyqt_sip_name) | ||||
29 | except ValueError: | ||||
30 | pass | ||||
31 | | ||||
24 | # FIXME This next line is just a little bit too crude. | 32 | # FIXME This next line is just a little bit too crude. | ||
25 | pyqt_sip_dir = os.path.join(sys.prefix, "share", "sip", "PyQt5") | 33 | pyqt_sip_dir = os.path.join(sys.prefix, "share", "sip", "PyQt5") | ||
26 | print("pyqt_sip_dir:%s" % pyqt_sip_dir) | 34 | print("pyqt_sip_dir:%s" % pyqt_sip_dir) | ||
27 | 35 | | |||
28 | print("pyqt_sip_flags:%s" % PyQt5.Qt.PYQT_CONFIGURATION["sip_flags"]) | 36 | print("pyqt_sip_flags:%s" % PyQt5.Qt.PYQT_CONFIGURATION["sip_flags"]) |