Commit ce69c5da authored by Christian Stenger's avatar Christian Stenger

Scripts: Make dependencyinfo script working again

Due to the change of using json based plugin information instead
of xml based (pluginspec) this script became disfunctional long
time ago.. Adapt the script to use the json information generated
while building QC.
This script is still intended to find unused or unlisted
dependecies of plugins.

Prerequisites: Linux platform
Usage (just as before): inside the build directory of QC just run
the script directly or pass it to the Python interpreter.
(still limited to Python 2.x with x>=7)

Change-Id: I92b48327944df1239e9fac7fbd8ed1bee4fefa61
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent 7045a07d
......@@ -26,6 +26,7 @@
############################################################################
import glob
import json
import logging
import os
import re
......@@ -100,26 +101,25 @@ class Plugin(Library):
def _parsePluginSpec(self, spec):
dirname = os.path.dirname(spec)
with open(spec) as f:
content = f.readlines()
for line in content:
m = re.search('(plugin|dependency)\s+name="([^"]+)"(?:.*\stype="([^"]+)")?', line)
if not(m):
continue
if m.group(1) == 'plugin':
if self.name != '':
log.critical('Plugin name already set to "%s"!', self.name)
else:
self.name = m.group(2)
else:
kind = m.group(3)
if not(kind):
kind = 'strong'
self.specDependencies[m.group(2)] = kind
if self.name == '':
content = json.load(f)
self.name = content.get("Name")
dependencies = content.get("Dependencies")
if dependencies is not None:
for dep in dependencies:
depName = dep.get("Name")
depType = dep.get("Type")
if depName is None:
log.critical("Unnamed dependency inside '%s'?" % spec)
continue
if depType is None:
depType = 'strong'
self.specDependencies[depName] = depType
if self.name is None or self.name == '':
log.critical('Plugin name not set for spec "%s".', spec)
return os.path.join(dirname, "lib%s.so" % self.name)
return os.path.normpath(os.path.join(dirname, "..", "..", "..", "lib", "qtcreator",
"plugins", "lib%s.so" % self.name))
def _parseNMline(self, line):
m = re.search('^\s+ U (.*)$', line)
......@@ -229,7 +229,11 @@ class BinaryDirExaminer:
self.libraries.append(Library(l))
def _findPlugins(self, path):
pluginspecs = glob.glob(os.path.join(path, "lib", "qtcreator", "plugins", "*.pluginspec"))
pluginspecs = glob.glob(os.path.join(path, "src", "plugins", "*", "*.json"))
if len(pluginspecs) == 0:
log.critical("This script only works for qmake builds that have not been installed "
"already.")
for spec in pluginspecs:
log.debug(' Looking at plugin "%s".', spec)
self.plugins.append(Plugin(spec))
......
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