mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Use status iterator for images and dlfiles.
This commit is contained in:
parent
f61e02799b
commit
50d16ce68e
@ -43,7 +43,7 @@ from sphinx.theming import Theme
|
|||||||
from sphinx.builders import Builder
|
from sphinx.builders import Builder
|
||||||
from sphinx.application import ENV_PICKLE_FILENAME
|
from sphinx.application import ENV_PICKLE_FILENAME
|
||||||
from sphinx.highlighting import PygmentsBridge
|
from sphinx.highlighting import PygmentsBridge
|
||||||
from sphinx.util.console import bold, darkgreen
|
from sphinx.util.console import bold, darkgreen, brown
|
||||||
from sphinx.writers.html import HTMLWriter, HTMLTranslator, \
|
from sphinx.writers.html import HTMLWriter, HTMLTranslator, \
|
||||||
SmartyPantsHTMLTranslator
|
SmartyPantsHTMLTranslator
|
||||||
|
|
||||||
@ -495,32 +495,31 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
def copy_image_files(self):
|
def copy_image_files(self):
|
||||||
# copy image files
|
# copy image files
|
||||||
if self.images:
|
if self.images:
|
||||||
self.info(bold('copying images...'), nonl=True)
|
|
||||||
ensuredir(path.join(self.outdir, '_images'))
|
ensuredir(path.join(self.outdir, '_images'))
|
||||||
for src, dest in self.images.iteritems():
|
for src in self.status_iterator(self.images, 'copying images... ',
|
||||||
self.info(' '+src, nonl=1)
|
brown, len(self.images)):
|
||||||
|
dest = self.images[src]
|
||||||
try:
|
try:
|
||||||
copyfile(path.join(self.srcdir, src),
|
copyfile(path.join(self.srcdir, src),
|
||||||
path.join(self.outdir, '_images', dest))
|
path.join(self.outdir, '_images', dest))
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
self.warn('cannot copy image file %r: %s' %
|
self.warn('cannot copy image file %r: %s' %
|
||||||
(path.join(self.srcdir, src), err))
|
(path.join(self.srcdir, src), err))
|
||||||
self.info()
|
|
||||||
|
|
||||||
def copy_download_files(self):
|
def copy_download_files(self):
|
||||||
# copy downloadable files
|
# copy downloadable files
|
||||||
if self.env.dlfiles:
|
if self.env.dlfiles:
|
||||||
self.info(bold('copying downloadable files...'), nonl=True)
|
|
||||||
ensuredir(path.join(self.outdir, '_downloads'))
|
ensuredir(path.join(self.outdir, '_downloads'))
|
||||||
for src, (_, dest) in self.env.dlfiles.iteritems():
|
for src in self.status_iterator(self.env.dlfiles,
|
||||||
self.info(' '+src, nonl=1)
|
'copying downloadable files... ',
|
||||||
|
brown, len(self.env.dlfiles)):
|
||||||
|
dest = self.env.dlfiles[src][1]
|
||||||
try:
|
try:
|
||||||
copyfile(path.join(self.srcdir, src),
|
copyfile(path.join(self.srcdir, src),
|
||||||
path.join(self.outdir, '_downloads', dest))
|
path.join(self.outdir, '_downloads', dest))
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
self.warn('cannot copy downloadable file %r: %s' %
|
self.warn('cannot copy downloadable file %r: %s' %
|
||||||
(path.join(self.srcdir, src), err))
|
(path.join(self.srcdir, src), err))
|
||||||
self.info()
|
|
||||||
|
|
||||||
def copy_static_files(self):
|
def copy_static_files(self):
|
||||||
# copy static files
|
# copy static files
|
||||||
|
Loading…
Reference in New Issue
Block a user