Beispiel #1
0
    def marker_passes(marker):
        """
		Given an environment marker, return True if the marker is valid
		and matches this environment.
		"""
        return (marker and not pkg_resources.invalid_marker(marker)
                and pkg_resources.evaluate_marker(marker))
 def marker_passes(marker):
     """
     Given an environment marker, return True if the marker is valid
     and matches this environment.
     """
     return (
         marker
         and not pkg_resources.invalid_marker(marker)
         and pkg_resources.evaluate_marker(marker)
     )
Beispiel #3
0
def _check_extra(extra, reqs):
    name, sep, marker = extra.partition(':')
    if marker and pkg_resources.invalid_marker(marker):
        raise DistutilsSetupError("Invalid environment marker: " + marker)

    # extras requirements cannot themselves have markers
    parsed = pkg_resources.parse_requirements(reqs)
    marked_reqs = filter(operator.attrgetter('marker'), parsed)
    bad_req = next(marked_reqs, None)
    if bad_req:
        tmpl = ("'extras_require' requirements cannot include "
                "environment markers, in {name!r}: '{bad_req!s}'")
        raise DistutilsSetupError(tmpl.format(**locals()))
Beispiel #4
0
def check_extras(dist, attr, value):
    """Verify that extras_require mapping is valid"""
    try:
        for k, v in value.items():
            if ":" in k:
                k, m = k.split(":", 1)
                if pkg_resources.invalid_marker(m):
                    raise DistutilsSetupError("Invalid environment marker: " + m)
            list(pkg_resources.parse_requirements(v))
    except (TypeError, ValueError, AttributeError):
        raise DistutilsSetupError(
            "'extras_require' must be a dictionary whose values are "
            "strings or lists of strings containing valid project/version "
            "requirement specifiers."
        )
Beispiel #5
0
def check_extras(dist, attr, value):
    """Verify that extras_require mapping is valid"""
    try:
        for k, v in value.items():
            if ':' in k:
                k, m = k.split(':', 1)
                if pkg_resources.invalid_marker(m):
                    raise DistutilsSetupError("Invalid environment marker: " +
                                              m)
            list(pkg_resources.parse_requirements(v))
    except (TypeError, ValueError, AttributeError):
        raise DistutilsSetupError(
            "'extras_require' must be a dictionary whose values are "
            "strings or lists of strings containing valid project/version "
            "requirement specifiers.")
Beispiel #6
0
def _check_extra(extra, reqs):
    name, sep, marker = extra.partition(':')
    if marker and pkg_resources.invalid_marker(marker):
        raise DistutilsSetupError("Invalid environment marker: " + marker)

    # extras requirements cannot themselves have markers
    parsed = pkg_resources.parse_requirements(reqs)
    marked_reqs = filter(operator.attrgetter('marker'), parsed)
    bad_req = next(marked_reqs, None)
    if bad_req:
        tmpl = (
            "'extras_require' requirements cannot include "
            "environment markers, in {name!r}: '{bad_req!s}'"
        )
        raise DistutilsSetupError(tmpl.format(**locals()))
Beispiel #7
0
def _check_extra(extra, reqs):
    name, sep, marker = extra.partition(':')
    if marker and pkg_resources.invalid_marker(marker):
        raise DistutilsSetupError("Invalid environment marker: " + marker)
    list(pkg_resources.parse_requirements(reqs))