|
1 | 1 | __author__ = "desultory" |
2 | | -__version__ = "4.4.0" |
| 2 | +__version__ = "4.4.1" |
3 | 3 |
|
4 | 4 | from os import environ, makedev, mknod |
5 | 5 | from pathlib import Path |
@@ -206,13 +206,25 @@ def deploy_dependencies(self) -> None: |
206 | 206 | self._copy(dependency) |
207 | 207 |
|
208 | 208 |
|
209 | | -def _deploy_compressed(self, compression_type: str, decompressor, compression_extension=None) -> None: |
210 | | - """Decompresses all dependencies of the specified compression type into the build directory.""" |
211 | | - compression_extension = compression_extension or f".{compression_type}" |
| 209 | +def _deploy_compressed(self, compression_type: str, decompressor, compression_extensions=None) -> None: |
| 210 | + """Decompresses all dependencies of the specified compression type into the build directory. |
| 211 | + Remove the compression extension if there is a match between compression_extensions and the file name. |
| 212 | + """ |
| 213 | + compression_extensions = compression_extensions or [f".{compression_type}"] |
212 | 214 |
|
213 | 215 | for dependency in self[f"{compression_type}_dependencies"]: |
214 | 216 | self.logger.debug(f"[{compression_type}] Decompressing: {dependency}") |
215 | | - out_path = self._get_build_path(str(dependency).replace(compression_extension, "")) |
| 217 | + |
| 218 | + for extension in compression_extensions: |
| 219 | + if str(dependency).endswith(extension): |
| 220 | + break |
| 221 | + else: |
| 222 | + self.logger.warning(f"[{compression_type}] Dependency missing extension: {dependency}") |
| 223 | + extension = "" |
| 224 | + |
| 225 | + self.logger.debug(f"[{compression_type}] Found compressed file: {dependency}") |
| 226 | + # Replace the extension, do nothing if there is no match |
| 227 | + out_path = self._get_build_path(str(dependency).replace(extension, "")) |
216 | 228 | if not out_path.parent.is_dir(): |
217 | 229 | self.logger.debug(f"Creating parent directory: {out_path.parent}") |
218 | 230 | self._mkdir(out_path.parent, resolve_build=False) |
@@ -243,17 +255,8 @@ def deploy_zstd_dependencies(self) -> None: |
243 | 255 | Entries should only be added to zstd_dependencies if the zstandard library is available. |
244 | 256 | """ |
245 | 257 | from zstandard import decompress |
246 | | - from zstandard.backend_cffi import ZstdError |
247 | 258 |
|
248 | | - try: |
249 | | - _deploy_compressed(self, "zstd", decompress, compression_extension=".zst") |
250 | | - except ZstdError as e: |
251 | | - self.logger.error("Unable to decompress zstd dependency: %s" % e) |
252 | | - raise e |
253 | | - self.logger.warning( |
254 | | - "Ensure the zstandard library is installed, or remove the zstd dependency from the configuration." |
255 | | - ) |
256 | | - raise e |
| 259 | + _deploy_compressed(self, "zstd", decompress, compression_extensions=[".zst", ".zstd"]) |
257 | 260 |
|
258 | 261 |
|
259 | 262 | @contains("gz_dependencies", "No gz dependencies defined, skipping.", log_level=10) |
|
0 commit comments