reverting partially distutils to its 2.6.x state so 2.7a4 looks more like the 2.7b1 in this. the whole revert will occur after a4 is tagged
diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py
index 244b1e7..440d128 100644
--- a/Lib/distutils/extension.py
+++ b/Lib/distutils/extension.py
@@ -5,8 +5,13 @@
 
 __revision__ = "$Id$"
 
-import os
-import warnings
+import os, string, sys
+from types import *
+
+try:
+    import warnings
+except ImportError:
+    warnings = None
 
 # This class is really only used by the "build_ext" command, so it might
 # make sense to put it in distutils.command.build_ext.  However, that
@@ -78,9 +83,6 @@
       language : string
         extension language (i.e. "c", "c++", "objc"). Will be detected
         from the source extensions if not provided.
-      optional : boolean
-        specifies that a build failure in the extension should not abort the
-        build process, but simply not install the failing extension.
     """
 
     # When adding arguments to this constructor, be sure to update
@@ -99,14 +101,12 @@
                   swig_opts = None,
                   depends=None,
                   language=None,
-                  optional=None,
                   **kw                      # To catch unknown keywords
                  ):
-        if not isinstance(name, str):
-            raise AssertionError("'name' must be a string")
-        if not (isinstance(sources, list) and
-                all(isinstance(v, str) for v in sources)):
-            raise AssertionError("'sources' must be a list of strings")
+        assert type(name) is StringType, "'name' must be a string"
+        assert (type(sources) is ListType and
+                map(type, sources) == [StringType]*len(sources)), \
+                "'sources' must be a list of strings"
 
         self.name = name
         self.sources = sources
@@ -123,28 +123,27 @@
         self.swig_opts = swig_opts or []
         self.depends = depends or []
         self.language = language
-        self.optional = optional
 
         # If there are unknown keyword options, warn about them
-        if len(kw) > 0:
-            options = [repr(option) for option in kw]
-            options = ', '.join(sorted(options))
-            msg = "Unknown Extension options: %s" % options
-            warnings.warn(msg)
+        if len(kw):
+            L = kw.keys() ; L.sort()
+            L = map(repr, L)
+            msg = "Unknown Extension options: " + string.join(L, ', ')
+            if warnings is not None:
+                warnings.warn(msg)
+            else:
+                sys.stderr.write(msg + '\n')
+# class Extension
 
-def read_setup_file(filename):
-    """Reads a Setup file and returns Extension instances."""
-    warnings.warn('distutils.extensions.read_setup_file is deprecated. '
-                  'It will be removed in the next Python release.')
-    _sysconfig = __import__('sysconfig')
-    from distutils.sysconfig import (expand_makefile_vars,
-                                     _variable_rx)
 
+def read_setup_file (filename):
+    from distutils.sysconfig import \
+         parse_makefile, expand_makefile_vars, _variable_rx
     from distutils.text_file import TextFile
     from distutils.util import split_quoted
 
     # First pass over the file to gather "VAR = VALUE" assignments.
-    vars = _sysconfig._parse_makefile(filename)
+    vars = parse_makefile(filename)
 
     # Second pass to gobble up the real content: lines of the form
     #   <module> ... [<sourcefile> ...] [<cpparg> ...] [<library> ...]
@@ -164,11 +163,10 @@
             file.warn("'%s' lines not handled yet" % line)
             continue
 
-        with warnings.catch_warnings():
-            warnings.simplefilter("ignore")
-            line = expand_makefile_vars(line, vars)
-
+        #print "original line: " + line
+        line = expand_makefile_vars(line, vars)
         words = split_quoted(line)
+        #print "expanded line: " + line
 
         # NB. this parses a slightly different syntax than the old
         # makesetup script: here, there must be exactly one extension per
@@ -197,7 +195,7 @@
             elif switch == "-I":
                 ext.include_dirs.append(value)
             elif switch == "-D":
-                equals = value.find("=")
+                equals = string.find(value, "=")
                 if equals == -1:        # bare "-DFOO" -- no value
                     ext.define_macros.append((value, None))
                 else:                   # "-DFOO=blah"
@@ -234,4 +232,15 @@
 
         extensions.append(ext)
 
+        #print "module:", module
+        #print "source files:", source_files
+        #print "cpp args:", cpp_args
+        #print "lib args:", library_args
+
+        #extensions[module] = { 'sources': source_files,
+        #                       'cpp_args': cpp_args,
+        #                       'lib_args': library_args }
+
     return extensions
+
+# read_setup_file ()