Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Pass in source_subdirectory to get_package_from_vcs #5533

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _get_package_from_git(
tag: str | None = None,
rev: str | None = None,
source_root: Path | None = None,
source_subdirectory: str | None = None,
) -> Package:
source = Git.clone(
url=url,
Expand All @@ -78,7 +79,11 @@ def _get_package_from_git(
)
revision = Git.get_revision(source)

package = Provider.get_package_from_directory(Path(source.path))
directory = Path(source.path)
if source_subdirectory:
directory = directory / source_subdirectory

package = Provider.get_package_from_directory(directory)
package._source_type = "git"
package._source_url = url
package._source_reference = rev or tag or branch or "HEAD"
Expand Down Expand Up @@ -214,6 +219,7 @@ def search_for_vcs(self, dependency: VCSDependency) -> list[Package]:
rev=dependency.rev,
source_root=self._source_root
or (self._env.path.joinpath("src") if self._env else None),
source_subdirectory=dependency._source_subdirectory,
)

self.validate_package_for_dependency(dependency=dependency, package=package)
Expand All @@ -239,12 +245,18 @@ def get_package_from_vcs(
tag: str | None = None,
rev: str | None = None,
source_root: Path | None = None,
source_subdirectory: str | None = None,
) -> Package:
if vcs != "git":
raise ValueError(f"Unsupported VCS dependency {vcs}")

return _get_package_from_git(
url=url, branch=branch, tag=tag, rev=rev, source_root=source_root
url=url,
branch=branch,
tag=tag,
rev=rev,
source_root=source_root,
source_subdirectory=source_subdirectory,
)

def search_for_file(self, dependency: FileDependency) -> list[Package]:
Expand Down