Fix #2919: Drop py26 support

This commit is contained in:
Takeshi KOMIYA 2016-09-02 01:19:47 +09:00
parent 6563a8793f
commit c147f6496e
13 changed files with 22 additions and 46 deletions

View File

@ -4,7 +4,6 @@ cache:
directories: directories:
- $HOME/.cache/pip - $HOME/.cache/pip
python: python:
- "2.6"
- "2.7" - "2.7"
- "3.4" - "3.4"
- "3.5" - "3.5"

View File

@ -46,7 +46,7 @@ Incompatible changes
* Fix ``epub`` and ``epub3`` builders that contained links to ``genindex`` even if ``epub_use_index = False``. * Fix ``epub`` and ``epub3`` builders that contained links to ``genindex`` even if ``epub_use_index = False``.
* `html_translator_class` is now deprecated. * `html_translator_class` is now deprecated.
Use `Sphinx.set_translator()` API instead. Use `Sphinx.set_translator()` API instead.
* Drop python 3.3 support * Drop python 2.6 and 3.3 support
* Drop epub3 builder's ``epub3_page_progression_direction`` option (use ``epub3_writing_mode``). * Drop epub3 builder's ``epub3_page_progression_direction`` option (use ``epub3_writing_mode``).
Features added Features added

View File

@ -277,8 +277,7 @@ for details.
A module that implements `dump()`, `load()`, `dumps()` and `loads()` A module that implements `dump()`, `load()`, `dumps()` and `loads()`
functions that conform to the functions with the same names from the functions that conform to the functions with the same names from the
pickle module. Known modules implementing this interface are pickle module. Known modules implementing this interface are
`simplejson` (or `json` in Python 2.6), `phpserialize`, `plistlib`, `simplejson`, `phpserialize`, `plistlib`, and others.
and others.
.. attribute:: out_suffix .. attribute:: out_suffix

View File

@ -1997,9 +1997,8 @@ Options for the linkcheck builder
.. confval:: linkcheck_timeout .. confval:: linkcheck_timeout
A timeout value, in seconds, for the linkcheck builder. **Only works in A timeout value, in seconds, for the linkcheck builder. The default is to
Python 2.6 and higher.** The default is to use Python's global socket use Python's global socket timeout.
timeout.
.. versionadded:: 1.1 .. versionadded:: 1.1

View File

@ -4,7 +4,7 @@ Installing Sphinx
================= =================
Since Sphinx is written in the Python language, you need to install Python Since Sphinx is written in the Python language, you need to install Python
(the required version is at least 2.6) and Sphinx. (the required version is at least 2.7) and Sphinx.
Sphinx packages are available on the `Python Package Index Sphinx packages are available on the `Python Package Index
<https://pypi.python.org/pypi/Sphinx>`_. <https://pypi.python.org/pypi/Sphinx>`_.
@ -80,8 +80,8 @@ sidebar and under "Quick Links", click "Windows Installer" to download.
.. note:: .. note::
Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run
under Python 2.6, 2.7, 3.4, 3.5, with the recommended version being under Python 2.7, 3.4, 3.5, with the recommended version being 2.7. This
2.7. This chapter assumes you have installed Python 2.7. chapter assumes you have installed Python 2.7.
Follow the Windows installer for Python. Follow the Windows installer for Python.

View File

@ -54,7 +54,7 @@ See the :ref:`pertinent section in the FAQ list <usingwith>`.
Prerequisites Prerequisites
------------- -------------
Sphinx needs at least **Python 2.6** or **Python 3.4** to run, as well as the Sphinx needs at least **Python 2.7** or **Python 3.4** to run, as well as the
docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.10 docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.10
or some (not broken) SVN trunk snapshot. If you like to have source code or some (not broken) SVN trunk snapshot. If you like to have source code
highlighting support, you must also install the Pygments_ library. highlighting support, you must also install the Pygments_ library.

View File

@ -37,8 +37,8 @@ Among its features are the following:
* Setuptools integration * Setuptools integration
''' '''
if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 4): if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 4):
print('ERROR: Sphinx requires at least Python 2.6 or 3.4 to run.') print('ERROR: Sphinx requires at least Python 2.7 or 3.4 to run.')
sys.exit(1) sys.exit(1)
requires = [ requires = [
@ -63,7 +63,7 @@ extras_require = {
], ],
'test': [ 'test': [
'nose', 'nose',
'mock', # it would be better for 'test:python_version in "2.6,2.7"' 'mock', # it would be better for 'test:python_version in 2.7'
'simplejson', # better: 'test:platform_python_implementation=="PyPy"' 'simplejson', # better: 'test:platform_python_implementation=="PyPy"'
'html5lib', 'html5lib',
], ],

View File

@ -53,9 +53,9 @@ def main(argv=sys.argv):
def build_main(argv=sys.argv): def build_main(argv=sys.argv):
"""Sphinx build "main" command-line entry.""" """Sphinx build "main" command-line entry."""
if (sys.version_info[:3] < (2, 6, 0) or if (sys.version_info[:3] < (2, 7, 0) or
(3, 0, 0) <= sys.version_info[:3] < (3, 4, 0)): (3, 0, 0) <= sys.version_info[:3] < (3, 4, 0)):
sys.stderr.write('Error: Sphinx requires at least Python 2.6 or 3.4 to run.\n') sys.stderr.write('Error: Sphinx requires at least Python 2.7 or 3.4 to run.\n')
return 1 return 1
try: try:
from sphinx import cmdline from sphinx import cmdline

View File

@ -13,6 +13,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import re import re
import gzip
from os import path from os import path
from docutils import nodes from docutils import nodes
@ -24,22 +25,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder
try: try:
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
except ImportError: except ImportError:
try: import lxml.etree as etree
import lxml.etree as etree
except ImportError:
try:
import elementtree.ElementTree as etree
except ImportError:
import cElementTree as etree
try:
import gzip
def comp_open(filename, mode='rb'):
return gzip.open(filename + '.gz', mode)
except ImportError:
def comp_open(filename, mode='rb'):
return open(filename, mode)
class DevhelpBuilder(StandaloneHTMLBuilder): class DevhelpBuilder(StandaloneHTMLBuilder):
@ -129,7 +115,8 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
write_index(title, refs, subitems) write_index(title, refs, subitems)
# Dump the XML file # Dump the XML file
with comp_open(path.join(outdir, outname + '.devhelp'), 'w') as f: xmlfile = path.join(outdir, outname + '.devhelp.gz')
with gzip.open(xmlfile, 'w') as f:
tree.write(f, 'utf-8') tree.write(f, 'utf-8')

View File

@ -4,10 +4,7 @@
from __future__ import print_function from __future__ import print_function
from six import iteritems from six import iteritems
try: from collections import OrderedDict
from collections import OrderedDict
except ImportError: # Fallback for Python 2.6
OrderedDict = dict
# Pgen imports # Pgen imports

View File

@ -60,7 +60,7 @@ if PY3:
raise TypeError('%r is not a Python function' % func) raise TypeError('%r is not a Python function' % func)
return inspect.getfullargspec(func) return inspect.getfullargspec(func)
else: # 2.6, 2.7 else: # 2.7
from functools import partial from functools import partial
def getargspec(func): def getargspec(func):

View File

@ -80,8 +80,8 @@ def ensuredir(path):
raise raise
# This function is same as os.walk of Python2.6, 2.7, 3.2, 3.3 except a # This function is same as os.walk of Python2.7 except a customization
# customization that check UnicodeError. # that check UnicodeError.
# The customization obstacle to replace the function with the os.walk. # The customization obstacle to replace the function with the os.walk.
def walk(top, topdown=True, followlinks=False): def walk(top, topdown=True, followlinks=False):
"""Backport of os.walk from 2.6, where the *followlinks* argument was """Backport of os.walk from 2.6, where the *followlinks* argument was

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist=flake8,py26,py27,py34,py35,pypy,du12,du11,du10 envlist=flake8,py27,py34,py35,pypy,du12,du11,du10
[testenv] [testenv]
deps= deps=
@ -15,11 +15,6 @@ commands=
{envpython} tests/run.py -I py35 -m '^[tT]est' {posargs} {envpython} tests/run.py -I py35 -m '^[tT]est' {posargs}
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
[testenv:py26]
deps=
mock
{[testenv]deps}
[testenv:py27] [testenv:py27]
deps= deps=
mock mock