Exemple #1
0
    def find_excluded_files(self):  # type: () -> Set[str]
        # Checking VCS
        vcs = get_vcs(self._original_path)
        if not vcs:
            vcs_ignored_files = set()
        else:
            vcs_ignored_files = set(vcs.get_ignored_files())

        explicitely_excluded = set()
        for excluded_glob in self._package.exclude:

            for excluded in glob(
                Path(self._path, excluded_glob).as_posix(), recursive=True
            ):
                explicitely_excluded.add(
                    Path(excluded).relative_to(self._path).as_posix()
                )

        ignored = vcs_ignored_files | explicitely_excluded
        result = set()
        for file in ignored:
            result.add(file)

        # The list of excluded files might be big and we will do a lot
        # containment check (x in excluded).
        # Returning a set make those tests much much faster.
        return result
Exemple #2
0
    def find_excluded_files(self):  # type: () -> list
        # Checking VCS
        vcs = get_vcs(self._path)
        if not vcs:
            vcs_ignored_files = []
        else:
            vcs_ignored_files = vcs.get_ignored_files()

        explicitely_excluded = []
        for excluded_glob in self._package.exclude:
            for excluded in self._path.glob(excluded_glob):
                explicitely_excluded.append(excluded)

        ignored = vcs_ignored_files + explicitely_excluded
        result = []
        for file in ignored:
            try:
                file = Path(file).absolute().relative_to(self._path)
            except ValueError:
                # Should only happen in tests
                continue

            result.append(file)

        return result
Exemple #3
0
    def find_excluded_files(self):  # type: () -> Set[str]
        # Checking VCS
        vcs = get_vcs(self._path)
        if not vcs:
            vcs_ignored_files = set()
        else:
            vcs_ignored_files = set(vcs.get_ignored_files())

        explicitely_excluded = set()
        for excluded_glob in self._package.exclude:
            excluded_path = Path(self._path, excluded_glob)

            try:
                is_dir = excluded_path.is_dir()
            except OSError:
                # On Windows, testing if a path with a glob is a directory will raise an OSError
                is_dir = False
            if is_dir:
                excluded_glob = Path(excluded_glob, "**/*")

            for excluded in glob(Path(self._path, excluded_glob).as_posix(),
                                 recursive=True):
                explicitely_excluded.add(
                    Path(excluded).relative_to(self._path).as_posix())

        ignored = vcs_ignored_files | explicitely_excluded
        result = set()
        for file in ignored:
            result.add(file)

        # The list of excluded files might be big and we will do a lot
        # containment check (x in excluded).
        # Returning a set make those tests much much faster.
        return result
Exemple #4
0
    def find_excluded_files(self) -> list:
        # Checking VCS
        vcs = get_vcs(self._path)
        if not vcs:
            return []

        ignored = vcs.get_ignored_files()
        result = []
        for file in ignored:
            try:
                file = Path(file).absolute().relative_to(self._path)
            except ValueError:
                # Should only happen in tests
                continue

            result.append(file)

        return result
Exemple #5
0
    def find_excluded_files(self):  # type: () -> list
        # Checking VCS
        vcs = get_vcs(self._path)
        if not vcs:
            return []

        explicitely_excluded = []
        for excluded_glob in self._package.exclude:
            for excluded in self._path.glob(excluded_glob):
                explicitely_excluded.append(excluded)

        ignored = vcs.get_ignored_files() + explicitely_excluded
        result = []
        for file in ignored:
            try:
                file = Path(file).absolute().relative_to(self._path)
            except ValueError:
                # Should only happen in tests
                continue

            result.append(file)

        return result