diff --git a/poetry/core/masonry/builders/builder.py b/poetry/core/masonry/builders/builder.py index c6f6d9cd6..d29c03040 100644 --- a/poetry/core/masonry/builders/builder.py +++ b/poetry/core/masonry/builders/builder.py @@ -153,8 +153,10 @@ def find_files_to_add( if "__pycache__" in str(file): continue + # this should be moved to Include.check_elements(), similar + # to PackageInclude.check_elements() if file.is_dir(): - if self.format in formats: + if self.format in formats: # why check this only for dirs? for current_file in file.glob("**/*"): include_file = BuildIncludeFile( path=current_file, @@ -163,8 +165,9 @@ def find_files_to_add( ) if not current_file.is_dir() and not self.is_excluded( - include_file.relative_to_source_root() + current_file.relative_to(self._path) ): + logger.debug("Adding: {}".format(str(current_file))) to_add.add(include_file) continue @@ -181,9 +184,7 @@ def find_files_to_add( path=file, project_root=self._path, source_root=source_root ) - if self.is_excluded( - include_file.relative_to_project_root() - ) and isinstance(include, PackageInclude): + if self.is_excluded(file.relative_to(source_root)): continue if file.suffix == ".pyc": diff --git a/poetry/core/vcs/git.py b/poetry/core/vcs/git.py index c060ec060..7bb9c0755 100644 --- a/poetry/core/vcs/git.py +++ b/poetry/core/vcs/git.py @@ -256,8 +256,9 @@ def get_ignored_files(self, folder=None): # type: (...) -> list args += ["ls-files", "--others", "-i", "--exclude-standard"] output = self.run(*args) + dotgit = list(str(path.relative_to(folder)) for path in folder.rglob(".git/*")) - return output.strip().split("\n") + return dotgit + output.strip().split("\n") def remote_urls(self, folder=None): # type: (...) -> dict output = self.run(