Now build packages and uninstalled packages can be specified when running templates. fixed #5

master
Иванов Денис 4 years ago
parent 44fcfc72f6
commit 73ce266ed2

@ -1869,18 +1869,30 @@ class DirectoryProcessor:
'''Метод для выполнения шаблонов относящихся к пакетам, указанным во
всех встреченных значениях параметра merge.'''
not_merged_packages = []
founded_packages = iter(self.packages_file_trees.keys())
self.for_package = None
while self.packages_to_merge:
self.for_package = next(founded_packages, None)
if self.for_package is None:
# Если список найденных пакетов пройден, но пакеты для
# настройки еще есть -- заново проходимся по списку.
for package in self.packages_to_merge.difference(
self.packages_file_trees):
self.output.set_error(
("Error: package '{0}' not found for"
" action{1} '{2}'.").format(
package,
's' if len(self.action) > 1 else '',
', '.join(self.action)))
self.packages_to_merge.remove(package)
if not self.packages_to_merge:
break
founded_packages = iter(self.packages_file_trees.keys())
self.for_package = next(founded_packages, None)
if (self.for_package is None
or self.for_package not in self.packages_to_merge):
continue
elif self.for_package not in self.packages_to_merge:
continue
self.template_engine.for_package = self.for_package
if self.for_package not in self.packages_file_trees:

@ -17,6 +17,10 @@ def main():
help=("flag for switching template engine's mode from"
" standard mode to the mode allowing changing of"
"CONTENTS files."))
parser.add_argument('-b', '--build', type=str,
help="atom name of a build package.")
parser.add_argument('-u', '--uninstall', type=str,
help="atom name of a uninstalling package.")
args = parser.parse_args()
datavars = Datavars()
io_module = IOModule()
@ -25,6 +29,12 @@ def main():
else:
package = args.package
group_packages = {}
if args.build is not None:
group_packages['build'] = args.build
if args.uninstall is not None:
group_packages['unistall'] = args.uninstall
action = list(flat_iterable(args.action))
template_processor = DirectoryProcessor(action,
datavars_module=datavars,

@ -1,2 +1,2 @@
{% calculate append = 'skip', action = 'install' %}
{% calculate path = '/var/calculate/development/dir/test_dir' %}
{% calculate append = 'skip', action = 'install',
path = '/var/calculate/development/dir/test_dir' %}

@ -1,2 +1,2 @@
{% calculate append = 'skip', action = 'remove' %}
{% calculate path = '/var/calculate/development/dir' %}
{% calculate append = 'skip', action = 'remove',
path = '/var/calculate/development/dir' %}

@ -1,2 +1,2 @@
{% calculate append = 'skip', action = 'update' %}
{% calculate path = '/var/calculate/development/dir/test_dir' %}
{% calculate append = 'skip', action = 'update',
path = '/var/calculate/development/dir/test_dir' %}

Loading…
Cancel
Save