mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #4693 from tk0miya/4655_detect_error_on_compile_catalogs
Catch errors on compiling catalogs (refs: #4655)
This commit is contained in:
commit
80176cdc76
23
setup.py
23
setup.py
@ -3,6 +3,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from distutils import log
|
from distutils import log
|
||||||
from distutils.cmd import Command
|
from distutils.cmd import Command
|
||||||
|
from io import StringIO
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
@ -64,6 +65,20 @@ extras_require = {
|
|||||||
|
|
||||||
cmdclass = {}
|
cmdclass = {}
|
||||||
|
|
||||||
|
|
||||||
|
class Tee(object):
|
||||||
|
def __init__(self, stream):
|
||||||
|
self.stream = stream
|
||||||
|
self.buffer = StringIO()
|
||||||
|
|
||||||
|
def write(self, s):
|
||||||
|
self.stream.write(s)
|
||||||
|
self.buffer.write(s)
|
||||||
|
|
||||||
|
def flush(self):
|
||||||
|
self.stream.flush()
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from babel.messages.pofile import read_po
|
from babel.messages.pofile import read_po
|
||||||
from babel.messages.frontend import compile_catalog
|
from babel.messages.frontend import compile_catalog
|
||||||
@ -81,7 +96,13 @@ else:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
compile_catalog.run(self)
|
try:
|
||||||
|
sys.stderr = Tee(sys.stderr)
|
||||||
|
compile_catalog.run(self)
|
||||||
|
finally:
|
||||||
|
if sys.stderr.buffer.getvalue():
|
||||||
|
print("Compiling failed.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if isinstance(self.domain, list):
|
if isinstance(self.domain, list):
|
||||||
for domain in self.domain:
|
for domain in self.domain:
|
||||||
|
Loading…
Reference in New Issue
Block a user