From e95daf25ba424af5515349fff50e4c060b0f8c21 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Mon, 25 Jul 2016 12:51:39 +1200 Subject: [PATCH] Re-introduce 'subiquity' package for installer specific things. Only move the Application object for now. --- bin/subiquity-tui | 4 +++- debian/subiquity.install | 1 + subiquity/controllers/__init__.py | 22 +++++++++++++++++ subiquity/core.py | 34 +++++++++++++++++++++++++++ subiquitycore/controllers/__init__.py | 8 ------- subiquitycore/core.py | 27 ++++++++++----------- 6 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 subiquity/controllers/__init__.py create mode 100644 subiquity/core.py diff --git a/bin/subiquity-tui b/bin/subiquity-tui index b1fc2f23..5dffcea0 100755 --- a/bin/subiquity-tui +++ b/bin/subiquity-tui @@ -18,13 +18,15 @@ import argparse import sys import logging import signal + from subiquitycore.log import setup_logger, LOGFILE from subiquitycore import __version__ as VERSION -from subiquitycore.core import Application as Subiquity from subiquitycore.core import ApplicationError from subiquitycore.ui.frame import SubiquityUI from subiquitycore.utils import environment_check +from subiquity.core import Subiquity + def parse_options(argv): parser = argparse.ArgumentParser( diff --git a/debian/subiquity.install b/debian/subiquity.install index c23d363a..1fab1610 100644 --- a/debian/subiquity.install +++ b/debian/subiquity.install @@ -1 +1,2 @@ bin/subiquity-tui usr/share/subiquity +usr/share/subiquity/subiquity diff --git a/subiquity/controllers/__init__.py b/subiquity/controllers/__init__.py new file mode 100644 index 00000000..55821a73 --- /dev/null +++ b/subiquity/controllers/__init__.py @@ -0,0 +1,22 @@ +# Copyright 2015 Canonical, Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from subiquitycore.controllers.welcome import WelcomeController # NOQA +from subiquitycore.controllers.installpath import InstallpathController # NOQA +from subiquitycore.controllers.network import NetworkController # NOQA +from subiquitycore.controllers.filesystem import FilesystemController # NOQA +from subiquitycore.controllers.installprogress import InstallProgressController # NOQA +from subiquitycore.controllers.identity import IdentityController # NOQA +from subiquitycore.controllers.login import LoginController # NOQA diff --git a/subiquity/core.py b/subiquity/core.py new file mode 100644 index 00000000..a8e6aa47 --- /dev/null +++ b/subiquity/core.py @@ -0,0 +1,34 @@ +# Copyright 2015 Canonical, Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import logging + +from subiquitycore.core import Application + +log = logging.getLogger('console_conf.core') + + +class Subiquity(Application): + + project = "subiquity" + controllers = { + "Welcome": None, + "Installpath": None, + "Network": None, + "Filesystem": None, + "Identity": None, + "InstallProgress": None, + "Login": None, + } diff --git a/subiquitycore/controllers/__init__.py b/subiquitycore/controllers/__init__.py index f63d9e87..8008b43a 100644 --- a/subiquitycore/controllers/__init__.py +++ b/subiquitycore/controllers/__init__.py @@ -12,11 +12,3 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . - -from .welcome import WelcomeController # NOQA -from .installpath import InstallpathController # NOQA -from .network import NetworkController # NOQA -from .filesystem import FilesystemController # NOQA -from .installprogress import InstallProgressController # NOQA -from .identity import IdentityController # NOQA -from .login import LoginController # NOQA diff --git a/subiquitycore/core.py b/subiquitycore/core.py index cde9e362..3c205441 100644 --- a/subiquitycore/core.py +++ b/subiquitycore/core.py @@ -31,21 +31,18 @@ class ApplicationError(Exception): class Application: - # TODO(mwhudson): This should be an abstract base class with one - # subclass for each of the installer and console-conf. Currently, - # this instance is the installer application and console-conf - # subclasses it. - - project = "subiquitycore" - controllers = { - "Welcome": None, - "Installpath": None, - "Network": None, - "Filesystem": None, - "Identity": None, - "InstallProgress": None, - "Login": None, - } + # A concrete subclass must set project and controllers attributes, e.g.: + # + # project = "subiquity" + # controllers = { + # "Welcome": None, + # "Installpath": None, + # "Network": None, + # "Filesystem": None, + # "Identity": None, + # "InstallProgress": None, + # "Login": None, + # } def __init__(self, ui, opts): try: