Beispiel #1
0
def check_pandoc_version():
    """Returns True if pandoc's version meets at least minimal version.

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    v = get_pandoc_version()
    if v is None:
        warnings.warn(
            "Sorry, we cannot determine the version of pandoc.\n"
            "Please consider reporting this issue and include the"
            "output of pandoc --version.\nContinuing...",
            RuntimeWarning,
            stacklevel=2)
        return False
    ok = check_version(v, _minimal_version)
    if not ok:
        warnings.warn(
            "You are using an old version of pandoc (%s)\n" % v +
            "Recommended version is %s.\nTry updating." % _minimal_version +
            "http://pandoc.org/installing.html.\nContinuing with doubts...",
            RuntimeWarning,
            stacklevel=2)
    return ok
Beispiel #2
0
def check_pandoc_version():
    """Returns True if minimal pandoc version is met.

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    v = get_pandoc_version()
    if v is None:
        warnings.warn(
            "Sorry, we cannot determine the version of pandoc.\n"
            "Please consider reporting this issue and include the"
            "output of pandoc --version.\nContinuing...",
            RuntimeWarning,
            stacklevel=2,
        )
        return False
    ok = check_version(v, _minimal_version)
    if not ok:
        warnings.warn(
            "You are using an old version of pandoc (%s)\n" % v
            + "Recommended version is %s.\nTry updating." % _minimal_version
            + "http://johnmacfarlane.net/pandoc/installing.html.\nContinuing with doubts...",
            RuntimeWarning,
            stacklevel=2,
        )
    return ok
Beispiel #3
0
def check_pandoc_version():
    """Returns True if pandoc's version meets at least minimal version.

    Raises
    ------
    PandocMissing
        If pandoc is unavailable.
    """
    if check_pandoc_version._cached is not None:
        return check_pandoc_version._cached

    v = get_pandoc_version()
    if v is None:
        warnings.warn(
            "Sorry, we cannot determine the version of pandoc.\n"
            "Please consider reporting this issue and include the"
            "output of pandoc --version.\nContinuing...",
            RuntimeWarning,
            stacklevel=2)
        return False
    ok = check_version(v, _minimal_version, max_v=_maximal_version)
    check_pandoc_version._cached = ok
    if not ok:
        warnings.warn(
            "You are using an unsupported version of pandoc (%s).\n" % v +
            "Your version must be at least (%s) " % _minimal_version +
            "but less than (%s).\n" % _maximal_version +
            "Refer to http://pandoc.org/installing.html.\nContinuing with doubts...",
            RuntimeWarning,
            stacklevel=2)
    return ok
Beispiel #4
0
def check_pandoc_version():
    """Returns True if pandoc's version meets at least minimal version.

    Raises
    ------
    PandocMissing
      If pandoc is unavailable.
    """
    if check_pandoc_version._cached is not None:
        return check_pandoc_version._cached

    v = get_pandoc_version()
    if v is None:
        warnings.warn("Sorry, we cannot determine the version of pandoc.\n"
                      "Please consider reporting this issue and include the"
                      "output of pandoc --version.\nContinuing...",
                      RuntimeWarning, stacklevel=2)
        return False
    ok = check_version(v, _minimal_version, max_v=_maximal_version)
    check_pandoc_version._cached = ok
    if not ok:
        warnings.warn( "You are using an unsupported version of pandoc (%s).\n" % v +
                       "Your version must be at least (%s) " % _minimal_version +
                       "but less than (%s).\n" % _maximal_version +
                       "Refer to http://pandoc.org/installing.html.\nContinuing with doubts...",
                       RuntimeWarning, stacklevel=2)
    return ok
Beispiel #5
0
def _verify_node(cmd):
    """Verify that the node command exists and is at least the minimum supported
    version of node.

    Parameters
    ----------
    cmd : string
        Node command to verify (i.e 'node')."""
    try:
        p = subprocess.Popen([cmd, '--version'],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, _ = p.communicate()
        out = out.decode('utf8', 'replace')
    except OSError:
        # Command not found
        return False
    if p.returncode:
        # Command error
        return False
    return check_version(out.lstrip('v'), '0.9.12')
Beispiel #6
0
def _verify_node(cmd):
    """Verify that the node command exists and is at least the minimum supported
    version of node.

    Parameters
    ----------
    cmd : string
        Node command to verify (i.e 'node')."""
    try:
        p = subprocess.Popen([cmd, '--version'],
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE)
        out, _ = p.communicate()
        out = out.decode('utf8', 'replace')
    except OSError:
        # Command not found
        return False
    if p.returncode:
        # Command error
        return False
    return check_version(out.lstrip('v'), '0.9.12')