def run_makeindex(filename, verbose=False): """Run the makeindex command. Generate the index for the given file returning - the return value of ``makeindex``, - a value specifying if there were any fatal flaws (``True``) or not (``False``), and - the number of errors and - the number of warnings encountered while processing ``filename``. Arguments: filename The name of the tex file for which we want to generate an index. Returns: ``(int, bool, int, int)`` Examples: >>> chdir('Tests/TeX') >>> run_makeindex('makeindex.tex') # doctest:+ELLIPSIS <p class="info">Run...Makeindex... (0, False, 0, 0) >>> chdir('../..') """ run_object = Popen( "makeindex {}".format(shellquote("{}.idx".format(get_filename_without_extension(filename)))), shell=True, stdout=PIPE, stdin=PIPE, stderr=STDOUT, close_fds=True, universal_newlines=True, ) ip = MakeIndexParser(run_object.stdout, verbose) fatal, errors, warnings = ip.parse_stream() stat = run_object.wait() return stat, fatal, errors, warnings
def run_makeindex(filename, verbose=False): """Run the makeindex command. Generate the index for the given file returning - the return value of ``makeindex``, - a value specifying if there were any fatal flaws (``True``) or not (``False``), and - the number of errors and - the number of warnings encountered while processing ``filename``. Arguments: filename The name of the tex file for which we want to generate an index. Returns: ``(int, bool, int, int)`` Examples: >>> chdir('Tests/TeX') >>> run_makeindex('makeindex.tex') # doctest:+ELLIPSIS <p class="info">Run...Makeindex... (0, False, 0, 0) >>> chdir('../..') """ run_object = Popen("makeindex {}".format( shellquote("{}.idx".format(splitext(filename)[0]))), shell=True, stdout=PIPE, stdin=PIPE, stderr=STDOUT, close_fds=True, universal_newlines=True) ip = MakeIndexParser(run_object.stdout, verbose) fatal, errors, warnings = ip.parse_stream() stat = run_object.wait() return stat, fatal, errors, warnings