Similar to an earlier patch for hg help. Here we also needed a way
of listing resources/files in a package/directory, so I added that to
the resourceutil module.
Tested by running $PYTHON ./hg config --debug for each $PYTHON in
{python2, python3.6, python3.7}.