Make sure distro variable is set if python-apt is installed

Fixes #7295