summaryrefslogtreecommitdiff
path: root/sphinx/builders/applehelp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-07-14 20:24:00 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-07-14 20:24:00 +0900
commit2b6a83599dc355a92c08e550c681075b651866c4 (patch)
tree38813c3272f6476a4f43e9e36eff6fbac2a12120 /sphinx/builders/applehelp.py
parent47b33e93e5ad4b226f124cd21a5e5da535b930b2 (diff)
downloadsphinx-git-2b6a83599dc355a92c08e550c681075b651866c4.tar.gz
applehelp: Sphinx crashes if ``hiutil`` or ``codesign`` commands not found
Diffstat (limited to 'sphinx/builders/applehelp.py')
-rw-r--r--sphinx/builders/applehelp.py42
1 files changed, 24 insertions, 18 deletions
diff --git a/sphinx/builders/applehelp.py b/sphinx/builders/applehelp.py
index ee5c1ada6..a6c89b628 100644
--- a/sphinx/builders/applehelp.py
+++ b/sphinx/builders/applehelp.py
@@ -217,16 +217,19 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
self.warn('you will need to index this help book with:\n %s'
% (' '.join([pipes.quote(arg) for arg in args])))
else:
- p = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
+ try:
+ p = subprocess.Popen(args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
- output = p.communicate()[0]
+ output = p.communicate()[0]
- if p.returncode != 0:
- raise AppleHelpIndexerFailed(output)
- else:
- self.info('done')
+ if p.returncode != 0:
+ raise AppleHelpIndexerFailed(output)
+ else:
+ self.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:
@@ -248,13 +251,16 @@ class AppleHelpBuilder(StandaloneHTMLBuilder):
self.warn('you will need to sign this help book with:\n %s'
% (' '.join([pipes.quote(arg) for arg in args])))
else:
- p = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
-
- output = p.communicate()[0]
-
- if p.returncode != 0:
- raise AppleHelpCodeSigningFailed(output)
- else:
- self.info('done')
+ try:
+ p = subprocess.Popen(args,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+
+ output = p.communicate()[0]
+
+ if p.returncode != 0:
+ raise AppleHelpCodeSigningFailed(output)
+ else:
+ self.info('done')
+ except OSError:
+ raise AppleHelpCodeSigningFailed('Command not found: %s' % args[0])