|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | import io |
| 3 | +import os.path |
3 | 4 | import shutil |
4 | 5 | import typing |
5 | 6 | from functools import lru_cache |
@@ -824,13 +825,17 @@ def run_ecoinvent(self) -> None: |
824 | 825 | """Run the ecoinvent downloader from start to finish.""" |
825 | 826 | archive_file = self.run_download() |
826 | 827 |
|
827 | | - with tempfile.TemporaryDirectory() as tempdir: |
828 | | - temp_dir = Path(tempdir) |
829 | | - if not import_signals.cancel_sentinel: |
830 | | - self.run_extract(archive_file, temp_dir) |
831 | | - if not import_signals.cancel_sentinel: |
832 | | - dataset_dir = temp_dir.joinpath("datasets") |
833 | | - self.run_import(dataset_dir) |
| 828 | + if os.path.isdir(archive_file): |
| 829 | + import_signals.unarchive_finished.emit() |
| 830 | + self.run_import(archive_file.joinpath("datasets")) |
| 831 | + else: |
| 832 | + with tempfile.TemporaryDirectory() as tempdir: |
| 833 | + temp_dir = Path(tempdir) |
| 834 | + if not import_signals.cancel_sentinel: |
| 835 | + self.run_extract(archive_file, temp_dir) |
| 836 | + if not import_signals.cancel_sentinel: |
| 837 | + dataset_dir = temp_dir.joinpath("datasets") |
| 838 | + self.run_import(dataset_dir) |
834 | 839 |
|
835 | 840 | def run_forwast(self) -> None: |
836 | 841 | """Adapted from pjamesjoyce/lcopt.""" |
@@ -1503,7 +1508,7 @@ def download(self) -> Path: |
1503 | 1508 | version=self.version, |
1504 | 1509 | system_model=self.system_model, |
1505 | 1510 | release_type=self.release_type, |
1506 | | - extract=False, |
| 1511 | + extract=True, |
1507 | 1512 | ) |
1508 | 1513 |
|
1509 | 1514 | @staticmethod |
|
0 commit comments