mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-04-21 08:18:57 +02:00
Doxybuild: Error message if doxygen not found
This patch introduces a better error message. See discussion at pull #129.
This commit is contained in:
parent
ff5abe76a5
commit
bb0c80b3e5
24
doxybuild.py
24
doxybuild.py
@ -4,6 +4,7 @@ from __future__ import print_function
|
|||||||
from devtools import tarball
|
from devtools import tarball
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import traceback
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@ -52,24 +53,39 @@ def do_subst_in_file(targetfile, sourcefile, dict):
|
|||||||
def getstatusoutput(cmd):
|
def getstatusoutput(cmd):
|
||||||
"""cmd is a list.
|
"""cmd is a list.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
output, _ = process.communicate()
|
output, _ = process.communicate()
|
||||||
status = process.returncode
|
status = process.returncode
|
||||||
|
except:
|
||||||
|
status = -1
|
||||||
|
output = traceback.format_exc()
|
||||||
return status, output
|
return status, output
|
||||||
|
|
||||||
def run_cmd(cmd, silent=False):
|
def run_cmd(cmd, silent=False):
|
||||||
print('Running:', repr(' '.join(cmd)), 'in', repr(os.getcwd()))
|
"""Raise exception on failure.
|
||||||
|
"""
|
||||||
|
info = 'Running: %r in %r' %(' '.join(cmd), os.getcwd())
|
||||||
|
print(info)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
if silent:
|
if silent:
|
||||||
status, output = getstatusoutput(cmd)
|
status, output = getstatusoutput(cmd)
|
||||||
else:
|
else:
|
||||||
status, output = os.system(' '.join(cmd)), ''
|
status, output = os.system(' '.join(cmd)), ''
|
||||||
if status:
|
if status:
|
||||||
msg = 'error=%d, output="""\n%s\n"""' %(status, output)
|
msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output)
|
||||||
print(msg)
|
raise Exception(msg)
|
||||||
#raise Exception(msg)
|
|
||||||
|
def assert_is_exe(path):
|
||||||
|
if not path:
|
||||||
|
raise Exception('path is empty.')
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
raise Exception('%r is not a file.' %path)
|
||||||
|
if not os.access(path, os.X_OK):
|
||||||
|
raise Exception('%r is not executable by this user.' %path)
|
||||||
|
|
||||||
def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
|
def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
|
||||||
|
assert_is_exe(doxygen_path)
|
||||||
config_file = os.path.abspath(config_file)
|
config_file = os.path.abspath(config_file)
|
||||||
with cd(working_dir):
|
with cd(working_dir):
|
||||||
cmd = [doxygen_path, config_file]
|
cmd = [doxygen_path, config_file]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user