Skip to content

Commit bd25b08

Browse files
witekdevsdouche
authored andcommitted
patch sphinx-build script to use terminate with sys.exit(), add extra info to makefile and batchfile.
1 parent 6236b50 commit bd25b08

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/collective/recipe/sphinxbuilder/__init__.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def install(self):
6767
extra_paths.append(filename)
6868
sys.path.extend(extra_paths)
6969

70-
from sphinx.quickstart import MAKEFILE
71-
from sphinx.quickstart import BATCHFILE
70+
from utils import MAKEFILE
71+
from utils import BATCHFILE
7272
from sphinx.util import make_filename
7373

7474
# and cleanup again
@@ -143,6 +143,26 @@ def install(self):
143143
self.buildout[self.buildout['buildout']['python']]['executable'],
144144
self.bin_dir, **egg_options)
145145

146+
# patch sphinx-build script
147+
# change last line from sphinx.main() to sys.exit(sphinx.main())
148+
# so that errors are correctly reported to Travis CI.
149+
150+
sb = os.path.join(self.bin_dir, 'sphinx-build')
151+
#Create temp file
152+
fh, abs_path = mkstemp()
153+
new_file = open(abs_path,'w')
154+
old_file = open(sb)
155+
for line in old_file:
156+
new_file.write(line.replace('sphinx.main()', 'sys.exit(sphinx.main())'))
157+
#close temp file
158+
new_file.close()
159+
os.close(fh)
160+
old_file.close()
161+
#Remove original file
162+
os.remove(sb)
163+
#Move new file
164+
shutil.move(abs_path, sb)
165+
146166
return [self.script_path, self.makefile_path, self.batchfile_path]
147167

148168
update = install

src/collective/recipe/sphinxbuilder/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
help:
2323
\t@echo "Please use \\`make <target>' where <target> is one of"
2424
\t@echo " html to make standalone HTML files"
25+
\t@echo " warnings-html to make standalone HTML files (warnings become errors)"
2526
\t@echo " dirhtml to make HTML files named index.html in directories"
2627
\t@echo " singlehtml to make a single large HTML file"
2728
\t@echo " pickle to make pickle files"
@@ -185,6 +186,7 @@
185186
\t:help
186187
\techo.Please use `make ^<target^>` where ^<target^> is one of
187188
\techo. html to make standalone HTML files
189+
\techo. warnings-html to make standalone HTML files (turn warnings into errors)
188190
\techo. dirhtml to make HTML files named index.html in directories
189191
\techo. singlehtml to make a single large HTML file
190192
\techo. pickle to make pickle files

0 commit comments

Comments
 (0)