def build_pipes()

in example_zoo/tools/cmle_package.py [0:0]


    def build_pipes(self):
        for template_filename in self.TEMPLATE_FILENAMES:
            self.pipes.append(
                Pipe(
                    os.path.join('templates', template_filename),
                    os.path.join(self.output_dir, template_filename),
                    [self.format]
                )
            )

        # test
        self.pipes.append(
            Pipe(
                'templates/cmle_test.py',
                os.path.join(self.output_dir, self.test_name),
                [self.format]
            )
        )

        # tfgfile_wrapper if needed
        if self.tfgfile_wrap:
            self.pipes.append(
                Pipe(
                    'templates/tfgfile_wrapper.py',
                    os.path.join(self.output_dir, self.output_script_path, 'tfgfile_wrapper.py')
                )
            )

        # source
        source_transformations = [self.add_job_dir_flag]

        if self.tfgfile_wrap:
            source_transformations.append(self.add_tfgfile_wrapper)

        for match, replace in self.replace:
            source_transformations.append(
                self.make_replace_transformation(match, replace)
            )

        self.pipes.append(
            Pipe(
                os.path.join(self.working_dir, self.module_path, self.script_path, self.script_name),
                os.path.join(self.output_dir, self.output_script_path, self.script_name),
                source_transformations
            )
        )

        # other source files/directories
        # use source_finder to find minimally required other source files
        from source_finder import SourceFinder
        sf = SourceFinder(
            os.path.join(self.working_dir, self.module_path, self.package_path),
            os.path.join(self.working_dir, self.module_path, self.script_path, self.script_name)
        )
        sf.process()

        for module_path in sf.script_imports.keys():
            # skip the script itself
            if module_path == sf.script_path:
                continue

            rel_path = sf.path_to_relative_path(module_path)

            self.pipes.append(
                Pipe(
                    module_path,
                    os.path.join(self.output_dir, rel_path)
                )
            )