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

exporting packages with features #5688

Merged
merged 1 commit into from
May 26, 2022
Merged
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
11 changes: 6 additions & 5 deletions src/poetry/packages/locker.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,22 @@ def __walk_dependencies(
if not locked_package:
raise RuntimeError(f"Dependency walk failed at {requirement}")

if requirement.extras:
locked_package = locked_package.with_features(requirement.extras)

# create dependency from locked package to retain dependency metadata
# if this is not done, we can end-up with incorrect nested dependencies
constraint = requirement.constraint
marker = requirement.marker
extras = requirement.extras
requirement = locked_package.to_dependency()
requirement.marker = requirement.marker.intersect(marker)

requirement.set_constraint(constraint)

for require in locked_package.requires:
if require.in_extras and extras.isdisjoint(require.in_extras):
if require.in_extras and locked_package.features.isdisjoint(
require.in_extras
):
continue

require = deepcopy(require)
Expand Down Expand Up @@ -369,9 +373,6 @@ def get_project_dependency_packages(
project_requires=selected,
locked_packages=repository.packages,
):
for extra in dependency.extras:
package.requires_extras.append(extra)

yield DependencyPackage(dependency=dependency, package=package)

def set_lock_data(self, root: Package, packages: list[Package]) -> bool:
Expand Down