Author: tmckay
Date: 2011-02-15 19:56:52 +0000 (Tue, 15 Feb 2011)
New Revision: 4531
Modified:
trunk/cumin/Makefile
trunk/cumin/python/cumin/account/widgets.py
trunk/cumin/python/cumin/account/widgets.strings
Log:
Add an "About the console" tab under "Your Account" in the UI.
Extend cumin/Makefile to allow the creation of a version file from
svn info or argumentn to make, allow optional distinction for local
development versions. Version file will also be created as part
of "make install".
BZ630544
Modified: trunk/cumin/Makefile
===================================================================
--- trunk/cumin/Makefile 2011-02-15 16:21:29 UTC (rev 4530)
+++ trunk/cumin/Makefile 2011-02-15 19:56:52 UTC (rev 4531)
@@ -1,12 +1,24 @@
-.phony: build install clean check
+.phony: build install clean check clean-version write-version mark-local version
version-local
include ../etc/Makefile.common
+# Attempt to build a version from svn info if we don't already have one
+ifndef CUMIN_VERSION
+VERSION_REV = $(shell svn info .. 2> /dev/null | fgrep "Last Changed Rev:" |
cut -d " " -f 4)
+endif
+
+# if CUMIN_VERSION wasn't passed in, and svn info worked, set CUMIN_VERSION
+ifneq ($(strip $(VERSION_REV)),)
+CUMIN_VERSION = 0.1.$(VERSION_REV)
+endif
+
+VERSION_FILE = $(CUMIN_HOME)/version
+
build:
python -m compileall -x '/\.svn' -f python
install: CUMIN_HOME := $(shell mktemp -d)
-install: build
+install: build version
install -d ${CUMIN_HOME}/bin
install -pm 0755 bin/cumin bin/cumin-* ${CUMIN_HOME}/bin
install -d ${CUMIN_HOME}/doc
@@ -29,8 +41,29 @@
bin/install-python-code ../parsley/python ${CUMIN_HOME}/python
find ${CUMIN_HOME} -type d
-clean: clean-python-files
+clean-version:
+ @ -rm -f $(VERSION_FILE)
+write-version: clean-version
+ifndef CUMIN_VERSION
+ @echo svn info failed, version file not created, this is okay
+else
+ @echo $(CUMIN_VERSION) > $(VERSION_FILE)
+ @chmod 0644 $(VERSION_FILE)
+endif
+
+mark-local:
+#if the file exists, allow the local mark to be applied
+ifeq ($(shell ls $(VERSION_FILE) 2> /dev/null),$(VERSION_FILE))
+ @echo local >> $(VERSION_FILE)
+endif
+
+version: write-version
+
+version-local: write-version mark-local
+
+clean: clean-python-files clean-version
+
check:
cumin-admin-test
cumin-data-test
Modified: trunk/cumin/python/cumin/account/widgets.py
===================================================================
--- trunk/cumin/python/cumin/account/widgets.py 2011-02-15 16:21:29 UTC (rev 4530)
+++ trunk/cumin/python/cumin/account/widgets.py 2011-02-15 19:56:52 UTC (rev 4531)
@@ -1,3 +1,5 @@
+import subprocess
+
from wooly import *
from wooly.widgets import *
from wooly.resources import *
@@ -32,6 +34,9 @@
self.settings = SettingsFrame(app, "main")
self.add_tab(self.settings)
+
+ self.about = AboutFrame(app, "about")
+ self.add_tab(self.about)
class SettingsFrame(Frame):
def __init__(self, app, name):
@@ -59,6 +64,42 @@
def render_content(self, sessino):
return "Change password"
+class AboutFrame(Frame):
+ def __init__(self, app, name):
+ super(AboutFrame, self).__init__(app, name)
+ content = AboutContent(app, "about_content")
+ self.add_child(content)
+
+ def render_title(self, session):
+ return "About the console"
+
+class AboutContent(Widget):
+ def __init__(self, app, name):
+ super(AboutContent, self).__init__(app, name)
+
+ self.version_string = ""
+ self.version_local = False
+
+ # Look for version info in our well-known file.
+ version_path = os.path.join(self.app.home, "version")
+ if os.path.isfile(version_path):
+ # Permission errors or corrupt file always possible
+ try:
+ f = open(version_path)
+ self.version_string = f.readline().strip()
+ self.version_local = f.readline().strip() == "local"
+ except:
+ pass
+
+ if len(self.version_string) == 0:
+ self.version_string = "Version has not been set"
+
+ def render_version(self, session):
+ res = self.version_string
+ if self.version_local:
+ res += ", devel instance"
+ return res
+
class LoginPage(HtmlPage):
def __init__(self, app, name):
super(LoginPage, self).__init__(app, name)
Modified: trunk/cumin/python/cumin/account/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/account/widgets.strings 2011-02-15 16:21:29 UTC (rev 4530)
+++ trunk/cumin/python/cumin/account/widgets.strings 2011-02-15 19:56:52 UTC (rev 4531)
@@ -75,3 +75,10 @@
[LoginForm.login_invalid]
<p class="login_invalid">The user name and password you entered do not
match any account.</p>
+
+[AboutContent.html]
+<div>
+<h3>Management console version</h3>
+{version}
+</div>
+
Show replies by date