aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2017-02-21 08:15:20 +0100
committerChristian Stenger <christian.stenger@qt.io>2017-02-23 10:43:29 +0000
commitce69c5da15dc4488846410807b92fa90f34f20e0 (patch)
tree3f8c2c6a4efa3901824041b5fb69d6bcc9bdeccf /scripts
parent7045a07d5df9f965cf75baf6f23b85c5063cc1e4 (diff)
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 <tobias.hunger@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dependencyinfo.py42
1 files changed, 23 insertions, 19 deletions
diff --git a/scripts/dependencyinfo.py b/scripts/dependencyinfo.py
index 834402dda0..9388809711 100755
--- a/scripts/dependencyinfo.py
+++ b/scripts/dependencyinfo.py
@@ -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))