コード例 #1
0
def get_reqs(which):
    """Gets requirements from all_reqs with versions."""
    reqs = []
    for req in all_reqs[which]:
        req_str = get_base_req(req) + ">=" + ver_tuple_to_str(
            min_versions[req])
        if req in version_strictly:
            req_str += ",<" + ver_tuple_to_str(
                get_next_version(min_versions[req]))
        env_marker = req[1] if isinstance(req, tuple) else None
        if env_marker:
            if env_marker == "py2":
                if supports_env_markers:
                    req_str += ";python_version<'3'"
                elif not PY2:
                    continue
            elif env_marker == "py3":
                if supports_env_markers:
                    req_str += ";python_version>='3'"
                elif PY2:
                    continue
            elif env_marker == "py34":
                if supports_env_markers:
                    req_str += ";python_version>='3.4'"
                elif not PY34:
                    continue
            else:
                raise ValueError("unknown env marker id " + repr(env_marker))
        reqs.append(req_str)
    return reqs
コード例 #2
0
ファイル: requirements.py プロジェクト: evhub/coconut
def get_reqs(which="main"):
    """Gets requirements from all_reqs with versions."""
    reqs = []
    for req in all_reqs[which]:
        req_str = req + ">=" + ver_tuple_to_str(min_versions[req])
        if req in version_strictly:
            req_str += ",<" + ver_tuple_to_str(min_versions[req][:-1]) + "." + str(min_versions[req][-1] + 1)
        reqs.append(req_str)
    return reqs
コード例 #3
0
ファイル: requirements.py プロジェクト: zhenyulin/coconut
def get_reqs(which="main"):
    """Gets requirements from all_reqs with versions."""
    reqs = []
    for req in all_reqs[which]:
        req_str = req + ">=" + ver_tuple_to_str(min_versions[req])
        if req in version_strictly:
            req_str += ",<" + ver_tuple_to_str(
                min_versions[req][:-1]) + "." + str(min_versions[req][-1] + 1)
        reqs.append(req_str)
    return reqs
コード例 #4
0
def print_new_versions(strict=False):
    """Prints new requirement versions."""
    new_updates = []
    same_updates = []
    pinned_updates = []
    for req in everything_in(all_reqs):
        new_versions = []
        same_versions = []
        for ver_str in all_versions(req):
            if newer(ver_str_to_tuple(ver_str), min_versions[req],
                     strict=True):
                new_versions.append(ver_str)
            elif not strict and newer(ver_str_to_tuple(ver_str),
                                      min_versions[req]):
                same_versions.append(ver_str)
        if isinstance(req, tuple):
            base_req, env_marker = req
        else:
            base_req, env_marker = req, None
        update_str = (
            base_req + (" (" + env_marker + ")" if env_marker else "") +
            " = " + ver_tuple_to_str(min_versions[req]) + " -> " +
            ", ".join(new_versions + ["(" + v + ")" for v in same_versions]))
        if req in pinned_reqs:
            pinned_updates.append(update_str)
        elif new_versions:
            new_updates.append(update_str)
        elif same_versions:
            same_updates.append(update_str)
    print("\n".join(new_updates))
    print()
    print("\n".join(same_updates))
    print()
    print("\n".join(pinned_updates))
コード例 #5
0
ファイル: requirements.py プロジェクト: evhub/coconut
def print_new_versions(strict=False):
    """Prints new requirement versions."""
    new_updates = []
    same_updates = []
    for req in everything_in(all_reqs):
        new_versions = []
        same_versions = []
        for ver_str in all_versions(req):
            if newer(ver_str_to_tuple(ver_str), min_versions[req], strict=True):
                new_versions.append(ver_str)
            elif not strict and newer(ver_str_to_tuple(ver_str), min_versions[req]):
                same_versions.append(ver_str)
        update_str = req + ": " + ver_tuple_to_str(min_versions[req]) + " -> " + ", ".join(
            new_versions + ["(" + v + ")" for v in same_versions],
        )
        if new_versions:
            new_updates.append(update_str)
        elif same_versions:
            same_updates.append(update_str)
    print("\n".join(new_updates + same_updates))
コード例 #6
0
ファイル: requirements.py プロジェクト: zhenyulin/coconut
def print_new_versions(strict=False):
    """Prints new requirement versions."""
    new_updates = []
    same_updates = []
    for req in everything_in(all_reqs):
        new_versions = []
        same_versions = []
        for ver_str in all_versions(req):
            if newer(ver_str_to_tuple(ver_str), min_versions[req],
                     strict=True):
                new_versions.append(ver_str)
            elif not strict and newer(ver_str_to_tuple(ver_str),
                                      min_versions[req]):
                same_versions.append(ver_str)
        update_str = req + ": " + ver_tuple_to_str(
            min_versions[req]) + " -> " + ", ".join(
                new_versions + ["(" + v + ")" for v in same_versions], )
        if new_versions:
            new_updates.append(update_str)
        elif same_versions:
            same_updates.append(update_str)
    print("\n".join(new_updates + same_updates))
コード例 #7
0
        from pyparsing import (  # NOQA
            _trim_arity,
            _ParseResultsWithOffset,
            __version__,
        )
        PYPARSING = "Python pyparsing v" + __version__

    except ImportError:
        traceback.print_exc()
        __version__ = None

# -----------------------------------------------------------------------------------------------------------------------
# SETUP:
# -----------------------------------------------------------------------------------------------------------------------

if __version__ is None or ver_str_to_tuple(__version__) < min_versions["pyparsing"]:
    req_ver_str = ver_tuple_to_str(min_versions["pyparsing"])
    raise ImportError(
        "Coconut requires pyparsing version >= " + req_ver_str
        + ("; got version " + __version__ if __version__ is not None else "")
        + " (run 'pip install --upgrade pyparsing' or"
        + " 'pip install --upgrade cPyparsing' to fix)",
    )

if packrat_cache:
    ParserElement.enablePackrat(packrat_cache)

ParserElement.setDefaultWhitespaceChars(default_whitespace_chars)

Keyword.setDefaultKeywordChars(varchars)
コード例 #8
0
        PYPARSING_PACKAGE = "cPyparsing"
        PYPARSING_INFO = None

# -----------------------------------------------------------------------------------------------------------------------
# SETUP:
# -----------------------------------------------------------------------------------------------------------------------

min_ver = min(min_versions["pyparsing"],
              min_versions["cPyparsing"][:3])  # inclusive
max_ver = get_next_version(
    max(min_versions["pyparsing"],
        min_versions["cPyparsing"][:3]))  # exclusive
cur_ver = None if __version__ is None else ver_str_to_tuple(__version__)

if cur_ver is None or cur_ver < min_ver:
    min_ver_str = ver_tuple_to_str(min_ver)
    raise ImportError(
        "Coconut requires pyparsing/cPyparsing version >= " + min_ver_str +
        ("; got " + PYPARSING_INFO if PYPARSING_INFO is not None else "") +
        " (run 'pip install --upgrade " + PYPARSING_PACKAGE + "' to fix)", )
elif cur_ver >= max_ver:
    max_ver_str = ver_tuple_to_str(max_ver)
    warnings.warn(
        "This version of Coconut was built for pyparsing/cPyparsing version < "
        + max_ver_str +
        ("; got " + PYPARSING_INFO if PYPARSING_INFO is not None else "") +
        " (run 'pip install " + PYPARSING_PACKAGE + "<" + max_ver_str +
        "' to fix)", )


def fast_str(cls):