Commit ccd32925 authored by xuebingbing's avatar xuebingbing

1 动态更新sip config

parent 3a1c39c3
......@@ -27,21 +27,21 @@ import re
# These are installation specific values created when SIP was configured.
_pkg_config = {
'arch': '',
'default_bin_dir': 'E:\\QGIS 3.18\\apps\\Python37',
'default_mod_dir': 'E:\\QGIS 3.18\\apps\\Python37\\Lib\\site-packages',
'default_sip_dir': 'E:\\QGIS 3.18\\apps\\Python37\\sip',
'default_bin_dir': 'E:\\Geo4W64\\apps\\Python37',
'default_mod_dir': 'E:\\Geo4W64\\apps\\Python37\\Lib\\site-packages',
'default_sip_dir': 'E:\\Geo4W64\\apps\\Python37\\sip',
'deployment_target': '',
'platform': 'win32-msvc2015',
'py_conf_inc_dir': 'E:\\QGIS 3.18\\apps\\Python37\\include',
'py_inc_dir': 'E:\\QGIS 3.18\\apps\\Python37\\include',
'py_lib_dir': 'E:\\QGIS 3.18\\apps\\Python37\\libs',
'py_conf_inc_dir': 'E:\\Geo4W64\\apps\\Python37\\include',
'py_inc_dir': 'E:\\Geo4W64\\apps\\Python37\\include',
'py_lib_dir': 'E:\\Geo4W64\\apps\\Python37\\libs',
'py_version': 0x030700,
'qt_framework': 0,
'sip_bin': 'E:\\QGIS 3.18\\apps\\Python37\\Scripts\\sip',
'sip_config_args': '--destdir E:\\QGIS 3.18\\apps\\Python37\\lib\\site-packages --bindir E:\\QGIS 3.18\\apps\\Python37\\Scripts --incdir E:\\QGIS 3.18\\apps\\Python37\\include',
'sip_inc_dir': 'E:\\QGIS 3.18\\apps\\Python37\\include',
'sip_module_dir': 'E:\\QGIS 3.18\\apps\\Python37\\lib\\site-packages',
'sip_root_dir': 'E:\\QGIS 3.18\\apps\\Python37\\lib\\site-packages',
'sip_bin': 'E:\\Geo4W64\\apps\\Python37\\Scripts\\sip',
'sip_config_args': '--destdir E:\\OSGeo4W64\\apps\\Python37\\lib\\site-packages --bindir E:\\OSGeo4W64\\apps\\Python37\\Scripts --incdir E:\\OSGeo4W64\\apps\\Python37\\include',
'sip_inc_dir': 'E:\\Geo4W64\\apps\\Python37\\include',
'sip_module_dir': 'E:\\eo4W64\\apps\\Python37\\lib\\site-packages',
'sip_root_dir': 'E:\\eo4W64\\apps\\Python37\\lib\\site-packages',
'sip_version': 0x04130e,
'sip_version_str': '4.19.14',
'universal': ''
......@@ -172,6 +172,7 @@ class Configuration(object):
else:
cfg = []
self.__update_pkg_config()
cfg.append(_pkg_config)
global _config_stack
......@@ -204,6 +205,47 @@ class Configuration(object):
"""
self._macros = macros
def __update_pkg_config(self):
"""
add by xuebb
dynamic update sip config
"""
py3_sitepackages_real_path = os.path.realpath( os.path.dirname( (os.path.realpath(__file__))) )
py3_lib_real_path = os.path.realpath(os.path.dirname(py3_sitepackages_real_path))
py3_real_root_path = os.path.realpath(os.path.dirname(py3_lib_real_path))
py3_real_sip_path = os.path.join(py3_real_root_path, 'sip')
py3_real_inc_path = os.path.join(py3_real_root_path, 'include')
py3_real_libs_path = os.path.join(py3_real_root_path, 'libs')
py3_real_scripts_path = os.path.join(py3_real_root_path, 'Scripts')
py3_real_sipbin_path = os.path.join(py3_real_scripts_path, 'sip')
sip_config_args = r'--destdir {} --bindir {} --incdir {}'.format(py3_sitepackages_real_path, py3_real_scripts_path, py3_real_inc_path)
if 'default_bin_dir' in _pkg_config:
_pkg_config['default_bin_dir'] = py3_real_root_path
if 'default_mod_dir' in _pkg_config:
_pkg_config['default_mod_dir'] = py3_sitepackages_real_path
if 'default_sip_dir' in _pkg_config:
_pkg_config['default_sip_dir'] = py3_real_sip_path
if 'py_conf_inc_dir' in _pkg_config:
_pkg_config['py_conf_inc_dir'] = py3_real_inc_path
if 'py_lib_dir' in _pkg_config:
_pkg_config['py_lib_dir'] = py3_real_libs_path
if 'sip_bin' in _pkg_config:
_pkg_config['sip_bin'] = py3_real_sipbin_path
if 'sip_inc_dir' in _pkg_config:
_pkg_config['sip_inc_dir'] = py3_real_inc_path
if 'sip_module_dir' in _pkg_config:
_pkg_config['sip_module_dir'] = py3_sitepackages_real_path
if 'sip_root_dir' in _pkg_config:
_pkg_config['sip_root_dir'] = py3_sitepackages_real_path
if 'sip_config_args' in _pkg_config:
_pkg_config['sip_config_args'] = sip_config_args
print(_pkg_config)
class _UniqueList:
"""A limited list that ensures all its elements are unique.
......@@ -2846,3 +2888,4 @@ def create_wrapper(script, wrapper, gui=0, use_arch=''):
os.chmod(wrapper, mode)
return wrapper
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment