def ensure_targets()

in setup.py [0:0]


def ensure_targets(targets):
    """Return a Command that checks that certain files exist.

    Raises a ValueError if any of the files are missing.

    Note: The check is skipped if the `--skip-npm` flag is used.
    """

    class TargetsCheck(BaseCommand):
        def run(self):
            if skip_npm:
                log.info("Skipping target checks")
                return
            missing = [t for t in targets if not os.path.exists(t)]
            if missing:
                raise ValueError(("missing files: %s" % missing))

    return TargetsCheck