diff -r 66e30c4870bb Lib/site.py --- a/Lib/site.py Thu Mar 21 15:02:16 2013 -0700 +++ b/Lib/site.py Thu Mar 21 16:14:48 2013 -0700 @@ -120,7 +120,13 @@ """Append ./build/lib. in case we're running in the build dir (especially for Guido :-)""" from sysconfig import get_platform - s = "build/lib.%s-%.3s" % (get_platform(), sys.version) + try: + s = "build/lib.%s-%.3s" % (get_platform(), sys.version) + except ImportError: + # see #17512, seen when trying to generate the _sysconfigdata.py + # on MacOS. We don't need the builddir when generating this file + # during the core build + s = "build/lib.%s-%.3s" % (sys.platform, sys.version) if hasattr(sys, 'gettotalrefcount'): s += '-pydebug' s = os.path.join(os.path.dirname(sys.path.pop()), s)