summaryrefslogtreecommitdiff
path: root/sphinx/builders/applehelp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-12-22 13:41:56 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-01-02 12:59:50 +0900
commitb43523fcbecda58ffd1ed31d29d0c9363a42be86 (patch)
treef5dc45705c4d1251503e602b4cdd4ec46341e87e /sphinx/builders/applehelp.py
parent70d6a560f2e23acbfaa85d1eda7471cfca15f77d (diff)
downloadsphinx-git-b43523fcbecda58ffd1ed31d29d0c9363a42be86.tar.gz
Use sphinx.util.logging instead app.info(), verbose(), debug() and debug2()
Diffstat (limited to 'sphinx/builders/applehelp.py')
-rw-r--r--sphinx/builders/applehelp.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/sphinx/builders/applehelp.py b/sphinx/builders/applehelp.py
index 3c2782802..b0c5c66b1 100644
--- a/sphinx/builders/applehelp.py
+++ b/sphinx/builders/applehelp.py
@@ -18,6 +18,7 @@ import shlex
from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.config import string_classes
+from sphinx.util import logging
from sphinx.util.osutil import copyfile, ensuredir, make_filename
from sphinx.util.console import bold # type: ignore
from sphinx.util.fileutil import copy_asset
@@ -33,6 +34,9 @@ if False:
from typing import Any # NOQA
from sphinx.application import Sphinx # NOQA
+
+logger = logging.getLogger(__name__)
+
# Use plistlib.dump in 3.4 and above
try:
write_plist = plistlib.dump # type: ignore
@@ -118,13 +122,13 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
target_dir = self.outdir
if path.isdir(source_dir):
- self.info(bold('copying localized files... '), nonl=True)
+ logger.info(bold('copying localized files... '), nonl=True)
excluded = Matcher(self.config.exclude_patterns + ['**/.*'])
copy_asset(source_dir, target_dir, excluded,
context=self.globalcontext, renderer=self.templates)
- self.info('done')
+ logger.info('done')
def build_helpbook(self):
# type: () -> None
@@ -165,20 +169,20 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
if self.config.applehelp_remote_url is not None:
info_plist['HPDBookRemoteURL'] = self.config.applehelp_remote_url
- self.info(bold('writing Info.plist... '), nonl=True)
+ logger.info(bold('writing Info.plist... '), nonl=True)
with open(path.join(contents_dir, 'Info.plist'), 'wb') as f:
write_plist(info_plist, f)
- self.info('done')
+ logger.info('done')
# Copy the icon, if one is supplied
if self.config.applehelp_icon:
- self.info(bold('copying icon... '), nonl=True)
+ logger.info(bold('copying icon... '), nonl=True)
try:
copyfile(path.join(self.srcdir, self.config.applehelp_icon),
path.join(resources_dir, info_plist['HPDBookIconPath']))
- self.info('done')
+ logger.info('done')
except Exception as err:
self.warn('cannot copy icon file %r: %s' %
(path.join(self.srcdir, self.config.applehelp_icon),
@@ -186,16 +190,16 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
del info_plist['HPDBookIconPath']
# Build the access page
- self.info(bold('building access page...'), nonl=True)
+ logger.info(bold('building access page...'), nonl=True)
with codecs.open(path.join(language_dir, '_access.html'), 'w') as f:
f.write(access_page_template % {
'toc': htmlescape(toc, quote=True),
'title': htmlescape(self.config.applehelp_title)
})
- self.info('done')
+ logger.info('done')
# Generate the help index
- self.info(bold('generating help index... '), nonl=True)
+ logger.info(bold('generating help index... '), nonl=True)
args = [
self.config.applehelp_indexer_path,
@@ -217,7 +221,7 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
args += ['-l', self.config.applehelp_locale]
if self.config.applehelp_disable_external_tools:
- self.info('skipping')
+ logger.info('skipping')
self.warn('you will need to index this help book with:\n %s'
% (' '.join([pipes.quote(arg) for arg in args])))
@@ -232,13 +236,13 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
if p.returncode != 0:
raise AppleHelpIndexerFailed(output)
else:
- self.info('done')
+ logger.info('done')
except OSError:
raise AppleHelpIndexerFailed('Command not found: %s' % args[0])
# If we've been asked to, sign the bundle
if self.config.applehelp_codesign_identity:
- self.info(bold('signing help book... '), nonl=True)
+ logger.info(bold('signing help book... '), nonl=True)
args = [
self.config.applehelp_codesign_path,
@@ -251,7 +255,7 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
args.append(self.bundle_path)
if self.config.applehelp_disable_external_tools:
- self.info('skipping')
+ logger.info('skipping')
self.warn('you will need to sign this help book with:\n %s'
% (' '.join([pipes.quote(arg) for arg in args])))
@@ -266,7 +270,7 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
if p.returncode != 0:
raise AppleHelpCodeSigningFailed(output)
else:
- self.info('done')
+ logger.info('done')
except OSError:
raise AppleHelpCodeSigningFailed('Command not found: %s' % args[0])