mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 13:14:37 +03:00
Add ArchiveExtractionError
This commit is contained in:
@@ -65,3 +65,7 @@ class CliInputError(AqtException):
|
|||||||
|
|
||||||
class CliKeyboardInterrupt(AqtException):
|
class CliKeyboardInterrupt(AqtException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ArchiveExtractionError(AqtException):
|
||||||
|
pass
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ from typing import Any, Callable, List, Optional
|
|||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from aqt.archives import QtArchives, QtPackage, SrcDocExamplesArchives, ToolArchives
|
from aqt.archives import QtArchives, QtPackage, SrcDocExamplesArchives, ToolArchives
|
||||||
from aqt.exceptions import AqtException, ArchiveConnectionError, CliInputError, CliKeyboardInterrupt
|
from aqt.exceptions import AqtException, ArchiveConnectionError, ArchiveExtractionError, CliInputError, CliKeyboardInterrupt
|
||||||
from aqt.helper import MyQueueListener, Settings, downloadBinaryFile, getUrl, setup_logging
|
from aqt.helper import MyQueueListener, Settings, downloadBinaryFile, getUrl, setup_logging
|
||||||
from aqt.metadata import ArchiveId, MetadataFactory, SimpleSpec, Version, show_list
|
from aqt.metadata import ArchiveId, MetadataFactory, SimpleSpec, Version, show_list
|
||||||
from aqt.updater import Updater
|
from aqt.updater import Updater
|
||||||
@@ -823,12 +823,8 @@ def installer(
|
|||||||
proc = subprocess.run(command_args, stdout=subprocess.PIPE, check=True)
|
proc = subprocess.run(command_args, stdout=subprocess.PIPE, check=True)
|
||||||
logger.debug(proc.stdout)
|
logger.debug(proc.stdout)
|
||||||
except subprocess.CalledProcessError as cpe:
|
except subprocess.CalledProcessError as cpe:
|
||||||
logger.error("Extraction error: %d" % cpe.returncode)
|
msg = "\n".join(filter(None, [f"Extraction error: {cpe.returncode}", cpe.stdout, cpe.stderr]))
|
||||||
if cpe.stdout is not None:
|
raise ArchiveExtractionError(msg) from cpe
|
||||||
logger.error(cpe.stdout)
|
|
||||||
if cpe.stderr is not None:
|
|
||||||
logger.error(cpe.stderr)
|
|
||||||
raise cpe
|
|
||||||
if not keep:
|
if not keep:
|
||||||
os.unlink(archive)
|
os.unlink(archive)
|
||||||
logger.info("Finished installation of {} in {:.8f}".format(archive, time.perf_counter() - start_time))
|
logger.info("Finished installation of {} in {:.8f}".format(archive, time.perf_counter() - start_time))
|
||||||
|
|||||||
Reference in New Issue
Block a user