Skip to content

Commit

Permalink
exporting packages with features
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed May 25, 2022
1 parent dad4edc commit 2951b42
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 2951b42

Please sign in to comment.