I just learned that you could specify packages by installed files, or just a directory, here is a message giving me this tip:

* Messages for package dev-lang/ocaml-3.12.1:

* OCaml is not binary compatible from version to version, so you
* need to rebuild all packages depending on it, that are actually
* installed on your system. To do so, you can run:
* emerge @ocaml-rebuild
* Or, (almost) equivalently: emerge -1 /usr/lib64/ocaml

I needed OCaml for trying out a program. Checking the list of sets, I could see this new set @ocaml-rebuild, which wasn’t here before:

$ emerge --list-sets
downgrade
installed
live-rebuild
module-rebuild
ocaml-rebuild
preserved-rebuild
rebuilt-binaries
security
selected
system
unavailable
unavailable-binaries
world
x11-module-rebuild

A quick test, they are exactly the same I just installed:

$ emerge -p /usr/lib64/ocaml

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/ocaml-3.12.1
[ebuild   R    ] dev-ml/findlib-1.4
[ebuild   R    ] dev-ml/ocamlgsl-0.6.0:0/0.6.0

Although it isn’t the same case for Python, that’s Python might not break from version to version, but I wanted to see if it does list the package:

$ emerge -p /usr/lib64/python2.7

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-python/pyyaml-3.10
[snip lots of packages...]
[ebuild   R    ] dev-python/pygame-1.9.2_pre20120101-r2

For Python, python-updater should be the command to use and I rarely needed to use it, probably only a couple of times.