Warning, /kdevelop/kdevelop/app/start-kdevelop.py.in is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env python3 0002 0003 import os 0004 import pprint 0005 import subprocess 0006 import sys 0007 0008 new_env = {} 0009 0010 def prepend_to_env_list(var: str, new_dirs: list, default_dirs: list=list()): 0011 path_list = new_dirs + list(os.getenv(var, "").split(":")) + default_dirs 0012 # print(var, "path_list:", pprint.pformat(path_list)) 0013 # remove duplicates as well as empty entries and preserve order 0014 unique_path_list = [] 0015 for path in path_list: 0016 if path and path not in unique_path_list: 0017 unique_path_list.append(path) 0018 # print(var, "unique_path_list:", pprint.pformat(unique_path_list)) 0019 new_env[var] = ":".join(unique_path_list) 0020 0021 0022 plugin_dirs = ["@KDE_INSTALL_FULL_PLUGINDIR@"] 0023 if "@QT_PLUGIN_INSTALL_DIR@" and os.path.exists("@QT_PLUGIN_INSTALL_DIR@"): 0024 plugin_dirs.append("@QT_PLUGIN_INSTALL_DIR@") 0025 qt_plugin_dir = subprocess.check_output(["qtpaths", "--plugin-dir"]).decode("utf-8").strip() 0026 plugin_dirs.append(qt_plugin_dir) 0027 prepend_to_env_list("QT_PLUGIN_PATH", plugin_dirs) 0028 0029 qml_import_dirs = ["@KDE_INSTALL_FULL_QMLDIR@"] 0030 if "@QT_INSTALL_QML@" and os.path.exists("@QT_INSTALL_QML@"): 0031 qml_import_dirs.append("@QT_INSTALL_QML@") 0032 qml_import_dirs.append(os.path.abspath(os.path.join(qt_plugin_dir, os.pardir, "qml"))) 0033 prepend_to_env_list("QML2_IMPORT_PATH", qml_import_dirs) 0034 0035 config_dirs = subprocess.check_output(["qtpaths", "--paths", "GenericConfigLocation"]).decode("utf-8").strip().split(":") 0036 prepend_to_env_list("XDG_CONFIG_DIRS", ["@KDE_INSTALL_FULL_CONFDIR@"], config_dirs) 0037 0038 data_dirs = subprocess.check_output(["qtpaths", "--paths", "GenericDataLocation"]).decode("utf-8").strip().split(":") 0039 prepend_to_env_list("XDG_DATA_DIRS", ["@KDE_INSTALL_FULL_DATADIR@"], data_dirs) 0040 0041 # add the directory where we installed kdevelop to $PATH in case e.g. CMake, etc. are also there 0042 prepend_to_env_list("PATH", ["@KDE_INSTALL_FULL_BINDIR@"]) 0043 0044 new_env["QT_MESSAGE_PATTERN"] = "\033[32m%{time h:mm:ss.zzz}%{if-category}\033[32m %{category}:%{endif} %{if-debug}\033[34m%{function}%{endif}%{if-warning}\033[31m%{backtrace depth=5}\n%{endif}%{if-critical}\033[31m%{backtrace depth=5}\n%{endif}%{if-fatal}\033[31m%{backtrace depth=5}\n%{endif}\033[0m %{message}" 0045 0046 os.environ.update(new_env) 0047 # print("updating env:", pprint.pformat(new_env)) 0048 0049 kdevelop_binary = "@KDE_INSTALL_FULL_BINDIR@/kdevelop" 0050 os.execvpe(kdevelop_binary, [kdevelop_binary] + sys.argv[1:], os.environ)