Cleanup: Move package download/install code out of subproc.py

Instead do such things in bpkg, and only handle interfacing between
blender and bpkg in subproc.py
This commit is contained in:
Ellwood Zwovic
2017-07-26 02:08:01 -07:00
parent 85a61cfead
commit 2f6357e40e
6 changed files with 296 additions and 382 deletions

View File

@@ -27,38 +27,6 @@ class Progress(SubprocMessage):
def __init__(self, progress: float):
self.progress = progress
class SubprocError(SubprocMessage):
"""Superclass for all fatal error messages sent from the subprocess."""
def __init__(self, message: str):
self.message = message
class SubprocWarning(SubprocMessage):
"""Superclass for all non-fatal warning messages sent from the subprocess."""
def __init__(self, message: str):
self.message = message
class InstallError(SubprocError):
"""Sent when there was an error installing something."""
class UninstallError(SubprocError):
"""Sent when there was an error uninstalling something."""
class FileConflictError(InstallError):
"""Sent when installation would overwrite existing files."""
def __init__(self, message: str, conflicts: list):
self.message = message
self.conflicts = conflicts
class DownloadError(SubprocMessage):
"""Sent when there was an error downloading something."""
def __init__(self, status_code: int, description: str):
self.status_code = status_code
self.description = description
class Success(SubprocMessage):
"""Sent when an operation finished sucessfully."""
@@ -71,3 +39,35 @@ class RepositoryResult(SubprocMessage):
class Aborted(SubprocMessage):
"""Sent as response to Abort message."""
# subproc warnings
class SubprocWarning(SubprocMessage):
"""Superclass for all non-fatal warning messages sent from the subprocess."""
def __init__(self, message: str):
self.message = message
# subproc errors
class SubprocError(SubprocMessage):
"""Superclass for all fatal error messages sent from the subprocess."""
def __init__(self, message: str):
self.message = message
class InstallError(SubprocError):
"""Sent when there was an error installing something."""
class UninstallError(SubprocError):
"""Sent when there was an error uninstalling something."""
class BadRepositoryError(SubprocError):
"""Sent when a repository can't be used for some reason"""
class DownloadError(SubprocMessage):
"""Sent when there was an error downloading something."""
def __init__(self, message: str, status_code: int = None):
self.status_code = status_code
self.message = message