Commit f2f93fe0 authored by Aurel's avatar Aurel

filter dependency even when install-depencency is True

This must prevent the useless download of bt5 which are already installed
And so this is supposed to reduced the number of bt5 installed by configurator and make it faster
parent a1a82c66
...@@ -1299,25 +1299,29 @@ class TemplateTool (BaseTool): ...@@ -1299,25 +1299,29 @@ class TemplateTool (BaseTool):
# XXX-Luke: This method could replace # XXX-Luke: This method could replace
# TemplateTool_installRepositoryBusinessTemplateList while still being # TemplateTool_installRepositoryBusinessTemplateList while still being
# possible to reuse by external callers # possible to reuse by external callers
operation_log = [] operation_log = []
resolved_template_list = self.resolveBusinessTemplateListDependency( resolved_template_list = self.resolveBusinessTemplateListDependency(
template_list) template_list)
if not install_dependency: installed_bt5_set = set([x.title
installed_bt5_set = set([x.title for x in self.getInstalledBusinessTemplatesList()])
for x in self.getInstalledBusinessTemplatesList()])
def checkAvailability(bt_title): def checkAvailability(bt_title):
return bt_title in template_list or bt_title in installed_bt5_set return bt_title in template_list or bt_title in installed_bt5_set
missing_dependency_list = [i[1] for i in resolved_template_list missing_dependency_list = [i for i in resolved_template_list
if not checkAvailability(i[1].replace(".bt5", ""))] if not checkAvailability(i[1].replace(".bt5", ""))]
if len(missing_dependency_list) > 0:
raise BusinessTemplateMissingDependency,\ if not install_dependency and len(missing_dependency_list) > 0:
"Impossible to install, please install the following dependencies before: %s" \ raise BusinessTemplateMissingDependency,\
% missing_dependency_list "Impossible to install, please install the following dependencies before: %s" \
% [x[1] for x in missing_dependency_list]
activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time())) activate_kw = dict(activity="SQLQueue", tag="start_%s" % (time.time()))
for repository, bt_id in resolved_template_list:
missing_dependency_list.extend([x for x in resolved_template_list if
x[1] in template_list])
for repository, bt_id in missing_dependency_list:
bt_url = '%s/%s' % (repository, bt_id) bt_url = '%s/%s' % (repository, bt_id)
param_dict = dict(download_url=bt_url, only_newer=only_newer) param_dict = dict(download_url=bt_url, only_newer=only_newer)
if update_catalog is not _MARKER: if update_catalog is not _MARKER:
......
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