MAINT: split distributions.py into three files

This is a redo of https://github.com/scipy/scipy/pull/3128 with fewer commits.