From 907e53f463d645f641c69303cb7dc239b211085d Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Fri, 16 Dec 2016 11:39:10 +0900 Subject: [PATCH 01/13] LaTeX builder: Refactor the default settings generators (refs: #3244) --- sphinx/builders/latex.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py index 7bd43a84c..e42ed7ace 100644 --- a/sphinx/builders/latex.py +++ b/sphinx/builders/latex.py @@ -268,13 +268,28 @@ def validate_config_values(app): app.config.latex_elements['postamble'] = app.config.latex_elements['footer'] +def default_latex_engine(config): + """ Better default latex_engine settings for specific languages. """ + if config.language == 'ja': + return 'platex' + else: + return 'pdflatex' + + +def default_latex_docclass(config): + """ Better default latex_docclass settings for specific languages. """ + if config.language == 'ja': + return {'manual': 'jsbook', + 'howto': 'jreport'} + else: + return {} + + def setup(app): app.add_builder(LaTeXBuilder) app.connect('builder-inited', validate_config_values) - app.add_config_value('latex_engine', - lambda self: 'pdflatex' if self.language != 'ja' else 'platex', - None, + app.add_config_value('latex_engine', default_latex_engine, None, ENUM('pdflatex', 'xelatex', 'lualatex', 'platex')) app.add_config_value('latex_documents', lambda self: [(self.master_doc, make_filename(self.project) + '.tex', @@ -297,11 +312,7 @@ def setup(app): app.add_config_value('latex_elements', {}, None) app.add_config_value('latex_additional_files', [], None) - japanese_default = {'manual': 'jsbook', - 'howto': 'jreport'} - app.add_config_value('latex_docclass', - lambda self: japanese_default if self.language == 'ja' else {}, - None) + app.add_config_value('latex_docclass', default_latex_docclass, None) # now deprecated - use latex_elements app.add_config_value('latex_preamble', '', None) From 01977fcb728216ba69d1a4635b1c633f3c7c4462 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Thu, 22 Dec 2016 10:36:15 +0300 Subject: [PATCH 02/13] Load non-minified JS files from sphinx.package_dir This makes the code consistent with other parts of Sphinx, and allows downstream packagers to move all static files to /usr/share. --- sphinx/search/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py index 23dc869ee..8f2935227 100644 --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -414,7 +414,7 @@ class IndexBuilder(object): def get_js_stemmer_rawcode(self): if self.lang.js_stemmer_rawcode: return path.join( - path.dirname(path.abspath(__file__)), + sphinx.package_dir, 'search', 'non-minified-js', self.lang.js_stemmer_rawcode ) From 01736bb3970e0fc3d733ca6f5df24480e3545a2a Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 18:43:35 +0900 Subject: [PATCH 03/13] Fix test_latex failed if stylefiles not found (refs: #3264) --- tests/test_build_latex.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_build_latex.py b/tests/test_build_latex.py index 8a899caa5..dfcadc6a1 100644 --- a/tests/test_build_latex.py +++ b/tests/test_build_latex.py @@ -50,7 +50,7 @@ def kpsetest(*filenames): except OSError: # no kpsewhich... either no tex distribution is installed or it is # a "strange" one -- don't bother running latex - return None + return False else: p.communicate() if p.returncode != 0: @@ -84,8 +84,8 @@ def compile_latex_document(app): def skip_if_stylefiles_notfound(testfunc): if kpsetest(*STYLEFILES) is False: - return skip_if(testfunc, - 'not running latex, the required styles do not seem to be installed') + msg = 'not running latex, the required styles do not seem to be installed' + return skip_if(True, msg)(testfunc) else: return testfunc From f65c5ee3def215c3aff3f57be6a1fa81935459b4 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 18:45:32 +0900 Subject: [PATCH 04/13] Install enum34 on testing pypy (refs: #3264) --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1ccaa583f..110bd454f 100644 --- a/tox.ini +++ b/tox.ini @@ -10,6 +10,7 @@ deps= whoosh html5lib mock + enum34 typing setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild @@ -43,7 +44,6 @@ commands=flake8 [testenv:py27] deps= - enum34 {[testenv]deps} [testenv:py35] From 8dcc3a259ce353fae7eb3b280f0c28e4643d63bd Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 19:30:17 +0900 Subject: [PATCH 05/13] Fix 'tox -e du12' fails (refs: #3264) --- tox.ini | 1 - 1 file changed, 1 deletion(-) diff --git a/tox.ini b/tox.ini index 110bd454f..bbdb6ff14 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,6 @@ envlist=flake8,py27,py34,py35,pypy,du12,du11,du10 deps= six nose - docutils sqlalchemy whoosh html5lib From c7783e632f81d9d5e29be7baf836df7d72942453 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 22:13:10 +0900 Subject: [PATCH 06/13] Update setup.cfg (refs: #3264) --- setup.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index a65719461..73ac1e746 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,6 @@ directory = sphinx/locale/ universal = 1 [flake8] -max-line-length=95 -ignore=E113,E116,E221,E226,E241,E251,E901 -exclude=tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py +max-line-length = 95 +ignore = E113,E116,E221,E226,E241,E251,E901 +exclude = .git,.tox,tests/*,build/*,sphinx/search/*,sphinx/pycode/pgen2/*,doc/ext/example*.py From 7ab20262ff412f8c3cd8fdbef0dd16f79d890554 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 22:23:49 +0900 Subject: [PATCH 07/13] Set PYTHONDONTWRITEBYTECODE=true on testing (refs: #3264) --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index bbdb6ff14..e9f4951fd 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ deps= typing setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild + PYTHONDONTWRITEBYTECODE = true commands= {envpython} -Wall tests/run.py -I py35 -m '^[tT]est' {posargs} sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html From 866da5a8d08fd4bef127e8b11954d83fc011253b Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 23:51:30 +0900 Subject: [PATCH 08/13] Clarify test command (refs: #3264) --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e9f4951fd..e46c0b8d8 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ setenv = SPHINX_TEST_TEMPDIR = {envdir}/testbuild PYTHONDONTWRITEBYTECODE = true commands= - {envpython} -Wall tests/run.py -I py35 -m '^[tT]est' {posargs} + {envpython} -Wall tests/run.py --ignore-files=test_autodoc_py35 -m '^[tT]est' {posargs} sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html [testenv:pypy] From 36eab77c3d05b661782f0fbe17a99cb7505a4d89 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 13:05:35 +0900 Subject: [PATCH 09/13] Add py36 support --- .travis.yml | 5 +++-- doc/install.rst | 4 ++-- tox.ini | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82bcb9f23..250f3cffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: - "2.7" - "3.4" - "3.5" + - "3.6" - "nightly" - "pypy" env: @@ -34,5 +35,5 @@ install: before_script: - if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8; fi script: - - if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then make style-check test-async; fi - - if [[ $TRAVIS_PYTHON_VERSION != '3.5' ]]; then make test; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi + - if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi diff --git a/doc/install.rst b/doc/install.rst index b3519e1ba..2eb44b809 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -79,8 +79,8 @@ sidebar and under "Quick Links", click "Windows Installer" to download. .. note:: - Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.3 can run - under Python 2.7, 3.4, 3.5, with the recommended version being 2.7. This + Currently, Python offers two major versions, 2.x and 3.x. Sphinx 1.5 can run + under Python 2.7, 3.4, 3.5, 3.6, with the recommended version being 2.7. This chapter assumes you have installed Python 2.7. Follow the Windows installer for Python. diff --git a/tox.ini b/tox.ini index e46c0b8d8..df02121c5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=flake8,py27,py34,py35,pypy,du12,du11,du10 +envlist=flake8,py27,py34,py35,py36,pypy,du12,du11,du10 [testenv] deps= From 6a5ffb403e672a1aeec6813be0e4792064fb4e88 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 13:06:45 +0900 Subject: [PATCH 10/13] Reduce CI matrix --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index 250f3cffd..f4e2e544d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,16 @@ env: matrix: - DOCUTILS=0.12 - DOCUTILS=0.13.1 +matrix: + exclude: + - python: "3.4" + env: DOCUTILS=0.12 + - python: "3.5" + env: DOCUTILS=0.12 + - python: nightly + env: DOCUTILS=0.12 + - python: pypy + env: DOCUTILS=0.12 addons: apt: packages: From 934ec657d4d5b04379013b2f689c51b9e2f87008 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 13:09:23 +0900 Subject: [PATCH 11/13] Remove unsupported platform from tox.ini --- tox.ini | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tox.ini b/tox.ini index df02121c5..e8a45f845 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=flake8,py27,py34,py35,py36,pypy,du12,du11,du10 +envlist=flake8,py27,py34,py35,py36,pypy,du12,du11 [testenv] deps= @@ -23,11 +23,6 @@ deps= simplejson {[testenv]deps} -[testenv:du10] -deps= - docutils==0.10 - {[testenv]deps} - [testenv:du11] deps= docutils==0.11 From 4cc3c154fec15714929c65ca3649d87f1c506338 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 24 Dec 2016 17:31:58 +0900 Subject: [PATCH 12/13] Refactor travis.yml --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4e2e544d..09b89a7ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,8 +42,7 @@ install: - pip install -U pip setuptools - pip install docutils==$DOCUTILS - pip install -r test-reqs.txt -before_script: - - if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]]; then flake8; fi script: - - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi - - if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi + - flake8 + - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check test-async; fi + - if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then make test; fi From a5b15195e200297819d0118c6db21b00d06e7bb6 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 25 Dec 2016 12:22:54 +0900 Subject: [PATCH 13/13] Add du13 target to tox.ini --- tox.ini | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e8a45f845..09241c1d8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=flake8,py27,py34,py35,py36,pypy,du12,du11 +envlist=flake8,py27,py34,py35,py36,pypy,du13,du12,du11 [testenv] deps= @@ -33,6 +33,11 @@ deps= docutils==0.12 {[testenv]deps} +[testenv:du13] +deps= + docutils==0.13.1 + {[testenv]deps} + [testenv:flake8] deps=flake8 commands=flake8