def install(self, bit_download): bit_directory = f'bits/{bit_download.bit_name}' if filesystem.directory_exists(bit_directory): filesystem.remove_directory(bit_directory) filesystem.create_directory(bit_directory) filesystem.unzips(base64.b64decode(bit_download.payload), bit_directory)
def pack(self, project_descriptor, build_directory): if filesystem.directory_exists(build_directory): raise FailedToPackageTemplate(cause='build directory exists') filesystem.create_directory(build_directory) filesystem.copy_file(PROJECT_DESCRIPTOR_FILE, f'{build_directory}/project.yaml') self.__copy_packages(build_directory, project_descriptor) self.__copy_mains(build_directory, project_descriptor) self.__copy_dockerfiles(build_directory, project_descriptor) filesystem.zip(build_directory, f'{project_descriptor.name}') filesystem.remove_directory(build_directory) return f'{project_descriptor.name}.zip'
def pack(self, project_descriptor, build_directory): if not project_descriptor.build_packages(): raise PackagingFailure(cause='project contains no packages') if filesystem.directory_exists(build_directory): raise PackagingFailure(cause='build directory exists') filesystem.create_directory(build_directory) filesystem.copy_file(PROJECT_DESCRIPTOR_FILE, f'{build_directory}/project.yaml') for package in project_descriptor.build_packages(): filesystem.copy_directory(package.path, f'{build_directory}/{package.path}') filesystem.zip(build_directory, f'{project_descriptor.name}') filesystem.remove_directory(build_directory) return f'{project_descriptor.name}.zip'
def clean(self, project): if filesystem.directory_exists(constants.BUILD_DIRECTORY): filesystem.remove_directory(constants.BUILD_DIRECTORY) _ignore_exception(lambda: filesystem.delete_file(constants.CMAKELISTS))
def clean(self, project): if filesystem.directory_exists(constants.BUILD_DIRECTORY): self.__run_command(constants.NINJA_COMMAND, 'clean') filesystem.remove_directory(constants.BUILD_DIRECTORY) _ignore_exception(lambda: filesystem.delete_file(constants.CMAKELISTS))