From 2bf91e54cd94f884ea63d41067e4bd7f44963dbd Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 26 May 2013 11:17:46 +0200 Subject: [PATCH 1/5] Tox: use git urls for py3 versions of smartypants and typogrify + This make it easier to use tox with py3: no need to checkout manually typogrify and smartypants repos and use tox's distshare. + Remove feedgenerator as it is already a dependy for pelican. --- tox.ini | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index fe32d48f..65f398bc 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,6 @@ deps = mock Markdown BeautifulSoup4 - feedgenerator typogrify [testenv:py32] @@ -52,6 +51,5 @@ deps = mock Markdown BeautifulSoup4 - feedgenerator -# {distshare}/smartypants-1.6.0.3.zip -# {distshare}/typogrify-2.0.0.zip + git+https://github.com/dmdm/smartypants.git#egg=smartypants + git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify From 529d0d99c5d5789bf3b91c7235fcad89c44bd108 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 26 May 2013 11:18:34 +0200 Subject: [PATCH 2/5] Update version requirement with feedgenerator 1.6 feedgenerator 1.6 changes the order of attributes in feeds, so we must use this version to have consistent functionnal tests. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 122cad67..cd05b924 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -requires = ['feedgenerator>=1.5', 'jinja2 >= 2.6', 'pygments', 'docutils', +requires = ['feedgenerator >= 1.6', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode', 'six'] try: From fd018d7ceb47c761f9e4e8bc30f85e4f06fa847a Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sat, 25 May 2013 00:09:06 +0200 Subject: [PATCH 3/5] Update tests output with feedgenerator 1.6 feedgenerator 1.6 includes a change to write feed attributes in a consistent order between py2.7 and py3.3. --- pelican/tests/output/custom/feeds/all.rss.xml | 2 +- pelican/tests/output/custom/feeds/bar.rss.xml | 2 +- pelican/tests/output/custom/feeds/cat1.rss.xml | 2 +- pelican/tests/output/custom/feeds/misc.rss.xml | 2 +- pelican/tests/output/custom/feeds/yeah.rss.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pelican/tests/output/custom/feeds/all.rss.xml b/pelican/tests/output/custom/feeds/all.rss.xml index 0ce2c837..89176ac0 100644 --- a/pelican/tests/output/custom/feeds/all.rss.xml +++ b/pelican/tests/output/custom/feeds/all.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlTrop bien !http://blog.notmyidea.org/oh-yeah-fr.html<p>Et voila du contenu en français</p> Alexis MétaireauFri, 02 Mar 2012 14:01:01 +0100tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazDeuxième articlehttp://blog.notmyidea.org/second-article-fr.html<p>Ceci est un article, en français.</p> diff --git a/pelican/tests/output/custom/feeds/bar.rss.xml b/pelican/tests/output/custom/feeds/bar.rss.xml index a7495c36..148411be 100644 --- a/pelican/tests/output/custom/feeds/bar.rss.xml +++ b/pelican/tests/output/custom/feeds/bar.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Oct 2010 10:14:00 +0200Oh yeah !http://blog.notmyidea.org/oh-yeah.html<div class="section" id="why-not"> <h2>Why not ?</h2> <p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! YEAH !</p> diff --git a/pelican/tests/output/custom/feeds/cat1.rss.xml b/pelican/tests/output/custom/feeds/cat1.rss.xml index 349c3fe6..62b93fd1 100644 --- a/pelican/tests/output/custom/feeds/cat1.rss.xml +++ b/pelican/tests/output/custom/feeds/cat1.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p> +Alexis' loghttp://blog.notmyidea.org/Wed, 20 Apr 2011 00:00:00 +0200A markdown powered articlehttp://blog.notmyidea.org/a-markdown-powered-article.html<p>You're mutually oblivious.</p> <p><a href="http://blog.notmyidea.org/unbelievable.html">a root-relative link to unbelievable</a> <a href="http://blog.notmyidea.org/unbelievable.html">a file-relative link to unbelievable</a></p>Alexis MétaireauWed, 20 Apr 2011 00:00:00 +0200tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.htmlArticle 1http://blog.notmyidea.org/article-1.html<p>Article 1</p> Alexis MétaireauThu, 17 Feb 2011 00:00:00 +0100tag:blog.notmyidea.org,2011-02-17:article-1.htmlArticle 2http://blog.notmyidea.org/article-2.html<p>Article 2</p> diff --git a/pelican/tests/output/custom/feeds/misc.rss.xml b/pelican/tests/output/custom/feeds/misc.rss.xml index a0fa290d..1d295abc 100644 --- a/pelican/tests/output/custom/feeds/misc.rss.xml +++ b/pelican/tests/output/custom/feeds/misc.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> +Alexis' loghttp://blog.notmyidea.org/Fri, 30 Nov 2012 00:00:00 +0100FILENAME_METADATA examplehttp://blog.notmyidea.org/filename_metadata-example.html<p>Some cool stuff!</p> Alexis MétaireauFri, 30 Nov 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.htmlSecond articlehttp://blog.notmyidea.org/second-article.html<p>This is some article, in english</p> Alexis MétaireauWed, 29 Feb 2012 00:00:00 +0100tag:blog.notmyidea.org,2012-02-29:second-article.htmlfoobarbazUnbelievable !http://blog.notmyidea.org/unbelievable.html<p>Or completely awesome. Depends the needs.</p> <p><a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html">a root-relative link to markdown-article</a> diff --git a/pelican/tests/output/custom/feeds/yeah.rss.xml b/pelican/tests/output/custom/feeds/yeah.rss.xml index a54e48e4..b252c26a 100644 --- a/pelican/tests/output/custom/feeds/yeah.rss.xml +++ b/pelican/tests/output/custom/feeds/yeah.rss.xml @@ -1,5 +1,5 @@ -Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> +Alexis' loghttp://blog.notmyidea.org/Thu, 02 Dec 2010 10:14:00 +0100This is a super article !http://blog.notmyidea.org/this-is-a-super-article.html<p>Some content here !</p> <div class="section" id="this-is-a-simple-title"> <h2>This is a simple title</h2> <p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p> From 427a5ca3c38a7ac32d3e894691124470fd054011 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sat, 25 May 2013 00:23:52 +0200 Subject: [PATCH 4/5] Include feeds and mkd files in the dist package. This files are needed to run the tests. --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 77619971..136243c0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,4 @@ include *.rst global-include *.py -recursive-include pelican *.html *.css *png *.in *.rst *.md +recursive-include pelican *.html *.css *png *.in *.rst *.md *.mkd *.xml include LICENSE THANKS docs/changelog.rst From 7057d3742bfdbed91dec87c315686024758d9ed2 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Sun, 26 May 2013 12:44:32 +0200 Subject: [PATCH 5/5] Drop python 3.2 support and move to python 3.3. Jinja 2.7 (released 2013-05-20) supports only Python3 >=3.3 so it is time to drop Python 3.2 and move to 3.3 --- .travis.yml | 2 +- CONTRIBUTING.rst | 2 +- docs/contribute.rst | 31 ++++++++++++++----------------- docs/getting_started.rst | 7 +++---- setup.py | 7 +------ tox.ini | 34 ++-------------------------------- 6 files changed, 22 insertions(+), 61 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa0c2f0a..1ff512b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python python: - "2.7" - - "3.2" + - "3.3" before_install: - sudo apt-get update -qq - sudo apt-get install -qq --no-install-recommends asciidoc diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 41c38cc7..b28b22a3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -13,7 +13,7 @@ Contribution submission guidelines * Adhere to PEP8 coding standards whenever possible. * Check for unnecessary whitespace via ``git diff --check`` before committing. * **Add docs and tests for your changes**. -* `Run all the tests`_ **on both Python 2.7+ and 3.2+** to ensure nothing was +* `Run all the tests`_ **on both Python 2.7 and 3.3** to ensure nothing was accidentally broken. * First line of your commit message should start with present-tense verb, be 50 characters or less, and include the relevant issue number(s) if applicable. diff --git a/docs/contribute.rst b/docs/contribute.rst index ffdda986..80d07644 100644 --- a/docs/contribute.rst +++ b/docs/contribute.rst @@ -43,6 +43,10 @@ To install Pelican and its dependencies:: $ python setup.py develop +Or using ``pip``:: + + $ pip install -e . + Coding standards ================ @@ -88,28 +92,22 @@ functional tests. To do so, you can use the following two commands:: samples/content/ $ pelican -o pelican/tests/output/basic/ samples/content/ -Testing on Python 3.x ---------------------- +Testing on Python 2 and 3 +------------------------- -Testing on Python 3.x currently requires some extra steps: installing -Python 3.x-compatible versions of dependent packages and plugins. +Testing on Python 3 currently requires some extra steps: installing +Python 3-compatible versions of dependent packages and plugins. -However, you must tell ``tox`` to use those Python 3.x-compatible libraries. -If you forget this, ``tox`` will pull the regular packages from PyPI, and the -tests will fail. +Tox_ is a useful tool to run tests on both versions. It will install the +Python 3-compatible version of dependent packages. -Tell ``tox`` about the local packages thusly: enter the source directory of -smartypants and run ``tox`` there. Do this again for the ``typogrify`` and -``webassets`` packages. SmartyPants and Typogrify do not have real tests, and -``webassets`` will fail noisily, but as a result we get these libraries neatly -packaged in tox's ``distshare`` directory, which we need in order to run -``tox`` for Pelican. +.. _Tox: http://testrun.org/tox/latest/ -Python 3.x development tips -=========================== +Python 3 development tips +========================= Here are some tips that may be useful when doing some code for both Python 2.7 -and Python 3.x at the same time: +and Python 3 at the same time: - Assume every string and literal is unicode (import unicode_literals): @@ -144,4 +142,3 @@ and Python 3.x at the same time: changed it where I felt necessary. - Changed xrange() back to range(), so it is valid in both Python versions. - diff --git a/docs/getting_started.rst b/docs/getting_started.rst index c93e0844..ddffb5ff 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -4,10 +4,9 @@ Getting started Installing Pelican ================== -Pelican currently runs best on Python 2.7.x; earlier versions of Python are not -supported. There is provisional support for Python 3.2 and higher, although -there may be rough edges, particularly with regards to optional 3rd-party -components. +Pelican currently runs best on Python 2.7.x; earlier versions of Python are +not supported. There is provisional support for Python 3.3, although there may +be rough edges, particularly with regards to optional 3rd-party components. You can install Pelican via several different methods. The simplest is via `pip `_:: diff --git a/setup.py b/setup.py index cd05b924..83beb461 100755 --- a/setup.py +++ b/setup.py @@ -4,11 +4,6 @@ from setuptools import setup requires = ['feedgenerator >= 1.6', 'jinja2 >= 2.6', 'pygments', 'docutils', 'pytz', 'blinker', 'unidecode', 'six'] -try: - import argparse # NOQA -except ImportError: - requires.append('argparse') - entry_points = { 'console_scripts': [ 'pelican = pelican:main', @@ -41,9 +36,9 @@ setup( 'Environment :: Console', 'License :: OSI Approved :: GNU Affero General Public License v3', 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tox.ini b/tox.ini index 65f398bc..d9d759e9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,29 +1,8 @@ -# This tests the unified codebase (py26-py32) of Pelican. +# This tests the unified codebase (py27, py33) of Pelican. # depends on some external libraries that aren't released yet. -# -# To run Pelican, you will already have checked out and installed them. -# -# Now we must tell tox about this package, otherwise tox would load the old -# libraries from PyPi. -# -# Run tox from the libraries source tree. It will save its package in -# the distshare directory from where the tests here will pick it up. -# -# Do that for -# https://github.com/dmdm/smartypants.git -# -# and typogrify: -# https://github.com/dmdm/typogrify/tree/py3k -# -# CAVEAT: -# ------- -# -# Please be aware that my port of typogrify is just 2to3'd. -# It is not backwards compatible with Python 2. - [tox] -envlist = py27,py32,py33 +envlist = py27,py33 [testenv] commands = @@ -37,15 +16,6 @@ deps = BeautifulSoup4 typogrify -[testenv:py32] -deps = - mock - Markdown - BeautifulSoup4 - feedgenerator -# {distshare}/smartypants-1.6.0.3.zip -# {distshare}/typogrify-2.0.0.zip - [testenv:py33] deps = mock