Fix missing imports in setup scripts generated by packaging (#13205).

I’ve made more edits than the bug report suggested to make sure the
generated setup script is compatible with many Python versions; a
comment in the source explains that in detail.

The cfg_to_args function uses old 2.x idioms like codecs.open and
RawConfigParser.readfp because I want the setup.py generated by packaging and
distutils2 to be the same.  Most users won’t see the deprecation warning and I
ignore it in the test suite.

Thanks to David Barnett for the report and original patch.
diff --git a/Misc/ACKS b/Misc/ACKS
index 6d3a6d9..08531b9 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -56,6 +56,7 @@
 Chris Barker
 Nick Barnes
 Quentin Barnes
+David Barnett
 Richard Barran
 Cesar Eduardo Barros
 Des Barry