2014-12-10 10:54:25 +00:00
|
|
|
import tasks
|
|
|
|
|
|
|
|
|
|
|
|
def validate_manifest(data, validator, error):
|
2016-06-04 11:35:59 +02:00
|
|
|
import os.path
|
2016-02-29 19:08:21 +01:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
schema_path = os.path.normpath(os.path.join(os.path.dirname(__file__), 'manifest-schema.yml'))
|
|
|
|
validator(data, schema_path)
|
2014-12-10 10:54:25 +00:00
|
|
|
|
2016-06-04 11:35:59 +02:00
|
|
|
for i, file_entry in enumerate(data['plugins']['file_copy']['files']):
|
|
|
|
srcfile = file_entry['src']
|
|
|
|
if not os.path.isfile(srcfile):
|
|
|
|
msg = 'The source file %s does not exist.' % srcfile
|
|
|
|
error(msg, ['plugins', 'file_copy', 'files', i])
|
2014-12-10 10:54:25 +00:00
|
|
|
|
|
|
|
|
2016-02-29 19:08:21 +01:00
|
|
|
def resolve_tasks(taskset, manifest):
|
2016-06-04 11:35:59 +02:00
|
|
|
if ('mkdirs' in manifest.plugins['file_copy']):
|
|
|
|
taskset.add(tasks.MkdirCommand)
|
|
|
|
if ('files' in manifest.plugins['file_copy']):
|
|
|
|
taskset.add(tasks.FileCopyCommand)
|