Commits

Anonymous committed 16d586c

Big cleanup

Comments (0)

Files changed (25)

 
 *.pyc
 *.pyo
+tmp
 build
 dist
+.coverage*
+coverage
+docs/build
+docs/source/api
 pymills.egg-info
-docs/.build
+__version__.py
+Copyright (C) 2004-2010 James Mills
+
+pymills is covered by the MIT license::
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+include LICENSE Makefile README
-.PHONY: all clean checks tests
+.PHONY: help clean docs tests packages
 
-all: clean checks tests
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  clean     to cleanup build and temporary files"
+	@echo "  docs      to build the documentation"
+	@echo "  tests     to run the test suite"
+	@echo "  packages  to build python source and egg packages"
 
 clean:
-	@rm -rf build dist pymills.egg-info
+	@rm -rf build dist pymills.egg-info pymills/__version__.py
+	@rm -rf .coverage coverage
+	@rm -rf docs/build
 	@find . -name '*.pyc' -delete
 	@find . -name '*.pyo' -delete
 	@find . -name '*~' -delete
 
-checks:
-	@find . -name "*.py" -exec pyflakes {} +
+docs:
+	@make -C docs html
+
+packages:
+	@tools/mkpkgs -p python2.5
+	@tools/mkpkgs -p python2.6
 
 tests:
-	@nosetests \
-		--with-coverage \
-		--cover-package=pymills \
-		--cover-erase \
-		--cover-inclusive \
-		--with-doctest
+	@py.test -x -r fsxX \
+		--ignore=tmp \
+		--pastebin=all \
+		--cov=pymills \
+		--cov-html \
+		--cov-html-dir=coverage \
+		--cov-no-terminal \
+		tests/
+		#--cov-combine-each \
+		#--dist=each \
+		#--tx=popen//python=/usr/bin/python2.5 \
+		#--tx=popen//python=/usr/bin/python2.6 \
+		#tests/
+pymills is a collection of various useful utility modules maintained by
+James Mills. Some are written by James Mills while others are borrowed
+from other sources and attributed.
+
+pymills was created by and is primarily maintained by
+`James Mills <http://prologic.shortcircuit.net.au/>`_

docs/AUTHORS

-pymills is written and maintained by:
- James Mills, prologic at shortcircuit dot net dot au
-
-Other contributors are noted in the :copyright: fields within the docstrings
-of the respective files.
-
-Many thanks for all contributions!

docs/EXAMPLES

-Projects using pymills
-======================
-
-This is an (incomplete) list of projects that use pymills or are
-experimenting with using it for their application/system.  If you like
-to be included, please file a new "Documentation" ticket via pymills'
-Trac at <http://trac.shortcircuit.net.au/pymills/newticket>
-
-* pircsrv: http://trac.shortcircuit.net.au/pircsrv/
-* kdb: http://pypi.python.org/pypi/kdb/
-* reportgen: http://tams.com.au/

docs/INSTALL

-pymills Installation Guide
-==========================
-pymills is a collection of works by James Mills containing
-general purpose and special purpose libraries and modules
-for the Python programming language. Most libraries and
-modules are based around a core component of pymills, the
-"event" library.
-
-pymills provides a very easy to use and powerful event
-library enabling asyncronous and event-driven applications
-and system to be developed. Software systems and applications
-written with pymills.event are broken up into components
-and can be distributed across different nodes.
-
-pymills also contains an ann library which provides the
-building blocks to build artificial neural networks in
-an asyncronous/event-driven manner closely modelling
-biological neural networks.
-
-
-Requirements
-------------
-To install pymills, the following software packages must be installed:
-
- * Python, version >= 2.4.
-
-
-Installing pymills
-------------------
-The command:
-
-  $ python ./setup.py install
-
-will byte-compile the python source code and install it in the
-site-packages directory of your python installation. The directory examples
-will be copied to ``$prefix/share/pymills/``.
-
-Note: you'll need root permissions or equivalent for this step.
-
-To install pymills in a different location, or use other advanced installation
-options, run:
-
-  $ python ./setup.py --help
-
-
-Installing pymills on Windows
---------------------------
-If you downloaded the pymills installer (the .exe file), installing is simply a
-matter of running the installer.
-
-
-Using pymills
--------------
-Once you have installed pymills, it should be available to import into your
-python application or system The statement:
-
-import pymills
-
-will import the pymills package. To import a specific library or module:
-
-from pymills import event
-
-will import the event library.
-
-Please read the documentation on the pymills website or through the python
-pydoc command or help() function:
-
-pydoc pymills
-
-help(pymills)
-
-Enjoy!
-
-/James Mills
-
-Visit the pymills open source project at <http://trac.shortcircuit.net.au/pymills/>

docs/LICENSE

-Copyright (c) 2006-2008 by the respective authors (see AUTHORS file).
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-
-    * The names of the contributors may not be used to endorse or
-      promote products derived from this software without specific
-      prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp epub latex changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pymills.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pymills.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) build/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/pymills"
+	@echo "# ln -s build/devhelp $$HOME/.local/share/devhelp/pymills"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+latexpdf: latex
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C build/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in build/latex."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."

docs/README

-About pymills
-=============
-
-pymills is a collection of works by James Mills containing
-general purpose and special purpose libraries and modules
-for the Python programming language. Most libraries and
-modules are based around a core component of pymills, the
-"event" library.
-
-pymills provides a very easy to use and powerful event
-library enabling asyncronous and event-driven applications
-and system to be developed. Software systems and applications
-written with pymills.event are broken up into components
-and can be distributed across different nodes.
-
-pymills also contains an ann library which provides the
-building blocks to build artificial neural networks in
-an asyncronous/event-driven manner closely modelling
-biological neural networks.
-
-pymills is distributed using the GNU License.
-
- * For installation instructions, please see the INSTALL. *
-
-You might also want to take a look at the RELEASE and ChangeLog files for more
-information.
-
-Otherwise, the primary source of information is the main pymills web site:
-
- <http://trac.shortcircuit.net.au/pymills/>
-
-I hope you enjoy it,
-
-/James Mills

docs/RELEASE

-Release Notes for pymills 3.3.3
-===============================
-5th January 2008
-
-I'm happy to announce the pymills 3.3.3 release, available from:
-
-  http://trac.shortcircuit.net.au.org/pymills/Downloads
-
-New in this release:
-
- * NEW example: pysqlplus, a command line sql tool that supports any db that pymills.db does with pretty ascii table output and command history
- * io.py: Fixed poll method
- * db.py: Removed __del__ method. Added close and rollback methods
- * io.py: Improved Table (ascii)
- * io.py: NEW toHTML support in Table class
-  * With support for class, style and align
- * db.py: NEW pivot and variance functions for data transformations
- * db.py: Improved Record class
- * db.py: Improved class hiearchy and structure
- * db.py: Support for Oracle added
- * emailtools.py: NEW module for handlnig simple and complex email operations
-  * Includes support for multi-part and attachments
-  * Includes support for cc and bcc
- * db.py: Test suite added
- * db.py: NEW getCursor() and newCursor() methods
- * db.py: Can execute a previously prepared query by passing None as 'sql' arg.
- * event.py: Improved logging of events (before and after execution)
-
-For questions, comments and user discussions, please use the pymills IRC
-channel on irc://irc.freenode.net#pymills
-
-This is the first release. Please read the documentation provided
-to learn more about pymills and how to use it.

docs/THANKS

- * Noah Kantrowitz (coderanger)   noah@coderanger.net
- * Ddanny Rawlins (Romster)       romster@shortcircuit.net.au
-
-The ever so elusive Anonymous.
-
-----

docs/dependencies.pdf

Binary file removed.
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pymills.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pymills.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% build/devhelp
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end

docs/source/conf.py

+# -*- coding: utf-8 -*-
+#
+# pymills documentation build configuration file, created by
+# sphinx-quickstart on Thu Jul 22 11:46:56 2010.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'pymills'
+copyright = u'2010, James Mills'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '3.5'
+# The full version, including alpha/beta/rc tags.
+release = '3.5'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'pymillsdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'pymills.tex', u'pymills Documentation',
+   u'James Mills', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
+
+# -- Options for Epub output ---------------------------------------------------
+
+# Bibliographic Dublin Core info.
+#epub_title = ''
+#epub_author = ''
+#epub_publisher = ''
+#epub_copyright = ''
+
+# The language of the text. It defaults to the language option
+# or en if the language is not set.
+#epub_language = ''
+
+# The scheme of the identifier. Typical schemes are ISBN or URL.
+#epub_scheme = ''
+
+# The unique identifier of the text. This can be a ISBN number
+# or the project homepage.
+#epub_identifier = ''
+
+# A unique identification for the text.
+#epub_uid = ''
+
+# HTML files that should be inserted before the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_pre_files = []
+
+# HTML files shat should be inserted after the pages created by sphinx.
+# The format is a list of tuples containing the path and title.
+#epub_post_files = []
+
+# A list of files that should not be packed into the epub file.
+#epub_exclude_files = []
+
+# The depth of the table of contents in toc.ncx.
+#epub_tocdepth = 3
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}

docs/source/index.rst

+.. pymills documentation master file, created by
+   sphinx-quickstart on Thu Jul 22 11:46:56 2010.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to pymills's documentation!
+===================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

docs/trac_banner.png

Removed
Old image

ez_setup.py

-#!python
-"""Bootstrap setuptools installation
-
-If you want to use setuptools in your package's setup.py, just include this
-file in the same directory with it, and add this to the top of your setup.py::
-
-    from ez_setup import use_setuptools
-    use_setuptools()
-
-If you want to require a specific version of setuptools, set a download
-mirror, or use an alternate download directory, you can do so by supplying
-the appropriate options to ``use_setuptools()``.
-
-This file can also be run as a script to install or upgrade setuptools.
-"""
-import sys
-DEFAULT_VERSION = "0.6c8"
-DEFAULT_URL     = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
-
-md5_data = {
-    'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
-    'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
-    'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
-    'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
-    'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
-    'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
-    'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
-    'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
-    'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
-    'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
-    'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
-    'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
-    'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
-    'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
-    'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
-    'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
-    'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
-    'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
-    'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
-    'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
-    'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
-    'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
-    'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
-    'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
-    'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
-    'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
-    'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
-    'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
-    'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
-    'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
-}
-
-import sys, os
-
-def _validate_md5(egg_name, data):
-    if egg_name in md5_data:
-        from md5 import md5
-        digest = md5(data).hexdigest()
-        if digest != md5_data[egg_name]:
-            print >>sys.stderr, (
-                "md5 validation of %s failed!  (Possible download problem?)"
-                % egg_name
-            )
-            sys.exit(2)
-    return data
-
-
-def use_setuptools(
-    version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
-    download_delay=15
-):
-    """Automatically find/download setuptools and make it available on sys.path
-
-    `version` should be a valid setuptools version number that is available
-    as an egg for download under the `download_base` URL (which should end with
-    a '/').  `to_dir` is the directory where setuptools will be downloaded, if
-    it is not already available.  If `download_delay` is specified, it should
-    be the number of seconds that will be paused before initiating a download,
-    should one be required.  If an older version of setuptools is installed,
-    this routine will print a message to ``sys.stderr`` and raise SystemExit in
-    an attempt to abort the calling script.
-    """
-    was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
-    def do_download():
-        egg = download_setuptools(version, download_base, to_dir, download_delay)
-        sys.path.insert(0, egg)
-        import setuptools; setuptools.bootstrap_install_from = egg
-    try:
-        import pkg_resources
-    except ImportError:
-        return do_download()       
-    try:
-        pkg_resources.require("setuptools>="+version); return
-    except pkg_resources.VersionConflict, e:
-        if was_imported:
-            print >>sys.stderr, (
-            "The required version of setuptools (>=%s) is not available, and\n"
-            "can't be installed while this script is running. Please install\n"
-            " a more recent version first, using 'easy_install -U setuptools'."
-            "\n\n(Currently using %r)"
-            ) % (version, e.args[0])
-            sys.exit(2)
-        else:
-            del pkg_resources, sys.modules['pkg_resources']    # reload ok
-            return do_download()
-    except pkg_resources.DistributionNotFound:
-        return do_download()
-
-def download_setuptools(
-    version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
-    delay = 15
-):
-    """Download setuptools from a specified location and return its filename
-
-    `version` should be a valid setuptools version number that is available
-    as an egg for download under the `download_base` URL (which should end
-    with a '/'). `to_dir` is the directory where the egg will be downloaded.
-    `delay` is the number of seconds to pause before an actual download attempt.
-    """
-    import urllib2, shutil
-    egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
-    url = download_base + egg_name
-    saveto = os.path.join(to_dir, egg_name)
-    src = dst = None
-    if not os.path.exists(saveto):  # Avoid repeated downloads
-        try:
-            from distutils import log
-            if delay:
-                log.warn("""
----------------------------------------------------------------------------
-This script requires setuptools version %s to run (even to display
-help).  I will attempt to download it for you (from
-%s), but
-you may need to enable firewall access for this script first.
-I will start the download in %d seconds.
-
-(Note: if this machine does not have network access, please obtain the file
-
-   %s
-
-and place it in this directory before rerunning this script.)
----------------------------------------------------------------------------""",
-                    version, download_base, delay, url
-                ); from time import sleep; sleep(delay)
-            log.warn("Downloading %s", url)
-            src = urllib2.urlopen(url)
-            # Read/write all in one block, so we don't create a corrupt file
-            # if the download is interrupted.
-            data = _validate_md5(egg_name, src.read())
-            dst = open(saveto,"wb"); dst.write(data)
-        finally:
-            if src: src.close()
-            if dst: dst.close()
-    return os.path.realpath(saveto)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-def main(argv, version=DEFAULT_VERSION):
-    """Install or upgrade setuptools and EasyInstall"""
-    try:
-        import setuptools
-    except ImportError:
-        egg = None
-        try:
-            egg = download_setuptools(version, delay=0)
-            sys.path.insert(0,egg)
-            from setuptools.command.easy_install import main
-            return main(list(argv)+[egg])   # we're done here
-        finally:
-            if egg and os.path.exists(egg):
-                os.unlink(egg)
-    else:
-        if setuptools.__version__ == '0.0.1':
-            print >>sys.stderr, (
-            "You have an obsolete version of setuptools installed.  Please\n"
-            "remove it from your system entirely before rerunning this script."
-            )
-            sys.exit(2)
-
-    req = "setuptools>="+version
-    import pkg_resources
-    try:
-        pkg_resources.require(req)
-    except pkg_resources.VersionConflict:
-        try:
-            from setuptools.command.easy_install import main
-        except ImportError:
-            from easy_install import main
-        main(list(argv)+[download_setuptools(delay=0)])
-        sys.exit(0) # try to force an exit
-    else:
-        if argv:
-            from setuptools.command.easy_install import main
-            main(argv)
-        else:
-            print "Setuptools version",version,"or greater has been installed."
-            print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
-
-def update_md5(filenames):
-    """Update our built-in md5 registry"""
-
-    import re
-    from md5 import md5
-
-    for name in filenames:
-        base = os.path.basename(name)
-        f = open(name,'rb')
-        md5_data[base] = md5(f.read()).hexdigest()
-        f.close()
-
-    data = ["    %r: %r,\n" % it for it in md5_data.items()]
-    data.sort()
-    repl = "".join(data)
-
-    import inspect
-    srcfile = inspect.getsourcefile(sys.modules[__name__])
-    f = open(srcfile, 'rb'); src = f.read(); f.close()
-
-    match = re.search("\nmd5_data = {\n([^}]+)}", src)
-    if not match:
-        print >>sys.stderr, "Internal error!"
-        sys.exit(2)
-
-    src = src[:match.start(1)] + repl + src[match.end(1):]
-    f = open(srcfile,'w')
-    f.write(src)
-    f.close()
-
-
-if __name__=='__main__':
-    if len(sys.argv)>2 and sys.argv[1]=='--md5update':
-        update_md5(sys.argv[2:])
-    else:
-        main(sys.argv[1:])
-
-
-
-
-

pymills/__init__.py

-# Module:	__init__
-# Date:		4th August 2004
-# Author:	James Mills, prologic at shortcircuit dot net dot au
+# Module:   __init__
+# Date:     22nd July 2010
+# Author:   James Mills, prologic at shortcircuit dot net dot au
 
-"""Library for Component/Event/Distributed Software Architectures
+"""pymills
 
-Pymills is a collection of works by James Mills containing
-general purpose and special purpose libraries and modules
-for the Python programming language. Most libraries and
-modules are based around a core component of pymills, the
-"event" library.
+Mills Python Library
 
-Pymills provides a very easy to use and powerful event
-library enabling asyncronous and event-driven applications
-and system to be developed. Software systems and applications
-written with pymills.event are broken up into components
-and can be distributed across different nodes.
-
-Pymills also contains an ann library which provides the
-building blocks to build artificial neural networks in
-an asyncronous/event-driven manner closely modelling
-biological neural networks.
+:copyright: CopyRight (C) 2004-2010 by James Mills
+:license: MIT (See: LICENSE)
 """
 
-__name__ = "pymills"
-__description__ = "James Mills Python Library"
-__version__ = "3.4"
-__author__ = "James Mills"
-__author_email__ = "%s, prologic at shortcircuit dot net dot au" % __author__
-__maintainer__ = __author__
-__maintainer_email__ = __author_email__
-__url__ = "http://trac.shortcircuit.net.au/pymills/"
-__download_url__ = "http://shortcircuit.net.au/~prologic/downloads/software/%s-%s.tar.gz" % (__name__, __version__)
-__copyright__ = "CopyRight (C) 2005-2007 by %s" % __author__
-__license__ = "GPL"
-__platforms__ = "POSIX"
-__keywords__ = "James Mills Python Library General Purpose"
-__classifiers__ = [
-		"Development Status :: 3 - Alpha",
-		"Development Status :: 4 - Beta",
-		"Development Status :: 5 - Production/Stable",
-		"Environment :: Other Environment",
-		"Intended Audience :: Developers",
-		"Intended Audience :: End Users/Desktop",
-		"License :: OSI Approved :: GNU General Public License (GPL)",
-		"Natural Language :: English",
-		"Operating System :: OS Independent",
-		"Programming Language :: Python",
-		"Topic :: Adaptive Technologies",
-		"Topic :: Communications :: Chat :: Internet Relay Chat",
-		"Topic :: Database :: Front-Ends",
-		"Topic :: Scientific/Engineering :: Artificial Intelligence",
-		"Topic :: Software Development :: Libraries",
-		"Topic :: Software Development :: Libraries :: Application Frameworks",
-		"Topic :: Software Development :: Libraries :: Python Modules",
-		]
-__str__ = "%s-%s" % (__name__, __version__)
-
-__package_data__ = {
-		}
-
-__install_requires__ = [
-		]
-
-__setup_requires__ = [
-		]
-
-__extras_require__ = {
-		}
-
-__entry_points__ = """
-"""
-
-__all__ = (
-		"ann",
-		"datatypes",
-		"db",
-		"env",
-		"event",
-		"io",
-		"irc",
-		"log",
-		"mem",
-		"misc",
-		"semnet",
-		"sockets",
-		"spider",
-		"test",
-		"timers",
-		"utils",
-		"ver",
-		"web",
-		)
+try:
+    from __version__ import version as __version__
+except ImportError:
+    __version__ = "unknown"

pymills/version.py

+# Module:   version
+# Date:     6th November 2008
+# Author:   James Mills, prologic at shortcircuit dot net dot au
+
+"""Version
+
+Borrowed from Mercurial project.
+"""
+
+# Copyright (C) 2005, 2006, 2008 by Intevation GmbH
+# Author(s):
+# Thomas Arendsen Hein <thomas@intevation.de>
+#
+# This program is free software under the GNU GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+import os
+import re
+
+from types import ModuleType
+
+unknown_version = 'unknown'
+remembered_version = False
+
+def get_version(doreload=False):
+    """Return version information if available."""
+    try:
+        import pymills.__version__
+        if doreload and type(pymills.__version__) == ModuleType:
+            reload(pymills.__version__)
+        if type(pymills.__version__) == ModuleType:
+            version = pymills.__version__.version
+        else:
+            version = pymills.__version__
+    except ImportError:
+        version = unknown_version
+    return version
+
+def write_version(version):
+    """Overwrite version file."""
+    if version == get_version():
+        return
+    directory = os.path.dirname(__file__)
+    for suffix in ['py', 'pyc', 'pyo']:
+        try:
+            os.unlink(os.path.join(directory, '__version__.%s' % suffix))
+        except OSError:
+            pass
+    f = open(os.path.join(directory, '__version__.py'), 'w')
+    f.write("# This file is auto-generated.\n")
+    f.write("version = %r\n" % version)
+    f.close()
+    # reload the file we've just written
+    get_version(True)
+
+def remember_version(version=None):
+    """Store version information."""
+    global remembered_version
+    if not version and os.path.isdir(".hg"):
+        f = os.popen("hg identify")  # use real hg installation
+        ident = f.read()[:-1]
+        if not f.close() and ident:
+            ids = ident.split(' ', 1)
+            version = ids.pop(0)
+            if version[-1] == '+':
+                version = version[:-1]
+            if version.isalnum() and ids:
+                for tag in ids[0].split('/'):
+                    # is a tag is suitable as a version number?
+                    if re.match(r'^(\d+\.)+[\w.-]+$', tag):
+                        version = tag
+                        break
+    if version:
+        remembered_version = True
+        write_version(version)
+
+def forget_version():
+    """Remove version information."""
+    if remembered_version:
+        write_version(unknown_version)

setup.cfg

-[egg_info]
-tag_build = dev
-tag_date = true
-
-[aliases]
-release = egg_info -RDb ''
 #!/usr/bin/env python
 
-from setuptools import setup, find_packages
+try:
+    from setuptools import setup, find_packages
+    HAS_SETUPTOOLS = True
+except ImportError:
+    from distutils.core import setup
+    HAS_SETUPTOOLS = False
 
-import pymills as pkg
+if not HAS_SETUPTOOLS:
+    import os
+    from distutils.util import convert_path
+
+    def find_packages(where=".", exclude=()):
+        """Borrowed directly from setuptools"""
+
+        out = []
+        stack = [(convert_path(where), "")]
+        while stack:
+            where, prefix = stack.pop(0)
+            for name in os.listdir(where):
+                fn = os.path.join(where, name)
+                if ("." not in name and os.path.isdir(fn) and 
+                        os.path.isfile(os.path.join(fn, "__init__.py"))):
+                    out.append(prefix+name)
+                    stack.append((fn, prefix + name + "."))
+
+        from fnmatch import fnmatchcase
+        for pat in list(exclude) + ["ez_setup"]:
+            out = [item for item in out if not fnmatchcase(item, pat)]
+
+        return out
+
+from pymills.version import forget_version, get_version, remember_version
+
+forget_version()
+version = remember_version()
 
 setup(
-		name=pkg.__name__,
-		version=pkg.__version__,
-		description=pkg.__description__,
-		long_description=pkg.__doc__,
-		author=pkg.__author__,
-		author_email=pkg.__author_email__,
-		maintainer=pkg.__maintainer__,
-		maintainer_email=pkg.__maintainer_email__,
-		url=pkg.__url__,
-		download_url=pkg.__download_url__,
-		classifiers=pkg.__classifiers__,
-		license=pkg.__license__,
-		keywords=pkg.__keywords__,
-		platforms=pkg.__platforms__,
-		packages=find_packages(),
-		install_requires=pkg.__install_requires__,
-		setup_requires=pkg.__setup_requires__,
-		extras_require=pkg.__extras_require__,
-		entry_points=pkg.__entry_points__,
-		package_data=pkg.__package_data__,
+    name="pymills",
+    version=get_version(),
+    description="Mills Python Library",
+    long_description=open("README", "r").read(),
+    author="James Mills",
+    author_email="James Mills, prologic at shortcircuit dot net dot au",
+    url="http://bitbucket.org/prologic/pymills/",
+    download_url="http://bitbucket.org/prologic/pymills/downloads/",
+    classifiers=[
+        "Development Status :: 4 - Beta",
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: MIT License",
+        "Natural Language :: English",
+        "Operating System :: POSIX :: Linux",
+        "Programming Language :: Python :: 2.6",
+        "Topic :: Database",
+        "Topic :: Software Development :: Libraries :: Python Modules",
+    ],
+    license="MIT",
+    keywords="James Mills Python Library Utilities Modules",
+    platforms="POSIX",
+    packages=find_packages("."),
 )

tests/__init__.py

+# Package:  tests
+# Date:     22nd July 2010
+# Author:   James Mills, prologic at shortcircuit dot net dot au
+
+"""Test Suite"""
+#!/bin/bash
+#
+#  mkpkgs
+# 
+#  Copyright (C) 2010 James Mills
+# 
+#  This program 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 2 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 General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 
+#  USA.
+#
+
+VERSION="0.1"
+
+test_application () {
+    application=${1}
+    $application --version &> /dev/null
+    if [[ $? != 0 ]]; then
+        echo "Cannot find or execute ${application}!"
+        exit 1
+    fi
+}
+
+get_latest_tag() {
+    echo "$(hg tags | awk '{if (NR == 2) print $1}')"
+}
+
+make_packages() {
+    cwd=$(pwd)
+    hg=$(which hg)
+	python=$(which ${1})
+
+    test_application "$hg"
+    test_application "$python"
+
+    status=$(hg status -0 -m)
+    if [[ $status ]]; then
+        echo "Working directory not in a clean state! Aborting..."
+        exit 2
+    fi
+
+    echo "Building packages for $python ..."
+
+    tag=$(get_latest_tag)
+
+    $hg update -C ${tag} &> /dev/null
+
+    $python setup.py clean &> /dev/null
+    $python setup.py build &> /dev/null
+    $python setup.py bdist_egg &> /dev/null
+    $python setup.py sdist --formats=bztar,gztar,zip &> /dev/null
+
+    $hg update -C &> /dev/null
+}
+
+print_help() {
+	echo "usage: $COMMAND [options] machines"
+	echo "options:"
+	echo "   -p=PYTHON  specify python binary to use"
+	echo "   -v         print version and exit"
+	echo "   -h         print help and exit"
+}
+
+parse_options() {
+	PYTHON="python2.6"
+
+	while getopts "p:vh-" OPT ; do
+		case $OPT in
+			p)
+				PYTHON="$OPTARG" ;;
+			v)
+				echo "$COMMAND $VERSION"
+				exit 0 ;;
+			h)
+				print_help
+				exit 0 ;;
+		esac
+	done
+
+	shift $(($OPTIND - 1))
+}
+
+main() {
+	parse_options "$@"
+
+    make_packages "$PYTHON"
+}
+
+### Main
+
+COMMAND=$(basename $0)
+
+main "$@"
+
+#n End of File