[PATCH 11/13] Add automake files for TUI
Martin Sivak
msivak at redhat.com
Wed Aug 8 08:52:49 UTC 2012
---
Makefile.am | 4 +-
configure.ac | 5 ++
pyanaconda/ui/Makefile.am | 2 +-
pyanaconda/ui/tui/Makefile.am | 24 +++++++
pyanaconda/ui/tui/hubs/Makefile.am | 24 +++++++
pyanaconda/ui/tui/simpleline/Makefile.am | 24 +++++++
pyanaconda/ui/tui/spokes/Makefile.am | 24 +++++++
pyanaconda/ui/tui/tools/Makefile.am | 18 +++++
pyanaconda/ui/tui/tools/run-hub.py | 1 -
pyanaconda/ui/tui/tools/run-spoke.py | 105 -----------------------------
pyanaconda/ui/tui/tools/run-text-hub.py | 1 +
pyanaconda/ui/tui/tools/run-text-spoke.py | 105 +++++++++++++++++++++++++++++
12 files changed, 228 insertions(+), 109 deletions(-)
create mode 100644 pyanaconda/ui/tui/Makefile.am
create mode 100644 pyanaconda/ui/tui/hubs/Makefile.am
create mode 100644 pyanaconda/ui/tui/simpleline/Makefile.am
create mode 100644 pyanaconda/ui/tui/spokes/Makefile.am
create mode 100644 pyanaconda/ui/tui/tools/Makefile.am
delete mode 120000 pyanaconda/ui/tui/tools/run-hub.py
delete mode 100755 pyanaconda/ui/tui/tools/run-spoke.py
create mode 120000 pyanaconda/ui/tui/tools/run-text-hub.py
create mode 100755 pyanaconda/ui/tui/tools/run-text-spoke.py
diff --git a/Makefile.am b/Makefile.am
index 9085d4e..84531c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -131,14 +131,14 @@ runtextspoke:
ANACONDA_INSTALL_CLASSES=${PWD}/pyanaconda/installclasses \
PYTHONPATH=.:pyanaconda/isys/.libs:widgets/python/:widgets/src/.libs/ \
LD_LIBRARY_PATH=widgets/src/.libs \
- pyanaconda/ui/tui/tools/run-spoke.py ${SPOKE_MODULE} ${SPOKE_CLASS}
+ pyanaconda/ui/tui/tools/run-text-spoke.py ${SPOKE_MODULE} ${SPOKE_CLASS}
runtexthub:
ANACONDA_DATA=${PWD}/data \
ANACONDA_INSTALL_CLASSES=${PWD}/pyanaconda/installclasses \
PYTHONPATH=.:pyanaconda/isys/.libs:widgets/python/:widgets/src/.libs/ \
LD_LIBRARY_PATH=widgets/src/.libs \
- pyanaconda/ui/tui/tools/run-hub.py ${HUB_MODULE} ${HUB_CLASS}
+ pyanaconda/ui/tui/tools/run-text-hub.py ${HUB_MODULE} ${HUB_CLASS}
runglade:
diff --git a/configure.ac b/configure.ac
index a7bc032..f10eed4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,6 +296,11 @@ AC_CONFIG_FILES([Makefile
pyanaconda/ui/gui/spokes/lib/Makefile
pyanaconda/ui/gui/tools/Makefile
pyanaconda/ui/gui/Makefile
+ pyanaconda/ui/tui/hubs/Makefile
+ pyanaconda/ui/tui/simpleline/Makefile
+ pyanaconda/ui/tui/spokes/Makefile
+ pyanaconda/ui/tui/tools/Makefile
+ pyanaconda/ui/tui/Makefile
tests/Makefile
tests/mock/Makefile
tests/kickstart_test/Makefile
diff --git a/pyanaconda/ui/Makefile.am b/pyanaconda/ui/Makefile.am
index 970fc82..cff34cc 100644
--- a/pyanaconda/ui/Makefile.am
+++ b/pyanaconda/ui/Makefile.am
@@ -15,7 +15,7 @@
#
# Author: Chris Lumens <clumens at redhat.com>
-SUBDIRS = gui
+SUBDIRS = gui tui
MAINTAINERCLEANFILES = Makefile.in
diff --git a/pyanaconda/ui/tui/Makefile.am b/pyanaconda/ui/tui/Makefile.am
new file mode 100644
index 0000000..9cc0ba1
--- /dev/null
+++ b/pyanaconda/ui/tui/Makefile.am
@@ -0,0 +1,24 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+SUBDIRS = hubs spokes simpleline tools
+
+MAINTAINERCLEANFILES = Makefile.in
+
+pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
+tuidir = $(pkgpyexecdir)/ui/tui
+tui_PYTHON = *.py
diff --git a/pyanaconda/ui/tui/hubs/Makefile.am b/pyanaconda/ui/tui/hubs/Makefile.am
new file mode 100644
index 0000000..f099b76
--- /dev/null
+++ b/pyanaconda/ui/tui/hubs/Makefile.am
@@ -0,0 +1,24 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+SUBDIRS =
+
+MAINTAINERCLEANFILES = Makefile.in
+
+pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
+hubsdir = $(pkgpyexecdir)/ui/tui/hubs
+hubs_PYTHON = *.py
diff --git a/pyanaconda/ui/tui/simpleline/Makefile.am b/pyanaconda/ui/tui/simpleline/Makefile.am
new file mode 100644
index 0000000..555931b
--- /dev/null
+++ b/pyanaconda/ui/tui/simpleline/Makefile.am
@@ -0,0 +1,24 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+SUBDIRS =
+
+MAINTAINERCLEANFILES = Makefile.in
+
+pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
+simplelinedir = $(pkgpyexecdir)/ui/tui/simpleline
+simpleline_PYTHON = *.py
diff --git a/pyanaconda/ui/tui/spokes/Makefile.am b/pyanaconda/ui/tui/spokes/Makefile.am
new file mode 100644
index 0000000..96cdff9
--- /dev/null
+++ b/pyanaconda/ui/tui/spokes/Makefile.am
@@ -0,0 +1,24 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+SUBDIRS =
+
+MAINTAINERCLEANFILES = Makefile.in
+
+pkgpyexecdir = $(pyexecdir)/py$(PACKAGE_NAME)
+spokesdir = $(pkgpyexecdir)/ui/tui/spokes
+spokes_PYTHON = *.py
diff --git a/pyanaconda/ui/tui/tools/Makefile.am b/pyanaconda/ui/tui/tools/Makefile.am
new file mode 100644
index 0000000..abd5472
--- /dev/null
+++ b/pyanaconda/ui/tui/tools/Makefile.am
@@ -0,0 +1,18 @@
+# Copyright (C) 2011 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens at redhat.com>
+
+EXTRA_DIST = run-text-hub.py run-text-spoke.py
diff --git a/pyanaconda/ui/tui/tools/run-hub.py b/pyanaconda/ui/tui/tools/run-hub.py
deleted file mode 120000
index 4583bed..0000000
--- a/pyanaconda/ui/tui/tools/run-hub.py
+++ /dev/null
@@ -1 +0,0 @@
-run-spoke.py
\ No newline at end of file
diff --git a/pyanaconda/ui/tui/tools/run-spoke.py b/pyanaconda/ui/tui/tools/run-spoke.py
deleted file mode 100755
index d5e9c57..0000000
--- a/pyanaconda/ui/tui/tools/run-spoke.py
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/usr/bin/python
-
-import sys, os
-import os.path
-
-# Check command line arguments
-if len(sys.argv)<2:
- print "Usage: $0 <spoke module name> [<spoke widget class>]"
- sys.exit(1)
-
-# Logging always needs to be set up first thing, or there'll be tracebacks.
-from pyanaconda import anaconda_log
-anaconda_log.init()
-
-from pyanaconda.installclass import DefaultInstall
-from pyanaconda.storage import Storage
-from pyanaconda.threads import initThreading
-from pyanaconda.packaging.yumpayload import YumPayload
-from pyanaconda.platform import getPlatform
-from pykickstart.version import makeVersion
-from pyanaconda.ui.tui.simpleline import App
-from pyanaconda.ui.tui import YesNoDialog
-
-# Don't worry with fcoe, iscsi, dasd, any of that crud.
-from pyanaconda.flags import flags
-flags.imageInstall = True
-flags.testing = True
-
-initThreading()
-
-# Figure out the part we are about to show: hub/spoke?
-# And get the name of the module which represents it
-if os.path.basename(sys.argv[0]) == "run-spoke.py":
- spokeModuleName = "pyanaconda.ui.tui.spokes.%s" % sys.argv[1]
- from pyanaconda.ui.common import Spoke
- spokeBaseClass = Spoke
- spokeText = "spoke"
- SpokeText = "Spoke"
-elif os.path.basename(sys.argv[0]) == "run-hub.py":
- spokeModuleName = "pyanaconda.ui.tui.hubs.%s" % sys.argv[1]
- from pyanaconda.ui.common import Hub
- spokeBaseClass = Hub
- spokeText = "hub"
- SpokeText = "Hub"
-else:
- print "You have to run this command as run-spoke.py or run-hub.py."
- sys.exit(1)
-
-# Set default spoke class
-spokeClass = None
-spokeClassName = None
-
-# Load spoke specified on the command line
-# If the spoke module was specified, but the spoke class was not,
-# try to find it using class hierarchy
-try:
- spokeClassName = sys.argv[2]
- __import__(spokeModuleName, fromlist = [spokeClassName])
- spokeModule = sys.modules[spokeModuleName]
-except IndexError:
- __import__(spokeModuleName)
- spokeModule = sys.modules[spokeModuleName]
- for k,v in vars(spokeModule).iteritems():
- try:
- print k,v
- if issubclass(v, spokeBaseClass) and v != spokeBaseClass:
- spokeClassName = k
- spokeClass = v
- except TypeError:
- pass
-
-if not spokeClass:
- try:
- spokeClass = getattr(spokeModule, spokeClassName)
- except KeyError:
- print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName)
- sys.exit(1)
-
-
-print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule)
-
-platform = getPlatform()
-ksdata = makeVersion()
-storage = Storage(data=ksdata, platform=platform)
-storage.reset()
-instclass = DefaultInstall()
-app = App("TEST HARNESS", yes_or_no_question = YesNoDialog)
-
-payload = YumPayload(ksdata)
-payload.setup(storage)
-payload.install_log = sys.stdout
-
-spoke = spokeClass(app, ksdata, storage, payload, instclass)
-
-if not spoke.showable:
- print "This %s is not showable, but I'll continue anyway." % spokeText
-
-app.schedule_screen(spoke)
-app.run()
-
-if hasattr(spoke, "status"):
- print "%s status:\n%s\n" % (SpokeText, spoke.status)
-if hasattr(spoke, "completed"):
- print "%s completed:\n%s\n" % (SpokeText, spoke.completed)
-print "%s kickstart fragment:\n%s" % (SpokeText, ksdata)
diff --git a/pyanaconda/ui/tui/tools/run-text-hub.py b/pyanaconda/ui/tui/tools/run-text-hub.py
new file mode 120000
index 0000000..506993e
--- /dev/null
+++ b/pyanaconda/ui/tui/tools/run-text-hub.py
@@ -0,0 +1 @@
+run-text-spoke.py
\ No newline at end of file
diff --git a/pyanaconda/ui/tui/tools/run-text-spoke.py b/pyanaconda/ui/tui/tools/run-text-spoke.py
new file mode 100755
index 0000000..d5e9c57
--- /dev/null
+++ b/pyanaconda/ui/tui/tools/run-text-spoke.py
@@ -0,0 +1,105 @@
+#!/usr/bin/python
+
+import sys, os
+import os.path
+
+# Check command line arguments
+if len(sys.argv)<2:
+ print "Usage: $0 <spoke module name> [<spoke widget class>]"
+ sys.exit(1)
+
+# Logging always needs to be set up first thing, or there'll be tracebacks.
+from pyanaconda import anaconda_log
+anaconda_log.init()
+
+from pyanaconda.installclass import DefaultInstall
+from pyanaconda.storage import Storage
+from pyanaconda.threads import initThreading
+from pyanaconda.packaging.yumpayload import YumPayload
+from pyanaconda.platform import getPlatform
+from pykickstart.version import makeVersion
+from pyanaconda.ui.tui.simpleline import App
+from pyanaconda.ui.tui import YesNoDialog
+
+# Don't worry with fcoe, iscsi, dasd, any of that crud.
+from pyanaconda.flags import flags
+flags.imageInstall = True
+flags.testing = True
+
+initThreading()
+
+# Figure out the part we are about to show: hub/spoke?
+# And get the name of the module which represents it
+if os.path.basename(sys.argv[0]) == "run-spoke.py":
+ spokeModuleName = "pyanaconda.ui.tui.spokes.%s" % sys.argv[1]
+ from pyanaconda.ui.common import Spoke
+ spokeBaseClass = Spoke
+ spokeText = "spoke"
+ SpokeText = "Spoke"
+elif os.path.basename(sys.argv[0]) == "run-hub.py":
+ spokeModuleName = "pyanaconda.ui.tui.hubs.%s" % sys.argv[1]
+ from pyanaconda.ui.common import Hub
+ spokeBaseClass = Hub
+ spokeText = "hub"
+ SpokeText = "Hub"
+else:
+ print "You have to run this command as run-spoke.py or run-hub.py."
+ sys.exit(1)
+
+# Set default spoke class
+spokeClass = None
+spokeClassName = None
+
+# Load spoke specified on the command line
+# If the spoke module was specified, but the spoke class was not,
+# try to find it using class hierarchy
+try:
+ spokeClassName = sys.argv[2]
+ __import__(spokeModuleName, fromlist = [spokeClassName])
+ spokeModule = sys.modules[spokeModuleName]
+except IndexError:
+ __import__(spokeModuleName)
+ spokeModule = sys.modules[spokeModuleName]
+ for k,v in vars(spokeModule).iteritems():
+ try:
+ print k,v
+ if issubclass(v, spokeBaseClass) and v != spokeBaseClass:
+ spokeClassName = k
+ spokeClass = v
+ except TypeError:
+ pass
+
+if not spokeClass:
+ try:
+ spokeClass = getattr(spokeModule, spokeClassName)
+ except KeyError:
+ print "%s %s could not be found in %s" % (SpokeText, spokeClassName, spokeModuleName)
+ sys.exit(1)
+
+
+print "Running %s %s from %s" % (spokeText, spokeClass, spokeModule)
+
+platform = getPlatform()
+ksdata = makeVersion()
+storage = Storage(data=ksdata, platform=platform)
+storage.reset()
+instclass = DefaultInstall()
+app = App("TEST HARNESS", yes_or_no_question = YesNoDialog)
+
+payload = YumPayload(ksdata)
+payload.setup(storage)
+payload.install_log = sys.stdout
+
+spoke = spokeClass(app, ksdata, storage, payload, instclass)
+
+if not spoke.showable:
+ print "This %s is not showable, but I'll continue anyway." % spokeText
+
+app.schedule_screen(spoke)
+app.run()
+
+if hasattr(spoke, "status"):
+ print "%s status:\n%s\n" % (SpokeText, spoke.status)
+if hasattr(spoke, "completed"):
+ print "%s completed:\n%s\n" % (SpokeText, spoke.completed)
+print "%s kickstart fragment:\n%s" % (SpokeText, ksdata)
--
1.7.10.4
More information about the anaconda-patches
mailing list