@@ -81,6 +81,14 @@ def print_indent(msg, offset):
msg = ' ' * offset + l
print(msg)
+def is_dependency_skipped(manifest, package, dependency):
+ """
+ Check to see if this dependency should be ignored by matching substrings
+ from the optional skip_depends element in the manifest.
+ """
+ skiplist = manifest.get('skip_depends', {}).get(package, [])
+ return any((skip in dependency for skip in skiplist))
+
# Read existing JSON manifest
with open('python3-manifest.json') as manifest:
@@ -109,6 +117,8 @@ print_indent('Getting dependencies for package: core', 0)
output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package', '%s' % debugFlag]).decode('utf8')
for coredep in output.split():
+ if is_dependency_skipped(old_manifest['core'], "core", coredep):
+ continue
coredep = coredep.replace(pyversion,'${PYTHON_MAJMIN}')
if coredep not in old_manifest['core']['files']:
old_manifest['core']['files'].append(coredep)
@@ -152,6 +162,8 @@ for filedep in old_manifest['core']['files']:
for pymodule_dep in output.split():
+ if is_dependency_skipped(old_manifest['core'], pymodule, pymodule_dep):
+ continue
pymodule_dep = pymodule_dep.replace(pyversion,'${PYTHON_MAJMIN}')
if pymodule_dep not in old_manifest['core']['files']:
@@ -197,6 +209,8 @@ for pypkg in old_manifest:
new_manifest[pypkg] = {}
new_manifest[pypkg]['summary'] = old_manifest[pypkg]['summary']
new_manifest[pypkg]['rdepends'] = []
+ if "skip_depends" in old_manifest[pypkg]:
+ new_manifest[pypkg]['skip_depends'] = old_manifest[pypkg]['skip_depends']
new_manifest[pypkg]['files'] = []
# All packages should depend on core
@@ -272,6 +286,8 @@ for pypkg in old_manifest:
reportRDEPS = []
for pymodule_dep in output.split():
+ if is_dependency_skipped(new_manifest[pypkg], pymodule, pymodule_dep):
+ continue
# Warning: This first part is ugly
# One of the dependencies that was found, could be inside of one of the folders included by another package
The manifest generation works by importing modules and seeing what other modules also get included. This means the manifest is maximal, for example shutil tries to import all of the compression modules to determine what compression types are available. Add a "skip_depends" element to the manifest so we can mark up specific dependencies that should be ignored when generating the manifest. Signed-off-by: Ross Burton <ross.burton@arm.com> --- .../python/python3/create_manifest3.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)