IO

ArchivePackagingBaseTask

Package to import

Single task to import

PIP package to install

Stable version

rkd.core.standardlib.io

rkd.core.standardlib.io.ArchivePackagingBaseTask

pip install rkd== SELECT VERSION

https://badgen.net/pypi/v/rkd

Caution

This is a Base Task. It is not a Task to run, but to create a own, runnable Task basing on it.

Hint

This is an extendable task. Read more in Extending tasks chapter.

class rkd.core.standardlib.io. ArchivePackagingBaseTask [source]
Supports:
  • dry-run mode (do not write anything to disk, just print messages)

  • copies directories recursively

  • .gitignore files support (manually added using API method)

  • can work both as preconfigured and fully on runtime

Example (preconfigured):

@extends(ArchivePackagingBaseTask)
def PackIntoZipTask():
    def configure(task: ArchivePackagingBaseTask, event: ConfigurationLifecycleEvent):
        task.archive_path = '/tmp/test-archive.zip'
        task.consider_gitignore('.gitignore')
        task.add('tests/samples/', './')

    return [configure]

Example (on runtime):

@extends(ArchivePackagingBaseTask)
def PackIntoZipTask():
    def configure(task: ArchivePackagingBaseTask, event: ConfigurationLifecycleEvent):
        task.archive_path = '/tmp/test-archive.zip'

    def execute(task: ArchivePackagingBaseTask):
        task.consider_gitignore('.gitignore')
        task.add('tests/samples/', './')
        task.perform()

    return [configure, execute]
add ( src_path : str , target_path : Optional [ str ] = None ) [source]

Enqueue file/directory to be added to the archive file

Api

configure

Parameters
  • src_path

  • target_path – Optional - name under which the file will be added to the archive

Returns

configure_argparse ( parser : argparse.ArgumentParser ) [source]

Allows a task to configure ArgumentParser (argparse)

def configure_argparse(self, parser: ArgumentParser):
    parser.add_argument('--php', help='PHP version ("php" docker image tag)', default='8.0-alpine')
    parser.add_argument('--image', help='Docker image name', default='php')
execute ( context : rkd.core.api.contract.ExecutionContext ) bool [source]

Executes a task. True/False should be returned as return