From c62397493ac9c457527dfb4f39df6162f3a0e34b Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 13 Mar 2015 08:18:50 -0500 Subject: [PATCH 1/5] Handle Sphinx 1.3 API change --- doc/ext/plot2rst.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/ext/plot2rst.py b/doc/ext/plot2rst.py index 99fd9a3f..1a35a8a2 100644 --- a/doc/ext/plot2rst.py +++ b/doc/ext/plot2rst.py @@ -205,6 +205,9 @@ def generate_examples_and_gallery(example_dir, rst_dir, cfg): rst_dir.makedirs() # we create an index.rst with all examples + if isinstance(cfg.source_suffix, list): + cfg.source_suffix = cfg.source_suffix[0] + gallery_index = open(rst_dir.pjoin('index'+cfg.source_suffix), 'w') # Here we don't use an os.walk, but we recurse only twice: flat is From 7d65366b6737a8812ea1c156b8793de5024ede9f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 13 Mar 2015 22:07:04 -0500 Subject: [PATCH 2/5] Try a fix for py27 build --- Makefile | 2 +- tools/travis_script.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b80eba0d..2de60516 100644 --- a/Makefile +++ b/Makefile @@ -16,5 +16,5 @@ coverage: nosetests skimage --with-coverage --cover-package=skimage html: - pip install -q sphinx + pip install -q sphinx==1.2.3 export SPHINXOPTS=-W; make -C doc html diff --git a/tools/travis_script.sh b/tools/travis_script.sh index 8dc2bb4e..3ffb58f1 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -10,6 +10,7 @@ section_end "Test.with.min.requirements" section "Build.docs" if [[ ($PY != 2.6) && ($PY != 3.2) ]]; then sudo apt-get install -qq texlive texlive-latex-extra dvipng + pip install -U setuptools pip make html fi section_end "Build.docs" From 9c3a6c1e9140dfd4e334ae4c4e8104604eb60073 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Mar 2015 10:35:04 -0500 Subject: [PATCH 3/5] Fix support for Sphinx 1.3 --- doc/ext/plot2rst.py | 15 +++++++++------ doc/source/conf.py | 6 +++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/doc/ext/plot2rst.py b/doc/ext/plot2rst.py index 1a35a8a2..32811deb 100644 --- a/doc/ext/plot2rst.py +++ b/doc/ext/plot2rst.py @@ -186,6 +186,11 @@ def setup(app): def generate_example_galleries(app): cfg = app.builder.config + if isinstance(cfg.source_suffix, list): + cfg.source_suffix_str = cfg.source_suffix[0] + else: + cfg.source_suffix_str = cfg.source_suffix + doc_src = Path(os.path.abspath(app.builder.srcdir)) # path/to/doc/source if isinstance(cfg.plot2rst_paths, tuple): @@ -205,10 +210,7 @@ def generate_examples_and_gallery(example_dir, rst_dir, cfg): rst_dir.makedirs() # we create an index.rst with all examples - if isinstance(cfg.source_suffix, list): - cfg.source_suffix = cfg.source_suffix[0] - - gallery_index = open(rst_dir.pjoin('index'+cfg.source_suffix), 'w') + gallery_index = open(rst_dir.pjoin('index'+cfg.source_suffix_str), 'w') # Here we don't use an os.walk, but we recurse only twice: flat is # better than nested. @@ -238,7 +240,7 @@ def write_gallery(gallery_index, src_dir, rst_dir, cfg, depth=0): cfg : config object Sphinx config object created by Sphinx. """ - index_name = cfg.plot2rst_index_name + cfg.source_suffix + index_name = cfg.plot2rst_index_name + cfg.source_suffix_str gallery_template = src_dir.pjoin(index_name) if not os.path.exists(gallery_template): print(src_dir) @@ -331,7 +333,8 @@ def write_example(src_name, src_dir, rst_dir, cfg): image_path = image_dir.pjoin(base_image_name + '_{0}.png') basename, py_ext = os.path.splitext(src_name) - rst_path = rst_dir.pjoin(basename + cfg.source_suffix) + + rst_path = rst_dir.pjoin(basename + cfg.source_suffix_str) notebook_path = notebook_dir.pjoin(basename + '.ipynb') if _plots_are_current(src_path, image_path) and rst_path.exists and \ diff --git a/doc/source/conf.py b/doc/source/conf.py index 94904305..be2d0790 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,6 +12,7 @@ # serve to show the default. import sys, os +import sphinx # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -50,7 +51,10 @@ else: templates_path = ['_templates'] # The suffix of source filenames. -source_suffix = '.txt' +if sphinx.__version__.startswith('1.3'): + source_suffix = ['.txt'] +else: + source_suffix = '.txt' # The encoding of source files. #source_encoding = 'utf-8-sig' From 15f6497bfecd26027f33e73cee07ff88e90869d0 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Mar 2015 10:35:59 -0500 Subject: [PATCH 4/5] Revert changes to force Sphinx 1.2.3 --- Makefile | 2 +- tools/travis_script.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2de60516..b80eba0d 100644 --- a/Makefile +++ b/Makefile @@ -16,5 +16,5 @@ coverage: nosetests skimage --with-coverage --cover-package=skimage html: - pip install -q sphinx==1.2.3 + pip install -q sphinx export SPHINXOPTS=-W; make -C doc html diff --git a/tools/travis_script.sh b/tools/travis_script.sh index 3ffb58f1..8dc2bb4e 100755 --- a/tools/travis_script.sh +++ b/tools/travis_script.sh @@ -10,7 +10,6 @@ section_end "Test.with.min.requirements" section "Build.docs" if [[ ($PY != 2.6) && ($PY != 3.2) ]]; then sudo apt-get install -qq texlive texlive-latex-extra dvipng - pip install -U setuptools pip make html fi section_end "Build.docs" From 5c6ee9511ce40a37b3b46da6fc20b2a99be4e199 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Mar 2015 10:39:25 -0500 Subject: [PATCH 5/5] Remove unnecessary sphinx version check --- doc/source/conf.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index be2d0790..94904305 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,7 +12,6 @@ # serve to show the default. import sys, os -import sphinx # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -51,10 +50,7 @@ else: templates_path = ['_templates'] # The suffix of source filenames. -if sphinx.__version__.startswith('1.3'): - source_suffix = ['.txt'] -else: - source_suffix = '.txt' +source_suffix = '.txt' # The encoding of source files. #source_encoding = 'utf-8-sig'