| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
import re |
| 8 |
import sys |
| 9 |
import os |
| 10 |
import sysconfig |
| 11 |
|
| 12 |
try: |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
for path in os.environ['PYTHONDLLPATH'].split(';'): |
| 18 |
os.add_dll_directory(path) |
| 19 |
except: |
| 20 |
pass |
| 21 |
|
| 22 |
import PyQt5.QtCore |
| 23 |
|
| 24 |
print("pyqt_version:%06.0x" % PyQt5.QtCore.PYQT_VERSION) |
| 25 |
print("pyqt_version_str:%s" % PyQt5.QtCore.PYQT_VERSION_STR) |
| 26 |
|
| 27 |
pyqt_version_tag = "" |
| 28 |
in_t = False |
| 29 |
pyqt_config_list = PyQt5.QtCore.PYQT_CONFIGURATION["sip_flags"].split(' ') |
| 30 |
for item in pyqt_config_list: |
| 31 |
if item == "-t": |
| 32 |
in_t = True |
| 33 |
elif in_t: |
| 34 |
if item.startswith("Qt_5"): |
| 35 |
pyqt_version_tag = item |
| 36 |
else: |
| 37 |
in_t = False |
| 38 |
print("pyqt_version_tag:%s" % pyqt_version_tag) |
| 39 |
|
| 40 |
try: |
| 41 |
index_n = pyqt_config_list.index('-n') |
| 42 |
pyqt_sip_name = pyqt_config_list[index_n + 1] |
| 43 |
print("pyqt_sip_name:%s" % pyqt_sip_name) |
| 44 |
except ValueError: |
| 45 |
pass |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
pyqt5_dir = os.path.dirname(PyQt5.__file__) |
| 50 |
lib_site_packages = sysconfig.get_path('platlib') |
| 51 |
|
| 52 |
if pyqt5_dir.startswith(lib_site_packages): |
| 53 |
pyqt_sip_dir = os.path.join(sysconfig.get_path('platlib'), "PyQt5", "bindings") |
| 54 |
else: |
| 55 |
|
| 56 |
pyqt_sip_dir = os.path.join(pyqt5_dir, "bindings") |
| 57 |
|
| 58 |
if not os.path.exists(pyqt_sip_dir): |
| 59 |
pyqt_sip_dir = os.path.join(sys.prefix, "share", "sip", "PyQt5") |
| 60 |
print("pyqt_sip_dir:%s" % pyqt_sip_dir) |
| 61 |
|
| 62 |
print("pyqt_sip_flags:%s" % PyQt5.QtCore.PYQT_CONFIGURATION["sip_flags"]) |
| 63 |
|
| 64 |
tags = re.findall(r"-t ([^\s]+)", PyQt5.QtCore.PYQT_CONFIGURATION["sip_flags"]) |
| 65 |
print("pyqt_sip_tags:%s" % ",".join(tags)) |