Example #1
0
def run_makeglossaries(filename, verbose=False):
    """Run makeglossaries for the given file.

    The interface of this function is exactly the same as the one for
    ``run_makeindex``. For the list of arguments and return values, please
    take a look at ``run_makeindex``.

    Arguments:

        filename

            The name of the tex file for which we want to generate an index.

        verbose

            This value specifies if all output should be printed
            (``verbose=True``) or if only significant messages should be
            printed.

    Examples:

        >>> chdir('Tests/TeX')
        >>> call('pdflatex makeglossaries.tex > /dev/null', shell=True)
        0
        >>> run_makeglossaries('makeglossaries.tex') # doctest:+ELLIPSIS
        <h2>Make Glossaries...
        ...
        (0, False, 0, 0)
        >>> chdir('../..')

    """
    run_object = Popen("makeglossaries {}".format(
        shellquote(splitext(filename)[0])),
                       shell=True,
                       stdout=PIPE,
                       stdin=PIPE,
                       stderr=STDOUT,
                       close_fds=True,
                       universal_newlines=True)
    bp = MakeGlossariesParser(run_object.stdout, verbose)
    fatal, errors, warnings = bp.parse_stream()
    stat = run_object.wait()
    return stat, fatal, errors, warnings
Example #2
0
def run_makeglossaries(filename, verbose=False):
    """Run makeglossaries for the given file.

    The interface of this function is exactly the same as the one for
    ``run_makeindex``. For the list of arguments and return values, please
    take a look at ``run_makeindex``.

    Arguments:

        filename

            The name of the tex file for which we want to generate an index.

        verbose

            This value specifies if all output should be printed
            (``verbose=True``) or if only significant messages should be
            printed.

    Examples:

        >>> chdir('Tests/TeX')
        >>> run_makeglossaries('makeglossaries.tex') # doctest:+ELLIPSIS
        <h2>Make Glossaries...
        ...
        (0, False, 0, 0)
        >>> chdir('../..')

    """
    run_object = Popen(
        "makeglossaries {}".format(shellquote(get_filename_without_extension(filename))),
        shell=True,
        stdout=PIPE,
        stdin=PIPE,
        stderr=STDOUT,
        close_fds=True,
        universal_newlines=True,
    )
    bp = MakeGlossariesParser(run_object.stdout, verbose)
    fatal, errors, warnings = bp.parse_stream()
    stat = run_object.wait()
    return stat, fatal, errors, warnings