diff options
author | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-11-04 16:41:48 -0800 |
---|---|---|
committer | Chris Jerdonek <chris.jerdonek@gmail.com> | 2012-11-04 16:41:48 -0800 |
commit | 8fa4935986f0d8a868d9c9de3fa443960c710634 (patch) | |
tree | 8f6214aba83b46be37a93f82e401207ba6f58051 | |
parent | e457f64281cee4ca1de41cf91d5bb68928aedf60 (diff) | |
parent | 6a54b9a412354ae1e0a53bcb4db9d440b8c86dd6 (diff) | |
download | pystache-8fa4935986f0d8a868d9c9de3fa443960c710634.tar.gz |
Merge branch 'master' into development: changes for 0.5.3.
Conflicts:
TODO.md
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | HISTORY.md | 8 | ||||
-rw-r--r-- | MANIFEST.in | 3 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | TODO.md | 8 | ||||
-rw-r--r-- | pystache/__init__.py | 2 | ||||
-rw-r--r-- | pystache/tests/common.py | 5 | ||||
-rw-r--r-- | pystache/tests/main.py | 37 | ||||
-rw-r--r-- | setup.py | 6 | ||||
-rw-r--r-- | setup_description.rst | 25 | ||||
-rw-r--r-- | tox.ini | 4 |
11 files changed, 62 insertions, 40 deletions
diff --git a/.travis.yml b/.travis.yml index a426b13..a07a55f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,4 +12,4 @@ script: - python setup.py install # Include the spec tests directory for Mustache spec tests and the # project directory for doctests. - - pystache-test ext/spec/specs . + - pystache-test . ext/spec/specs @@ -3,8 +3,8 @@ History **Note:** Official support for Python 2.4 will end with Pystache version 0.6.0. -0.5.3 (TBD) ------------ +0.5.3 (2012-11-03) +------------------ - Added ability to customize string coercion (e.g. to have None render as `''`) (issue \#130). @@ -28,8 +28,8 @@ History when getting a key from a context stack (issue \#110). - Bugfix: lambda section values can now return non-ascii, non-unicode strings (issue \#118). -- Bugfix: running `test_pystache.py` from a downloaded sdist no longer - requires a spec test directory to pass. +- Bugfix: allow `test_pystache.py` and `tox` to pass when run from a + downloaded sdist (i.e. without the spec test directory). - Convert HISTORY and README files from reST to Markdown. - More robust handling of byte strings in Python 3. - Added Creative Commons license for David Phillips's logo. diff --git a/MANIFEST.in b/MANIFEST.in index 5a864fd..bdc64bf 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,3 +8,6 @@ include test_pystache.py # You cannot use package_data, for example, to include data files in a # source distribution when using Distribute. recursive-include pystache/tests *.mustache *.txt +# We deliberately exclude the gh/ directory because it contains copies +# of resources needed only for the web page hosted on GitHub (via the +# gh-pages branch). @@ -12,7 +12,7 @@ Pystache <!-- caption text shows up in the reST version converted by pandoc. --> ![](http://defunkt.github.com/pystache/images/logo_phillips.png "mustachioed, monocled snake by David Phillips") -![](https://secure.travis-ci.org/defunkt/pystache.png) +![](https://secure.travis-ci.org/defunkt/pystache.png "Travis CI current build status") [Pystache](http://defunkt.github.com/pystache) is a Python implementation of [Mustache](http://mustache.github.com/). Mustache is a @@ -3,12 +3,16 @@ TODO In development branch: +* Figure out a way to suppress center alignment of images in reST output. +* Add a unit test for the change made in 7ea8e7180c41. This is with regard + to not requiring spec tests when running tests from a downloaded sdist. * End support for Python 2.4. * Add Python 3.3 to tox file (after deprecating 2.4). -* Turn the benchmarking script at pystache/tests/benchmark.py into a command in pystache/commands, or - make it a subcommand of one of the existing commands (i.e. using a command argument). * Look into bypassing the _PartialNode class so that partials can be loaded and parsed at parse-time instead of at render-time. +* Turn the benchmarking script at pystache/tests/benchmark.py into a command + in pystache/commands, or make it a subcommand of one of the existing + commands (i.e. using a command argument). * Provide support for logging in at least one of the commands. * Make sure command parsing to pystache-test doesn't break with Python 2.4 and earlier. * Combine pystache-test with the main command. diff --git a/pystache/__init__.py b/pystache/__init__.py index 59dac98..71708c3 100644 --- a/pystache/__init__.py +++ b/pystache/__init__.py @@ -10,4 +10,4 @@ from pystache.init import parse, render, Renderer, TemplateSpec __all__ = ['parse', 'render', 'Renderer', 'TemplateSpec'] -__version__ = '0.5.3-rc' # Also change in setup.py. +__version__ = '0.5.3' # Also change in setup.py. diff --git a/pystache/tests/common.py b/pystache/tests/common.py index 99be4c8..222e14f 100644 --- a/pystache/tests/common.py +++ b/pystache/tests/common.py @@ -19,7 +19,6 @@ DATA_DIR = os.path.join(_TESTS_DIR, 'data') # i.e. 'pystache/tests/data'. EXAMPLES_DIR = os.path.dirname(examples.__file__) PACKAGE_DIR = os.path.dirname(pystache.__file__) PROJECT_DIR = os.path.join(PACKAGE_DIR, '..') -SPEC_TEST_DIR = os.path.join(PROJECT_DIR, 'ext', 'spec', 'specs') # TEXT_DOCTEST_PATHS: the paths to text files (i.e. non-module files) # containing doctests. The paths should be relative to the project directory. TEXT_DOCTEST_PATHS = ['README.md'] @@ -27,6 +26,10 @@ TEXT_DOCTEST_PATHS = ['README.md'] UNITTEST_FILE_PREFIX = "test_" +def get_spec_test_dir(project_dir): + return os.path.join(project_dir, 'ext', 'spec', 'specs') + + def html_escape(u): """ An html escape function that behaves the same in both Python 2 and 3. diff --git a/pystache/tests/main.py b/pystache/tests/main.py index 184122d..8af6b2e 100644 --- a/pystache/tests/main.py +++ b/pystache/tests/main.py @@ -13,8 +13,8 @@ import unittest from unittest import TestCase, TestProgram import pystache -from pystache.tests.common import PACKAGE_DIR, PROJECT_DIR, SPEC_TEST_DIR, UNITTEST_FILE_PREFIX -from pystache.tests.common import get_module_names +from pystache.tests.common import PACKAGE_DIR, PROJECT_DIR, UNITTEST_FILE_PREFIX +from pystache.tests.common import get_module_names, get_spec_test_dir from pystache.tests.doctesting import get_doctests from pystache.tests.spectesting import get_spec_tests @@ -87,39 +87,43 @@ def main(sys_argv): sys_argv: a reference to sys.argv. """ + # TODO: use logging module + print "pystache: running tests: argv: %s" % repr(sys_argv) + should_source_exist = False spec_test_dir = None project_dir = None if len(sys_argv) > 1 and sys_argv[1] == FROM_SOURCE_OPTION: + # This usually means the test_pystache.py convenience script + # in the source directory was run. should_source_exist = True sys_argv.pop(1) - # TODO: use logging module - print "pystache: running tests: expecting source: %s" % should_source_exist + try: + # TODO: use optparse command options instead. + project_dir = sys_argv[1] + sys_argv.pop(1) + except IndexError: + if should_source_exist: + project_dir = PROJECT_DIR try: # TODO: use optparse command options instead. spec_test_dir = sys_argv[1] sys_argv.pop(1) except IndexError: - if should_source_exist: - if not os.path.exists(SPEC_TEST_DIR): + if project_dir is not None: + # Then auto-detect the spec test directory. + _spec_test_dir = get_spec_test_dir(project_dir) + if not os.path.exists(_spec_test_dir): # Then the user is probably using a downloaded sdist rather # than a repository clone (since the sdist does not include # the spec test directory). print("pystache: skipping spec tests: spec test directory " "not found") else: - spec_test_dir = SPEC_TEST_DIR - - try: - # TODO: use optparse command options instead. - project_dir = sys_argv[1] - sys_argv.pop(1) - except IndexError: - if should_source_exist: - project_dir = PROJECT_DIR + spec_test_dir = _spec_test_dir if len(sys_argv) <= 1 or sys_argv[-1].startswith("-"): # Then no explicit module or test names were provided, so @@ -127,7 +131,8 @@ def main(sys_argv): module_names = _discover_test_modules(PACKAGE_DIR) sys_argv.extend(module_names) if project_dir is not None: - # Add the current module for unit tests contained here. + # Add the current module for unit tests contained here (e.g. + # to include SetupTests). sys_argv.append(__name__) SetupTests.project_dir = project_dir @@ -10,7 +10,7 @@ to release a new version of Pystache. (1) Prepare the release. Make sure the code is finalized and merged to master. Bump the version -number in setup.py, etc. +number in setup.py, update the release date in the HISTORY file, etc. Generate the reStructuredText long_description using-- @@ -112,7 +112,7 @@ else: setup = dist.setup -VERSION = '0.5.3-rc' # Also change in pystache/__init__.py. +VERSION = '0.5.3' # Also change in pystache/__init__.py. FILE_ENCODING = 'utf-8' @@ -365,7 +365,7 @@ def main(sys_argv): # TODO: use the logging module instead of printing. # TODO: include the following in a verbose mode. - print("pystache: using: version %s of %s" % (repr(dist.__version__), repr(dist))) + sys.stderr.write("pystache: using: version %s of %s\n" % (repr(dist.__version__), repr(dist))) command = sys_argv[-1] diff --git a/setup_description.rst b/setup_description.rst index 0f1f86c..e4a0900 100644 --- a/setup_description.rst +++ b/setup_description.rst @@ -4,15 +4,13 @@ Pystache ======== -.. figure:: https://s3.amazonaws.com/webdev_bucket/pystache.png - :align: center +.. figure:: http://defunkt.github.com/pystache/images/logo_phillips.png :alt: mustachioed, monocled snake by David Phillips -.. figure:: https://secure.travis-ci.org/defunkt/pystache.png?branch=master,development - :align: center - :alt: +.. figure:: https://secure.travis-ci.org/defunkt/pystache.png + :alt: Travis CI current build status -`Pystache <https://github.com/defunkt/pystache>`_ is a Python +`Pystache <http://defunkt.github.com/pystache>`_ is a Python implementation of `Mustache <http://mustache.github.com/>`_. Mustache is a framework-agnostic, logic-free templating system inspired by `ctemplate <http://code.google.com/p/google-ctemplate/>`_ and @@ -43,6 +41,7 @@ Pystache is tested with-- - Python 2.7 - Python 3.1 - Python 3.2 +- Python 3.3 - `PyPy <http://pypy.org/>`_ `Distribute <http://packages.python.org/distribute/>`_ (the setuptools @@ -66,6 +65,8 @@ as follows: pip install 'simplejson<2.1.0' +Official support for Python 2.4 will end with Pystache version 0.6.0. + Install It ---------- @@ -306,7 +307,7 @@ Credits Author: Chris Wanstrath Maintainer: Chris Jerdonek -Pystache logo by `David Phillips <http://davidphillips.us/>`_ and +Pystache logo by `David Phillips <http://davidphillips.us/>`_ is licensed under a `Creative Commons Attribution-ShareAlike 3.0 Unported License <http://creativecommons.org/licenses/by-sa/3.0/deed.en_US>`_. |image0| @@ -314,8 +315,11 @@ License <http://creativecommons.org/licenses/by-sa/3.0/deed.en_US>`_. History ======= -0.5.3 (TBD) ------------ +**Note:** Official support for Python 2.4 will end with Pystache version +0.6.0. + +0.5.3 (2012-11-03) +------------------ - Added ability to customize string coercion (e.g. to have None render as ``''``) (issue #130). @@ -330,6 +334,7 @@ History - Added a ``parse()`` function that yields a printable, pre-compiled parse tree. - Added support for rendering pre-compiled templates. +- Added Python 3.3 to the list of supported versions. - Added support for `PyPy <http://pypy.org/>`_ (issue #125). - Added support for `Travis CI <http://travis-ci.org>`_ (issue #124). [msabramo] @@ -339,6 +344,8 @@ History when getting a key from a context stack (issue #110). - Bugfix: lambda section values can now return non-ascii, non-unicode strings (issue #118). +- Bugfix: allow ``test_pystache.py`` and ``tox`` to pass when run from + a downloaded sdist (i.e. without the spec test directory). - Convert HISTORY and README files from reST to Markdown. - More robust handling of byte strings in Python 3. - Added Creative Commons license for David Phillips's logo. @@ -13,7 +13,7 @@ envlist = py24,py25,py26,py27,py27-yaml,py27-noargs,py31,py32,pypy changedir = {envbindir} commands = - pystache-test {toxinidir}/ext/spec/specs {toxinidir} + pystache-test {toxinidir} # Check that the spec tests work with PyYAML. [testenv:py27-yaml] @@ -24,7 +24,7 @@ deps = changedir = {envbindir} commands = - pystache-test {toxinidir}/ext/spec/specs {toxinidir} + pystache-test {toxinidir} # Check that pystache-test works from an install with no arguments. [testenv:py27-noargs] |