BUG: sphinxext: fix sphinx extensions broken recently

The recent Python 3 porting broke the sphinx extensions (missing imports, etc.).
This fixes them again.