Sphinx and Jinja with Documentation on Gentoo

I, for reasons you surely don't care about, have the doc flag in my defaults USE flags in Gentoo. That, in turns, helps me finding all kinds of bugs in ebuilds because these are usually not enough tested with doc flags. One of the oddest issues I've come across was emerging Sphinx and Jinja2 - and I just came across that issue again, so I thought posting something about it before I forget. The issue is that:

  • Sphinx requires Jinja for documentation
  • Jinja requires Sphinx

When using doc flag, that becomes a circular dependency, but that's not a reason to report a bug. Instead, you should first emerge jinja without the doc flag, then emerge sphinx, and then emerge jinja with your regular flags:

# USE="-doc" emerge jinja
# emerge dev-python/sphinx
# emerge dev-python/shpinx jinja