------------------------------------------------------------
revno: 6714
committer: Barry Warsaw <[email protected]>
branch nick: restful
timestamp: Wed 2009-04-01 15:14:24 -0500
message:
Hook in lazr.restful (which isn't in the Cheeseshop yet).
Add infrastructure that the first REST interface will use, i.e. providing the
Mailman and Python versions.
Update bin/version
added:
src/mailman/core/system.py
src/mailman/docs/version.txt
src/mailman/interfaces/system.py
modified:
buildout.cfg
src/mailman/bin/version.py
src/mailman/interfaces/domain.py
src/mailman/version.py
=== modified file 'buildout.cfg'
--- buildout.cfg 2009-03-29 20:40:22 +0000
+++ buildout.cfg 2009-04-01 20:14:24 +0000
@@ -13,6 +13,7 @@
argparse
lazr.config
lazr.delegates
+ /Users/barry/projects/lazr/lazr.restful
locknix
mailman
munepy
=== modified file 'src/mailman/bin/version.py'
--- src/mailman/bin/version.py 2009-01-01 22:16:51 +0000
+++ src/mailman/bin/version.py 2009-04-01 20:14:24 +0000
@@ -15,32 +15,31 @@
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
-import optparse
-
-from mailman import version
+"""Print the Mailman version."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'main',
+ ]
+
+
+from mailman.core.system import system
from mailman.i18n import _
+from mailman.options import Options
-def parseargs():
- parser = optparse.OptionParser(version=version.MAILMAN_VERSION,
- usage=_("""\
+class ScriptOptions(Options):
+ usage = _("""\
%prog
-Print the Mailman version and exit."""))
- opts, args = parser.parse_args()
- if args:
- parser.error(_('Unexpected arguments'))
- return parser, opts, args
+Print the Mailman version and exit.""")
def main():
- parser, opts, args = parseargs()
- # Yes, this is kind of silly
- print _('Using $version.MAILMAN_VERSION ($version.CODENAME)')
-
-
-
-if __name__ == '__main__':
- main()
+ options = ScriptOptions()
+ options.initialize()
+ print _('Using $system.mailman_version')
=== added file 'src/mailman/core/system.py'
--- src/mailman/core/system.py 1970-01-01 00:00:00 +0000
+++ src/mailman/core/system.py 2009-04-01 20:14:24 +0000
@@ -0,0 +1,48 @@
+# Copyright (C) 2009 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman 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 General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+
+"""System information."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'system',
+ ]
+
+
+import sys
+from zope.interface import implements
+
+from mailman import version
+from mailman.interfaces.system import ISystem
+
+
+
+class System:
+ implements(ISystem)
+
+ @property
+ def mailman_version(self):
+ return version.MAILMAN_VERSION_FULL
+
+ @property
+ def python_version(self):
+ return sys.version
+
+
+system = System()
=== added file 'src/mailman/docs/version.txt'
--- src/mailman/docs/version.txt 1970-01-01 00:00:00 +0000
+++ src/mailman/docs/version.txt 2009-04-01 20:14:24 +0000
@@ -0,0 +1,26 @@
+System versions
+===============
+
+Mailman system information is available through the System object, which
+implements the ISystem interface.
+
+ >>> from mailman.interfaces.system import ISystem
+ >>> from mailman.core.system import system
+ >>> from zope.interface.verify import verifyObject
+
+ >>> verifyObject(ISystem, system)
+ True
+
+The Mailman version is available via the system object.
+
+ >>> print system.mailman_version
+ GNU Mailman ...
+
+The Python version running underneath is also available via the system
+object.
+
+ # The entire python_version string is variable, so this is the best test
+ # we can do.
+ >>> import sys
+ >>> system.python_version == sys.version
+ True
=== modified file 'src/mailman/interfaces/domain.py'
--- src/mailman/interfaces/domain.py 2009-01-17 02:04:21 +0000
+++ src/mailman/interfaces/domain.py 2009-04-01 20:14:24 +0000
@@ -61,7 +61,7 @@
contact_address = Attribute(
"""The contact address for the human at this domain.
- E.g. [email protected].
+ E.g. [email protected]
:type: string
""")
=== added file 'src/mailman/interfaces/system.py'
--- src/mailman/interfaces/system.py 1970-01-01 00:00:00 +0000
+++ src/mailman/interfaces/system.py 2009-04-01 20:14:24 +0000
@@ -0,0 +1,39 @@
+# Copyright (C) 2009 by the Free Software Foundation, Inc.
+#
+# This file is part of GNU Mailman.
+#
+# GNU Mailman is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# GNU Mailman 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 General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+
+"""System information."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'ISystem',
+ ]
+
+
+from zope.interface import Interface, Attribute
+
+
+
+class ISystem(Interface):
+ """Information about the Mailman system."""
+
+ mailman_version = Attribute(
+ """The GNU Mailman version, as a string.""")
+
+ python_version = Attribute(
+ """The version of Python running Mailman, as a string.""")
=== modified file 'src/mailman/version.py'
--- src/mailman/version.py 2009-01-03 19:16:52 +0000
+++ src/mailman/version.py 2009-04-01 20:14:24 +0000
@@ -46,3 +46,4 @@
# Printable version string used by command line scripts
MAILMAN_VERSION = 'GNU Mailman ' + VERSION
+MAILMAN_VERSION_FULL = MAILMAN_VERSION + ' (' + CODENAME + ')'
--
Primary development focus
https://code.launchpad.net/~mailman-coders/mailman/3.0
Your team Mailman Checkins is subscribed to branch lp:mailman.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/3.0/+edit-subscription.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org