Properly exclude optional dependency when not only associated with top-level

This commit introduces the _REQUIRED_DEPENDS property. It means that
(1) the _DEPENDS property will always be associated with the list
of both optional and required dependencies and that
(2) the _REQUIRED_DEPENDS will only be associated with the list of
dependencies excluding the optional one.

Tests have been updated accordingly.