Prevent configuration file generation in build_py if build_ext will be run

This uses a class-level attribute, and looks at whether any extensions will be built to set that class-level attribute. This prevents the configuration file from being built twice (and avoids the error in Astropy).