Skip to content
Snippets Groups Projects
Commit ed8680d6 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

suspend support for sphinxcontrib.images

the sphinxcontrib.image extension was broken with sphinx 16.x.
however, sphinx 15.x breaks with newer version of the multiprocessor module.
so we suspend the thumbnail processing and lift the lock to sphinx 15.x

also, the number of parallel sphinx tasks is can be overridden with SPHINXEXTRA="-j #'.
default is to try use all local CPU cores.
parent d029cb90
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0) ...@@ -20,6 +20,7 @@ ifeq ($(shell which virtualenv >/dev/null 2>&1; echo $$?), 0)
HAS_VIRTUALENV = YES HAS_VIRTUALENV = YES
endif endif
SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())')
SOURCES=$(wildcard src/*.txt) SOURCES=$(wildcard src/*.txt)
OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst) OBJECTS=$(SOURCES:src/%.txt=$(RSTDIR)/%.rst)
...@@ -55,7 +56,7 @@ html: $(OBJECTS) $(ANCHORCHECK) ...@@ -55,7 +56,7 @@ html: $(OBJECTS) $(ANCHORCHECK)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ;\
cp -r src/* $(RSTDIR)/ ;\ cp -r src/* $(RSTDIR)/ ;\
sphinx-build -j 8 -b html -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\ sphinx-build $(SPHINXEXTRA) -b html -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) html ;\
echo "############################################" ;\ echo "############################################" ;\
doc_anchor_check src/*.txt ;\ doc_anchor_check src/*.txt ;\
echo "############################################" ;\ echo "############################################" ;\
...@@ -91,7 +92,7 @@ epub: $(OBJECTS) ...@@ -91,7 +92,7 @@ epub: $(OBJECTS)
@(\ @(\
. $(VENV)/bin/activate ;\ . $(VENV)/bin/activate ;\
cp -r src/* $(RSTDIR)/ ;\ cp -r src/* $(RSTDIR)/ ;\
sphinx-build -j 8 -b epub -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\ sphinx-build $(SPHINXEXTRA) -b epub -c utils/sphinx-config -d $(BUILDDIR)/doctrees $(RSTDIR) epub ;\
deactivate ;\ deactivate ;\
) )
@mv epub/LAMMPS.epub . @mv epub/LAMMPS.epub .
...@@ -159,7 +160,7 @@ $(VENV): ...@@ -159,7 +160,7 @@ $(VENV):
@( \ @( \
virtualenv -p $(PYTHON) $(VENV); \ virtualenv -p $(PYTHON) $(VENV); \
. $(VENV)/bin/activate; \ . $(VENV)/bin/activate; \
pip install Sphinx==1.5.6; \ pip install Sphinx; \
pip install sphinxcontrib-images; \ pip install sphinxcontrib-images; \
deactivate;\ deactivate;\
) )
......
...@@ -148,15 +148,18 @@ class RSTFormatting(Formatting): ...@@ -148,15 +148,18 @@ class RSTFormatting(Formatting):
return "\n----------\n\n" + content.strip() return "\n----------\n\n" + content.strip()
def image(self, content, file, link=None): def image(self, content, file, link=None):
if link and (link.lower().endswith('.jpg') or # 2017-12-07: commented out to disable thumbnail processing due to dropping
link.lower().endswith('.jpeg') or # support for obsolete sphinxcontrib.images extension
link.lower().endswith('.png') or #
link.lower().endswith('.gif')): #if link and (link.lower().endswith('.jpg') or
converted = ".. thumbnail:: " + self.markup.unescape_rst_chars(link) + "\n" # link.lower().endswith('.jpeg') or
else: # link.lower().endswith('.png') or
converted = ".. image:: " + self.markup.unescape_rst_chars(file) + "\n" # link.lower().endswith('.gif')):
if link: # converted = ".. thumbnail:: " + self.markup.unescape_rst_chars(link) + "\n"
converted += " :target: " + self.markup.unescape_rst_chars(link) + "\n" #else:
converted = ".. image:: " + self.markup.unescape_rst_chars(file) + "\n"
if link:
converted += " :target: " + self.markup.unescape_rst_chars(link) + "\n"
if "c" in self.current_command_list: if "c" in self.current_command_list:
converted += " :align: center\n" converted += " :align: center\n"
......
...@@ -31,8 +31,11 @@ import os ...@@ -31,8 +31,11 @@ import os
# ones. # ones.
extensions = [ extensions = [
'sphinx.ext.mathjax', 'sphinx.ext.mathjax',
'sphinxcontrib.images',
] ]
# 2017-12-07: commented out, since this package is broken with Sphinx 16.x
# yet we can no longer use Sphinx 15.x, since that breaks with
# newer version of the multiprocessor module.
# 'sphinxcontrib.images',
images_config = { images_config = {
'default_image_width' : '25%', 'default_image_width' : '25%',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment