Skip to content

atom: adapt to portage Atom read-only property rework#63

Merged
gentoo-bot merged 2 commits into
gentoo:masterfrom
mattst88:portage-atom-readonly-properties
Jun 26, 2026
Merged

atom: adapt to portage Atom read-only property rework#63
gentoo-bot merged 2 commits into
gentoo:masterfrom
mattst88:portage-atom-readonly-properties

Conversation

@mattst88

Copy link
Copy Markdown
Contributor

portage reworked Atom to expose operator, blocker, use, slot, cp, cpv, and repo as read-only @property descriptors backed by private _* attributes, breaking Atom instantiation in gentoolkit.

  • Override operator as a read-only property normalizing None to "" to preserve the intersects() contract
  • Initialize CPV private attrs directly in Atom.init since portage already manages cpv
  • Remove no-op .operator writes from intersects() that now raise AttributeError against the read-only property

Compatible with old portage (pre-rework): old portage stores operator in self.dict directly, which the property getter checks first before falling back to super().

mattst88 added 2 commits June 25, 2026 14:13
portage reworked Atom to expose operator, blocker, use, slot, cp, cpv,
and repo as @Property descriptors backed by private _* attributes.

The pre-__init__ write "self.operator = self.blocker = self.use = self.slot = None"
and the post-__init__ "self.operator = ''" normalization both fail because
object.__setattr__() respects data descriptors and raises AttributeError
when a property has no setter.

Override operator as a read-only property normalizing None to "" to
preserve the intersects() contract. Initialize CPV's private attrs
directly since portage already manages cpv.

Signed-off-by: Matt Turner <mattst88@gentoo.org>
The tuple assignments

    ranged, ranged.operator = self, self.operator

evaluate the RHS before binding, so .operator is always written back
with its own value. With operator now a read-only property they raise
AttributeError.

Signed-off-by: Matt Turner <mattst88@gentoo.org>

@thesamesam thesamesam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fact it has some weird inspiration from pkgcore without just upstreaming it into Portage is weird (i.e. the thing that broke to begin with) but it is what it is.

It may be worth looking to see if we can include any of the niceties from this though.

Anyway, LGTM.

@Flowdalic Flowdalic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue with portage-9999 for me.

@gentoo-bot gentoo-bot merged commit 8e0b310 into gentoo:master Jun 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants