System Dependencies
There are a number of pybuilds that rely on external dependencies. Examples of existing ones include the mods that use the clean_plugin and tr_patcher functions, as they rely on the existence of the tes3cmd and tr-patcher executables. Perhaps the better example is a repackaged version of UMOPP I'm working on which will require convert, an executable from ImageMagick which is far more complicated to install than a simple script such as tes3cmd and tr-patcher and there would be no way that we would include it in the tree.
Since portmod is not a software package manager, we can't install these automatically, and would not want to, however we can handle these more elegantly than simply raising exceptions when we fail to find the executables (noting that this also puts the requirement on the pybuild in question to fail gracefully).
My suggestion is that we should resolve these in the dependency resolution phase by creating a set of virtual categories. These would be virtual, in that they instruct Portmod how to behave and aren't actually in the tree.
For example, a dependency on sys-bin/tes3cmd will ensure that the tes3cmd executable can be found using shutil.which("tes3cmd"), failing in the dependency resolution phase if it cannot. Note that versions have no meaning here and should be ignored.
We could also do this to allow pybuilds to declare python dependencies (e.g. sys-python category), which could even include versions (though there are some differences in how the PMS defines version numbers and how python handles them).
For the existing clean_plugin and tr_patcher functions, these abstract away the executable performing the operations (more on the side of the former), so we should define a variable in their file along the lines of CLEAN_PLUGIN_DEPENDS and TR_PATCHER_DEPENDS, which can be imported and included in the DEPEND field of the mod using it.