|
61 | 61 |
|
62 | 62 | from __future__ import annotations |
63 | 63 |
|
64 | | -import tempfile |
65 | 64 | from pathlib import Path |
66 | 65 |
|
67 | 66 | from . import Tool |
@@ -141,34 +140,22 @@ def _decompress(self, archive: Path) -> None: |
141 | 140 | Raises: |
142 | 141 | IOError: If decompression/installation fails. |
143 | 142 | """ |
144 | | - # Create temporary tar file |
145 | | - temp_tar_fd, temp_tar_path = tempfile.mkstemp(suffix=".tar") |
146 | | - temp_tar = Path(temp_tar_path) |
147 | | - |
148 | | - try: |
149 | | - # Decompress bzip2 to tar |
150 | | - download.un_bzip2(archive, temp_tar) |
151 | | - |
152 | | - # Create mamba base directory |
153 | | - mamba_base_dir = Path(self.rootdir) |
154 | | - if not mamba_base_dir.is_dir(): |
155 | | - mamba_base_dir.mkdir(parents=True, exist_ok=True) |
156 | | - |
157 | | - # Extract tar |
158 | | - download.un_tar(temp_tar, mamba_base_dir) |
159 | | - |
160 | | - # Verify micromamba binary exists |
161 | | - mm_file = Path(self.command) |
162 | | - if not mm_file.exists(): |
163 | | - raise IOError(f"Expected micromamba binary is missing: {self.command}") |
164 | | - |
165 | | - # Set executable permission if needed |
166 | | - if not platform.is_executable(mm_file): |
167 | | - mm_file.chmod(mm_file.stat().st_mode | 0o111) |
168 | | - |
169 | | - finally: |
170 | | - # Clean up temporary file |
171 | | - temp_tar.unlink(missing_ok=True) |
| 143 | + # Create mamba base directory |
| 144 | + mamba_base_dir = Path(self.rootdir) |
| 145 | + if not mamba_base_dir.is_dir(): |
| 146 | + mamba_base_dir.mkdir(parents=True, exist_ok=True) |
| 147 | + |
| 148 | + # Extract archive |
| 149 | + download.unpack(archive, mamba_base_dir) |
| 150 | + |
| 151 | + # Verify micromamba binary exists |
| 152 | + mm_file = Path(self.command) |
| 153 | + if not mm_file.exists(): |
| 154 | + raise IOError(f"Expected micromamba binary is missing: {self.command}") |
| 155 | + |
| 156 | + # Set executable permission if needed |
| 157 | + if not platform.is_executable(mm_file): |
| 158 | + mm_file.chmod(mm_file.stat().st_mode | 0o111) |
172 | 159 |
|
173 | 160 | def create(self, env_dir: Path) -> None: |
174 | 161 | """ |
|
0 commit comments