mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #1408: Check latex_logo validity before copying
This commit is contained in:
1
CHANGES
1
CHANGES
@@ -29,6 +29,7 @@ Bugs fixed
|
||||
* #2197: Fix slightly cryptic error message for missing index.rst file
|
||||
* #1894: Unlisted phony targets in quickstart Makefile
|
||||
* #2125: Fix unifies behavior of collapsed fields (``GroupedField`` and ``TypedField``)
|
||||
* #1408: Check latex_logo validity before copying
|
||||
|
||||
Release 1.3.3 (released Dec 2, 2015)
|
||||
====================================
|
||||
|
||||
@@ -20,6 +20,7 @@ from docutils.frontend import OptionParser
|
||||
|
||||
from sphinx import package_dir, addnodes
|
||||
from sphinx.util import texescape
|
||||
from sphinx.errors import SphinxError
|
||||
from sphinx.locale import _
|
||||
from sphinx.builders import Builder
|
||||
from sphinx.environment import NoUri
|
||||
@@ -191,6 +192,9 @@ class LaTeXBuilder(Builder):
|
||||
# the logo is handled differently
|
||||
if self.config.latex_logo:
|
||||
logobase = path.basename(self.config.latex_logo)
|
||||
copyfile(path.join(self.confdir, self.config.latex_logo),
|
||||
path.join(self.outdir, logobase))
|
||||
logotarget = path.join(self.outdir, logobase)
|
||||
if not path.isfile(path.join(self.confdir, self.config.latex_logo)):
|
||||
raise SphinxError('logo file %r does not exist' % self.config.latex_logo)
|
||||
elif not path.isfile(logotarget):
|
||||
copyfile(path.join(self.confdir, self.config.latex_logo), logotarget)
|
||||
self.info('done')
|
||||
|
||||
@@ -16,6 +16,7 @@ from subprocess import Popen, PIPE
|
||||
|
||||
from six import PY3
|
||||
|
||||
from sphinx.errors import SphinxError
|
||||
from sphinx.writers.latex import LaTeXTranslator
|
||||
|
||||
from util import SkipTest, remove_unicode_literals, with_app
|
||||
@@ -418,3 +419,12 @@ def test_latex_show_urls_is_no(app, status, warning):
|
||||
'{https://github.com/sphinx-doc/sphinx}\n' in result)
|
||||
assert ('\\href{mailto:sphinx-dev@googlegroups.com}'
|
||||
'{sphinx-dev@googlegroups.com}\n' in result)
|
||||
|
||||
|
||||
@with_app(buildername='latex', confoverrides={'latex_logo': 'notfound.jpg'})
|
||||
def test_latex_logo_if_not_found(app, status, warning):
|
||||
try:
|
||||
app.builder.build_all()
|
||||
assert False # SphinxError not raised
|
||||
except Exception as exc:
|
||||
assert isinstance(exc, SphinxError)
|
||||
|
||||
Reference in New Issue
Block a user