Merge pull request #907 from saimn/py3k

Drop python 3.2 support and move to python 3.3
This commit is contained in:
Justin Mayer 2013-06-02 09:34:31 -07:00
commit a81c50ff55
12 changed files with 31 additions and 72 deletions

View file

@ -1,7 +1,7 @@
language: python language: python
python: python:
- "2.7" - "2.7"
- "3.2" - "3.3"
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq --no-install-recommends asciidoc - sudo apt-get install -qq --no-install-recommends asciidoc

View file

@ -13,7 +13,7 @@ Contribution submission guidelines
* Adhere to PEP8 coding standards whenever possible. * Adhere to PEP8 coding standards whenever possible.
* Check for unnecessary whitespace via ``git diff --check`` before committing. * Check for unnecessary whitespace via ``git diff --check`` before committing.
* **Add docs and tests for your changes**. * **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. accidentally broken.
* First line of your commit message should start with present-tense verb, be 50 * 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. characters or less, and include the relevant issue number(s) if applicable.

View file

@ -1,4 +1,4 @@
include *.rst include *.rst
global-include *.py 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 include LICENSE THANKS docs/changelog.rst

View file

@ -43,6 +43,10 @@ To install Pelican and its dependencies::
$ python setup.py develop $ python setup.py develop
Or using ``pip``::
$ pip install -e .
Coding standards Coding standards
================ ================
@ -88,28 +92,22 @@ functional tests. To do so, you can use the following two commands::
samples/content/ samples/content/
$ pelican -o pelican/tests/output/basic/ 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 Testing on Python 3 currently requires some extra steps: installing
Python 3.x-compatible versions of dependent packages and plugins. Python 3-compatible versions of dependent packages and plugins.
However, you must tell ``tox`` to use those Python 3.x-compatible libraries. Tox_ is a useful tool to run tests on both versions. It will install the
If you forget this, ``tox`` will pull the regular packages from PyPI, and the Python 3-compatible version of dependent packages.
tests will fail.
Tell ``tox`` about the local packages thusly: enter the source directory of .. _Tox: http://testrun.org/tox/latest/
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.
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 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): - 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 it where I felt necessary.
- Changed xrange() back to range(), so it is valid in both Python versions. - Changed xrange() back to range(), so it is valid in both Python versions.

View file

@ -4,10 +4,9 @@ Getting started
Installing Pelican Installing Pelican
================== ==================
Pelican currently runs best on Python 2.7.x; earlier versions of Python are not Pelican currently runs best on Python 2.7.x; earlier versions of Python are
supported. There is provisional support for Python 3.2 and higher, although not supported. There is provisional support for Python 3.3, although there may
there may be rough edges, particularly with regards to optional 3rd-party be rough edges, particularly with regards to optional 3rd-party components.
components.
You can install Pelican via several different methods. The simplest is via You can install Pelican via several different methods. The simplest is via
`pip <http://www.pip-installer.org/>`_:: `pip <http://www.pip-installer.org/>`_::

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/all.rss.xml" rel="self"></atom:link><lastBuildDate>Fri, 30 Nov 2012 00:00:00 +0100</lastBuildDate><item><title>FILENAME_METADATA example</title><link>http://blog.notmyidea.org/filename_metadata-example.html</link><description>&lt;p&gt;Some cool stuff!&lt;/p&gt; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/all.rss.xml" rel="self"></atom:link><lastBuildDate>Fri, 30 Nov 2012 00:00:00 +0100</lastBuildDate><item><title>FILENAME_METADATA example</title><link>http://blog.notmyidea.org/filename_metadata-example.html</link><description>&lt;p&gt;Some cool stuff!&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 30 Nov 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html</guid></item><item><title>Trop bien !</title><link>http://blog.notmyidea.org/oh-yeah-fr.html</link><description>&lt;p&gt;Et voila du contenu en français&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 30 Nov 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html</guid></item><item><title>Trop bien !</title><link>http://blog.notmyidea.org/oh-yeah-fr.html</link><description>&lt;p&gt;Et voila du contenu en français&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 02 Mar 2012 14:01:01 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html</guid></item><item><title>Second article</title><link>http://blog.notmyidea.org/second-article.html</link><description>&lt;p&gt;This is some article, in english&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 02 Mar 2012 14:01:01 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-03-02:oh-yeah-fr.html</guid></item><item><title>Second article</title><link>http://blog.notmyidea.org/second-article.html</link><description>&lt;p&gt;This is some article, in english&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 29 Feb 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-02-29:second-article.html</guid><category>foo</category><category>bar</category><category>baz</category></item><item><title>Deuxième article</title><link>http://blog.notmyidea.org/second-article-fr.html</link><description>&lt;p&gt;Ceci est un article, en français.&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 29 Feb 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-02-29:second-article.html</guid><category>foo</category><category>bar</category><category>baz</category></item><item><title>Deuxième article</title><link>http://blog.notmyidea.org/second-article-fr.html</link><description>&lt;p&gt;Ceci est un article, en français.&lt;/p&gt;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/bar.rss.xml" rel="self"></atom:link><lastBuildDate>Wed, 20 Oct 2010 10:14:00 +0200</lastBuildDate><item><title>Oh yeah !</title><link>http://blog.notmyidea.org/oh-yeah.html</link><description>&lt;div class="section" id="why-not"&gt; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/bar.rss.xml" rel="self"></atom:link><lastBuildDate>Wed, 20 Oct 2010 10:14:00 +0200</lastBuildDate><item><title>Oh yeah !</title><link>http://blog.notmyidea.org/oh-yeah.html</link><description>&lt;div class="section" id="why-not"&gt;
&lt;h2&gt;Why not ?&lt;/h2&gt; &lt;h2&gt;Why not ?&lt;/h2&gt;
&lt;p&gt;After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst ! &lt;p&gt;After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
YEAH !&lt;/p&gt; YEAH !&lt;/p&gt;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/cat1.rss.xml" rel="self"></atom:link><lastBuildDate>Wed, 20 Apr 2011 00:00:00 +0200</lastBuildDate><item><title>A markdown powered article</title><link>http://blog.notmyidea.org/a-markdown-powered-article.html</link><description>&lt;p&gt;You're mutually oblivious.&lt;/p&gt; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/cat1.rss.xml" rel="self"></atom:link><lastBuildDate>Wed, 20 Apr 2011 00:00:00 +0200</lastBuildDate><item><title>A markdown powered article</title><link>http://blog.notmyidea.org/a-markdown-powered-article.html</link><description>&lt;p&gt;You're mutually oblivious.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blog.notmyidea.org/unbelievable.html"&gt;a root-relative link to unbelievable&lt;/a&gt; &lt;p&gt;&lt;a href="http://blog.notmyidea.org/unbelievable.html"&gt;a root-relative link to unbelievable&lt;/a&gt;
&lt;a href="http://blog.notmyidea.org/unbelievable.html"&gt;a file-relative link to unbelievable&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 20 Apr 2011 00:00:00 +0200</pubDate><guid>tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html</guid></item><item><title>Article 1</title><link>http://blog.notmyidea.org/article-1.html</link><description>&lt;p&gt;Article 1&lt;/p&gt; &lt;a href="http://blog.notmyidea.org/unbelievable.html"&gt;a file-relative link to unbelievable&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 20 Apr 2011 00:00:00 +0200</pubDate><guid>tag:blog.notmyidea.org,2011-04-20:a-markdown-powered-article.html</guid></item><item><title>Article 1</title><link>http://blog.notmyidea.org/article-1.html</link><description>&lt;p&gt;Article 1&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Thu, 17 Feb 2011 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2011-02-17:article-1.html</guid></item><item><title>Article 2</title><link>http://blog.notmyidea.org/article-2.html</link><description>&lt;p&gt;Article 2&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Thu, 17 Feb 2011 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2011-02-17:article-1.html</guid></item><item><title>Article 2</title><link>http://blog.notmyidea.org/article-2.html</link><description>&lt;p&gt;Article 2&lt;/p&gt;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/misc.rss.xml" rel="self"></atom:link><lastBuildDate>Fri, 30 Nov 2012 00:00:00 +0100</lastBuildDate><item><title>FILENAME_METADATA example</title><link>http://blog.notmyidea.org/filename_metadata-example.html</link><description>&lt;p&gt;Some cool stuff!&lt;/p&gt; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/misc.rss.xml" rel="self"></atom:link><lastBuildDate>Fri, 30 Nov 2012 00:00:00 +0100</lastBuildDate><item><title>FILENAME_METADATA example</title><link>http://blog.notmyidea.org/filename_metadata-example.html</link><description>&lt;p&gt;Some cool stuff!&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 30 Nov 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html</guid></item><item><title>Second article</title><link>http://blog.notmyidea.org/second-article.html</link><description>&lt;p&gt;This is some article, in english&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Fri, 30 Nov 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-11-30:filename_metadata-example.html</guid></item><item><title>Second article</title><link>http://blog.notmyidea.org/second-article.html</link><description>&lt;p&gt;This is some article, in english&lt;/p&gt;
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 29 Feb 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-02-29:second-article.html</guid><category>foo</category><category>bar</category><category>baz</category></item><item><title>Unbelievable !</title><link>http://blog.notmyidea.org/unbelievable.html</link><description>&lt;p&gt;Or completely awesome. Depends the needs.&lt;/p&gt; </description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 29 Feb 2012 00:00:00 +0100</pubDate><guid>tag:blog.notmyidea.org,2012-02-29:second-article.html</guid><category>foo</category><category>bar</category><category>baz</category></item><item><title>Unbelievable !</title><link>http://blog.notmyidea.org/unbelievable.html</link><description>&lt;p&gt;Or completely awesome. Depends the needs.&lt;/p&gt;
&lt;p&gt;&lt;a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html"&gt;a root-relative link to markdown-article&lt;/a&gt; &lt;p&gt;&lt;a class="reference external" href="http://blog.notmyidea.org/a-markdown-powered-article.html"&gt;a root-relative link to markdown-article&lt;/a&gt;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/yeah.rss.xml" rel="self"></atom:link><lastBuildDate>Thu, 02 Dec 2010 10:14:00 +0100</lastBuildDate><item><title>This is a super article !</title><link>http://blog.notmyidea.org/this-is-a-super-article.html</link><description>&lt;p&gt;Some content here !&lt;/p&gt; <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Alexis' log</title><link>http://blog.notmyidea.org/</link><description></description><atom:link href="http://blog.notmyidea.org/feeds/yeah.rss.xml" rel="self"></atom:link><lastBuildDate>Thu, 02 Dec 2010 10:14:00 +0100</lastBuildDate><item><title>This is a super article !</title><link>http://blog.notmyidea.org/this-is-a-super-article.html</link><description>&lt;p&gt;Some content here !&lt;/p&gt;
&lt;div class="section" id="this-is-a-simple-title"&gt; &lt;div class="section" id="this-is-a-simple-title"&gt;
&lt;h2&gt;This is a simple title&lt;/h2&gt; &lt;h2&gt;This is a simple title&lt;/h2&gt;
&lt;p&gt;And here comes the cool &lt;a class="reference external" href="http://books.couchdb.org/relax/design-documents/views"&gt;stuff&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;And here comes the cool &lt;a class="reference external" href="http://books.couchdb.org/relax/design-documents/views"&gt;stuff&lt;/a&gt;.&lt;/p&gt;

View file

@ -1,14 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
from setuptools import setup 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'] 'pytz', 'blinker', 'unidecode', 'six']
try:
import argparse # NOQA
except ImportError:
requires.append('argparse')
entry_points = { entry_points = {
'console_scripts': [ 'console_scripts': [
'pelican = pelican:main', 'pelican = pelican:main',
@ -41,9 +36,9 @@ setup(
'Environment :: Console', 'Environment :: Console',
'License :: OSI Approved :: GNU Affero General Public License v3', 'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent', 'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.3',
'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Libraries :: Python Modules',

40
tox.ini
View file

@ -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. # 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] [tox]
envlist = py27,py32,py33 envlist = py27,py33
[testenv] [testenv]
commands = commands =
@ -35,23 +14,12 @@ deps =
mock mock
Markdown Markdown
BeautifulSoup4 BeautifulSoup4
feedgenerator
typogrify typogrify
[testenv:py32]
deps =
mock
Markdown
BeautifulSoup4
feedgenerator
# {distshare}/smartypants-1.6.0.3.zip
# {distshare}/typogrify-2.0.0.zip
[testenv:py33] [testenv:py33]
deps = deps =
mock mock
Markdown Markdown
BeautifulSoup4 BeautifulSoup4
feedgenerator git+https://github.com/dmdm/smartypants.git#egg=smartypants
# {distshare}/smartypants-1.6.0.3.zip git+https://github.com/dmdm/typogrify.git@py3k#egg=typogrify
# {distshare}/typogrify-2.0.0.zip