Account for the instance of submodules.pack.Packer #104184
@ -8,7 +8,7 @@ import logging
|
|||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import typing
|
import typing
|
||||||
|
import traceback
|
||||||
dr.sybren marked this conversation as resolved
|
|||||||
from . import submodules
|
from . import submodules
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -54,6 +54,12 @@ class MsgDone(Message):
|
|||||||
missing_files: list[Path]
|
missing_files: list[Path]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MsgDoneNotShaman(Message):
|
||||||
|
output_path: Path
|
||||||
|
missing_files: list[Path]
|
||||||
|
|
||||||
|
|
||||||
# MyPy doesn't understand the way BAT subpackages are imported.
|
# MyPy doesn't understand the way BAT subpackages are imported.
|
||||||
class BatProgress(submodules.progress.Callback): # type: ignore
|
class BatProgress(submodules.progress.Callback): # type: ignore
|
||||||
"""Report progress of BAT Packing to the given queue."""
|
"""Report progress of BAT Packing to the given queue."""
|
||||||
@ -149,6 +155,7 @@ class PackThread(threading.Thread):
|
|||||||
except BaseException as ex:
|
except BaseException as ex:
|
||||||
log.error("Error packing with BAT: %s", ex)
|
log.error("Error packing with BAT: %s", ex)
|
||||||
self.queue.put(MsgException(ex=ex))
|
self.queue.put(MsgException(ex=ex))
|
||||||
|
traceback.print_exc()
|
||||||
finally:
|
finally:
|
||||||
with _packer_lock:
|
with _packer_lock:
|
||||||
_running_packthread = None
|
_running_packthread = None
|
||||||
@ -166,11 +173,16 @@ class PackThread(threading.Thread):
|
|||||||
log.debug("done")
|
log.debug("done")
|
||||||
self._set_bat_status("DONE")
|
self._set_bat_status("DONE")
|
||||||
|
|
||||||
msg = MsgDone(
|
if isinstance(self.packer, submodules.pack.Packer):
|
||||||
self.packer.output_path,
|
msg = MsgDoneNotShaman(
|
||||||
self.packer.actual_checkout_path,
|
self.packer.output_path, self.packer.missing_files
|
||||||
self.packer.missing_files,
|
)
|
||||||
)
|
else:
|
||||||
|
msg = MsgDone(
|
||||||
|
self.packer.output_path,
|
||||||
|
self.packer.actual_checkout_path,
|
||||||
|
self.packer.missing_files,
|
||||||
|
)
|
||||||
self.queue.put(msg)
|
self.queue.put(msg)
|
||||||
|
|
||||||
def _set_bat_status(self, status: str) -> None:
|
def _set_bat_status(self, status: str) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user
Please dont' include formatting changes. In general, cleanups of formatting (and other changes that don't alter the functionality) should be in a PR by themselves.