Commit 6d2f1b48 by Chris Jerdonek

Got tox working with Python 2.4 through 3.2 (2.4, 2.5, 2.6, 2.7, 3.2).

parent f124d46e
......@@ -9,8 +9,9 @@ from pystache.renderer import Renderer
from pystache.template_spec import TemplateSpec
__all__ = ['render', 'Renderer', 'TemplateSpec']
__all__ = ['__version__', 'render', 'Renderer', 'TemplateSpec']
__version__ = '0.5.0-rc' # Also change in setup.py.
def render(template, context=None, **kwargs):
"""
......
......@@ -38,15 +38,22 @@ as described here, for example:
import os
import sys
try:
py_version = sys.version_info
# Distribute works with Python 2.3.5 and above:
# http://packages.python.org/distribute/setuptools.html#building-and-distributing-packages-with-distribute
if py_version < (2, 3, 5):
import distutils as dist
from distutils import core
setup = core.setup
else:
import setuptools as dist
except ImportError:
from distutils import core as dist
setup = dist.setup
# TODO: use the logging module instead.
# TODO: use the logging module instead of printing.
print("Using: version %s of %s" % (repr(dist.__version__), repr(dist)))
setup = dist.setup
VERSION = '0.5.0-rc' # Also change in pystache/init.py.
def publish():
......@@ -80,7 +87,7 @@ template_files = ['*.mustache', '*.txt']
#
# http://packages.python.org/distribute/python3.html#note-on-compatibility-with-setuptools
#
if sys.version_info < (3, ):
if py_version < (3, ):
extra = {}
else:
extra = {
......@@ -89,6 +96,35 @@ else:
'convert_2to3_doctests': ['README.rst'],
}
# We use the package simplejson for older Python versions since Python
# does not contain the module json before 2.6:
#
# http://docs.python.org/library/json.html
#
# Moreover, simplejson stopped officially support for Python 2.4 in version 2.1.0:
#
# https://github.com/simplejson/simplejson/blob/master/CHANGES.txt
#
requires = []
if py_version < (2, 5):
requires.append('simplejson<2.1')
elif py_version < (2, 6):
requires.append('simplejson')
else:
requires.append('pyyaml')
INSTALL_REQUIRES = requires
PACKAGES = [
'pystache',
# The following packages are only for testing.
'examples',
'pystache.tests',
'pystache.tests.data',
'pystache.tests.data.locator'
]
setup(name='pystache',
version='0.5.0-rc',
license='MIT',
......@@ -98,7 +134,8 @@ setup(name='pystache',
author_email='chris@ozmm.org',
maintainer='Chris Jerdonek',
url='http://github.com/defunkt/pystache',
packages=dist.find_packages(),
install_requires=INSTALL_REQUIRES,
packages=PACKAGES,
package_data = {
# Include the README so doctests can be run.
# TODO: is there a better way to include the README?
......
# A tox configuration file to test across multiple Python versions.
#
# http://pypi.python.org/pypi/tox
#
[tox]
envlist = py32,py31,py27,py26,py25,py24
[testenv]
deps =
# Distribute works with Python 2.3.5 and above:
# http://packages.python.org/distribute/setuptools.html#building-and-distributing-packages-with-distribute
distribute
commands =
python setup.py --quiet test
# We use nosetests for older versions of Python to find doctests because
# the load_tests protocol (which we use for finding doctests when using
# Distribute's `test`) was not introduced until Python 2.7.
[testenv:py26]
deps =
nose
commands =
python setup.py --quiet nosetests
[testenv:py25]
deps =
nose
commands =
python setup.py --quiet nosetests
[testenv:py24]
deps =
nose
commands =
python setup.py --quiet nosetests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment