diff --git a/conda_lock/conda_lock.py b/conda_lock/conda_lock.py index e7891d8e..631db834 100644 --- a/conda_lock/conda_lock.py +++ b/conda_lock/conda_lock.py @@ -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( @@ -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: diff --git a/conda_lock/lockfile/v2prelim/models.py b/conda_lock/lockfile/v2prelim/models.py index 1f8ea384..8fbce6f5 100644 --- a/conda_lock/lockfile/v2prelim/models.py +++ b/conda_lock/lockfile/v2prelim/models.py @@ -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 """ @@ -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 @@ -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