Skip to content

Commit

Permalink
add support for PEP 621: use all_requires_for_locking instead of `a…
Browse files Browse the repository at this point in the history
…ll_requires`
  • Loading branch information
radoering committed Mar 15, 2024
1 parent 5788145 commit 7b61c6b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/poetry/console/commands/debug/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def handle(self) -> int:

packages = [op.package for op in ops]

requires = package.all_requires
requires = package.all_requires_for_locking
for pkg in packages:
for require in requires:
if pkg.name == require.name:
Expand Down
6 changes: 3 additions & 3 deletions src/poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def _display_packages_information(
write_why = self.option("why") and (why_end_column + 3) <= width
write_description = (why_end_column + 24) <= width

requires = root.all_requires
requires = root.all_requires_for_locking

for locked in locked_packages:
color = "cyan"
Expand Down Expand Up @@ -406,7 +406,7 @@ def _display_packages_tree_information(
packages = locked_repository.packages

for p in packages:
for require in root.all_requires:
for require in root.all_requires_for_locking:
if p.name == require.name:
self.display_package_tree(self.io, p, packages)
break
Expand Down Expand Up @@ -544,7 +544,7 @@ def find_latest_package(
from poetry.version.version_selector import VersionSelector

# find the latest version allowed in this pool
requires = root.all_requires
requires = root.all_requires_for_locking
if package.is_direct_origin():
for dep in requires:
if dep.name == package.name and dep.source_type == package.source_type:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def create_pyproject_from_package(cls, package: Package) -> TOMLDocument:
dependency_section = content["dependencies"] = tomlkit.table()
dependency_section["python"] = package.python_versions

for dep in package.all_requires:
for dep in package.all_requires_for_locking:
constraint: DependencySpec | str = dependency_to_specification(
dep, tomlkit.inline_table()
)
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/puzzle/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def incompatibilities_for(
"""
package = dependency_package.package
if package.is_root():
dependencies = package.all_requires
dependencies = package.all_requires_for_locking
else:
dependencies = package.requires

Expand Down Expand Up @@ -479,7 +479,7 @@ def complete_package(
dependency_package = dependency_package.clone()
package = dependency_package.package
dependency = dependency_package.dependency
requires = package.all_requires
requires = package.all_requires_for_locking
elif package.is_direct_origin():
requires = package.requires
else:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/puzzle/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def __init__(
def reachable(self) -> list[PackageNode]:
children: list[PackageNode] = []

for dependency in self.package.all_requires:
for dependency in self.package.all_requires_for_locking:
for pkg in self.packages:
if pkg.complete_name == dependency.complete_name and (
dependency.constraint.allows(pkg.version)
Expand Down

0 comments on commit 7b61c6b

Please sign in to comment.