예제 #1
0
def _should_build(
    req: InstallRequirement,
    need_wheel: bool,
    check_binary_allowed: BinaryAllowedPredicate,
) -> bool:
    """Return whether an InstallRequirement should be built into a wheel."""
    if req.constraint:
        # never build requirements that are merely constraints
        return False
    if req.is_wheel:
        if need_wheel:
            logger.info(
                "Skipping %s, due to already being wheel.",
                req.name,
            )
        return False

    if need_wheel:
        # i.e. pip wheel, not pip install
        return True

    # From this point, this concerns the pip install command only
    # (need_wheel=False).

    if not req.source_dir:
        return False

    if req.editable:
        if req.use_pep517 and req.supports_pyproject_editable is not False:
            return True
        # we don't build legacy editable requirements
        return False

    if req.use_pep517:
        return True

    if not check_binary_allowed(req):
        logger.info(
            "Skipping wheel build for %s, due to binaries being disabled for it.",
            req.name,
        )
        return False

    if not is_wheel_installed():
        # we don't build legacy requirements if wheel is not installed
        logger.info(
            "Using legacy 'setup.py install' for %s, "
            "since package 'wheel' is not installed.",
            req.name,
        )
        return False

    return True
예제 #2
0
def _should_build(
    req,  # type: InstallRequirement
    need_wheel,  # type: bool
    check_binary_allowed,  # type: BinaryAllowedPredicate
):
    # type: (...) -> bool
    """Return whether an InstallRequirement should be built into a wheel."""
    if req.constraint:
        # never build requirements that are merely constraints
        return False
    if req.is_wheel:
        if need_wheel:
            logger.info(
                'Skipping %s, due to already being wheel.', req.name,
            )
        return False

    if need_wheel:
        # i.e. pip wheel, not pip install
        return True

    # From this point, this concerns the pip install command only
    # (need_wheel=False).

    if req.editable or not req.source_dir:
        return False

    if not check_binary_allowed(req):
        logger.info(
            "Skipping wheel build for %s, due to binaries "
            "being disabled for it.", req.name,
        )
        return False

    if not req.use_pep517 and not is_wheel_installed():
        # we don't build legacy requirements if wheel is not installed
        logger.info(
<<<<<<< HEAD
            "Using legacy 'setup.py install' for %s, "
=======
            "Using legacy setup.py install for %s, "
>>>>>>> b66a76afa15ab74019740676a52a071b85ed8f71
            "since package 'wheel' is not installed.", req.name,
        )
        return False

    return True