| 123456789101112131415161718192021222324252627282930313233343536373839 |
- from .file import file
- from .command import command
- from .exceptions import already_packed
- from .package_export import package_export
- class package:
- def __init__(self, commands: list, files: dict) -> None:
- self.__commands = tuple(commands)
- self.__files = tuple([ count for count in files.values() ])
- @property
- def files(self) -> tuple:
- return self.__files
- @property
- def commands(self) -> tuple:
- return self.__commands
- def export(self) -> package_export:
- return package_export(self)
- class package_builder:
- def __init__(self) -> None:
- self.__commands = list()
- self.__files = dict()
- def add_file(self, target: file) -> object:
- if target.path_name in self.__files:
- raise alread_packed(target)
- self.__files[target.path_name] = target
- return self
- def add_command(self, target: command) -> object:
- self.__commands.push(target)
- return self
- def pack(self) -> package:
- return package(self.__commands, self.__files)
|