Skip to content

Commit

Permalink
Merge pull request conda#560 from maresb/dont-filter-in-toposort
Browse files Browse the repository at this point in the history
Don't filter in toposort
  • Loading branch information
maresb committed Dec 10, 2023
2 parents a301e96 + 41ae11f commit 795f249
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
3 changes: 2 additions & 1 deletion conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def make_lock_files( # noqa: C901
deep=True,
update={"package": packages_not_to_lock},
)
new_lock_content = lock_content_to_persist | fresh_lock_content
new_lock_content = lock_content_to_persist.merge(fresh_lock_content)

if "lock" in kinds:
write_conda_lock_file(
Expand Down Expand Up @@ -609,6 +609,7 @@ def render_lockfile_for_platform( # noqa: C901

# ensure consistent ordering of generated file
lockfile.toposort_inplace()
lockfile.filter_virtual_packages_inplace()

for p in lockfile.package:
if p.platform == platform and p.category in categories:
Expand Down
13 changes: 2 additions & 11 deletions conda_lock/lockfile/v2prelim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class Lockfile(StrictModel):
package: List[LockedDependency]
metadata: LockMeta

def __or__(self, other: "Lockfile") -> "Lockfile":
return other.__ror__(self)

def __ror__(self, other: "Optional[Lockfile]") -> "Lockfile":
def merge(self, other: "Optional[Lockfile]") -> "Lockfile":
"""
merge self into other
"""
Expand Down Expand Up @@ -84,9 +81,7 @@ def filter_virtual_packages_inplace(self) -> None:
]

@staticmethod
def _toposort(
package: List[LockedDependency], update: bool = False
) -> List[LockedDependency]:
def _toposort(package: List[LockedDependency]) -> List[LockedDependency]:
platforms = {d.platform for d in package}

# Resort the conda packages topologically
Expand Down Expand Up @@ -120,10 +115,6 @@ def _toposort(
continue
if dep.manager != manager:
continue
# skip virtual packages
if dep.manager == "conda" and dep.name.startswith("__"):
continue

final_package.append(dep)

return final_package
Expand Down

0 comments on commit 795f249

Please sign in to comment.