Skip to content

Commit

Permalink
Move up source condition and use source_root for files inside dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasiscovici2 committed Mar 8, 2022
1 parent 1314ad4 commit c9d3c54
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/poetry/core/masonry/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,22 @@ def find_files_to_add(self, exclude_build: bool = True) -> Set["BuildIncludeFile
if "__pycache__" in str(file):
continue

if (
isinstance(include, PackageInclude)
and include.source
and self.format == "wheel"
):
source_root = include.base
else:
source_root = self._path

if file.is_dir():
if self.format in formats:
for current_file in file.glob("**/*"):
include_file = BuildIncludeFile(
path=current_file,
project_root=self._path,
source_root=self._path,
source_root=source_root,
)

if not current_file.is_dir() and not self.is_excluded(
Expand All @@ -185,15 +194,6 @@ def find_files_to_add(self, exclude_build: bool = True) -> Set["BuildIncludeFile
to_add.add(include_file)
continue

if (
isinstance(include, PackageInclude)
and include.source
and self.format == "wheel"
):
source_root = include.base
else:
source_root = self._path

include_file = BuildIncludeFile(
path=file, project_root=self._path, source_root=source_root
)
Expand Down

0 comments on commit c9d3c54

Please sign in to comment.