(
self,
project_root: Path,
manifest: IntegrationManifest,
parsed_options: dict[str, Any] | None = None,
**opts: Any,
)
| 799 | return args |
| 800 | |
| 801 | def setup( |
| 802 | self, |
| 803 | project_root: Path, |
| 804 | manifest: IntegrationManifest, |
| 805 | parsed_options: dict[str, Any] | None = None, |
| 806 | **opts: Any, |
| 807 | ) -> list[Path]: |
| 808 | templates = self.list_command_templates() |
| 809 | if not templates: |
| 810 | return [] |
| 811 | |
| 812 | project_root_resolved = project_root.resolve() |
| 813 | if manifest.project_root != project_root_resolved: |
| 814 | raise ValueError( |
| 815 | f"manifest.project_root ({manifest.project_root}) does not match " |
| 816 | f"project_root ({project_root_resolved})" |
| 817 | ) |
| 818 | |
| 819 | dest = self.commands_dest(project_root).resolve() |
| 820 | try: |
| 821 | dest.relative_to(project_root_resolved) |
| 822 | except ValueError as exc: |
| 823 | raise ValueError( |
| 824 | f"Integration destination {dest} escapes " |
| 825 | f"project root {project_root_resolved}" |
| 826 | ) from exc |
| 827 | dest.mkdir(parents=True, exist_ok=True) |
| 828 | |
| 829 | script_type = opts.get("script_type", "sh") |
| 830 | arg_placeholder = ( |
| 831 | self.registrar_config.get("args", "$ARGUMENTS") |
| 832 | if self.registrar_config |
| 833 | else "$ARGUMENTS" |
| 834 | ) |
| 835 | created: list[Path] = [] |
| 836 | |
| 837 | for src_file in templates: |
| 838 | raw = src_file.read_text(encoding="utf-8") |
| 839 | processed = self.process_template( |
| 840 | raw, self.key, script_type, arg_placeholder, |
| 841 | project_root=project_root, |
| 842 | ) |
| 843 | dst_name = self.command_filename(src_file.stem) |
| 844 | dst_file = self.write_file_and_record( |
| 845 | processed, dest / dst_name, project_root, manifest |
| 846 | ) |
| 847 | created.append(dst_file) |
| 848 | |
| 849 | |
| 850 | return created |
| 851 | |
| 852 | |
| 853 | # --------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected