From f458954d42cae1eead10b801289df1902b6b5104 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Wed, 18 Jan 2017 14:06:33 +0200 Subject: [PATCH 1/2] [depends] section if resource.config Now groups in resource.config['depends'] can define another groups from the same file as their dependencies --- ckan/lib/fanstatic_resources.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ckan/lib/fanstatic_resources.py b/ckan/lib/fanstatic_resources.py index 8aefb6fe5b4..2f313390e2f 100644 --- a/ckan/lib/fanstatic_resources.py +++ b/ckan/lib/fanstatic_resources.py @@ -157,8 +157,12 @@ def create_resource(path, lib_name, count, inline=False): if resource not in depends: depends[resource] = [] for dep in depends[group]: - if dep not in depends[resource]: - depends[resource].append(dep) + if dep not in groups: + dep_resources = [dep] + else: + dep_resources = groups[dep] + diff = set(dep_resources).difference(depends[resource]) + depends[resource].extend(diff) # process each .js/.css file found resource_list = [] From d5a636c1ffcc2a430a691a7eb96fdf8fb6aea799 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Wed, 18 Jan 2017 14:26:40 +0200 Subject: [PATCH 2/2] Forget about sets - they can change order of items --- ckan/lib/fanstatic_resources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckan/lib/fanstatic_resources.py b/ckan/lib/fanstatic_resources.py index 2f313390e2f..396bfd4f582 100644 --- a/ckan/lib/fanstatic_resources.py +++ b/ckan/lib/fanstatic_resources.py @@ -161,7 +161,7 @@ def create_resource(path, lib_name, count, inline=False): dep_resources = [dep] else: dep_resources = groups[dep] - diff = set(dep_resources).difference(depends[resource]) + diff = [res for res in dep_resources if res not in depends[resource]] depends[resource].extend(diff) # process each .js/.css file found