Made the core toolbox modules carbon-compatible using the new greylist feature of bgen: non-carbon methods are still included in non-carbon MacPython. The issue of backward compatibility of Python code is still open.
Macmodule and macosmodule have also been carbonified. Some functionality is still missing there.
diff --git a/Mac/Modules/macmodule.c b/Mac/Modules/macmodule.c
index c2224f0..74c1243 100644
--- a/Mac/Modules/macmodule.c
+++ b/Mac/Modules/macmodule.c
@@ -42,7 +42,11 @@
 #undef S_ISREG
 #endif /* THINK_C */
 
+#ifndef TARGET_API_MAC_CARBON_NOTYET
+/* XXXX Skip for Carbon, for now */
 #include "macstat.h"
+#endif
+
 #ifdef USE_GUSI
 /* Remove defines from macstat.h */
 #undef S_IFMT
@@ -58,7 +62,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #else /* USE_GUSI */
+#ifndef TARGET_API_MAC_CARBON_NOTYET
 #define stat macstat
+#endif
 #endif /* USE_GUSI */
 
 #ifdef USE_GUSI2
@@ -70,6 +76,10 @@
 #else
 #define mode_t int
 #include <fcntl.h>
+#ifdef _POSIX
+#include <unistd.h>
+#include <stat.h>
+#endif
 #endif
 
 /* Optional routines, for some compiler/runtime combinations */
@@ -264,6 +274,7 @@
 }
 #endif
 
+#ifndef TARGET_API_MAC_CARBON
 static PyObject *
 mac_getbootvol(self, args)
 	PyObject *self;
@@ -279,6 +290,7 @@
 		return mac_error();
 	return PyString_FromString(res);
 }
+#endif
 
 static PyObject *
 mac_getcwd(self, args)
@@ -502,6 +514,7 @@
 }
 #endif /* WEHAVE_FSTAT */
 
+#ifndef TARGET_API_MAC_CARBON_NOTYET
 static PyObject *
 mac_xstat(self, args)
 	PyObject *self;
@@ -543,6 +556,7 @@
 		    mst.st_creator, 4,
 		    mst.st_type, 4);
 }
+#endif
 
 static PyObject *
 mac_sync(self, args)
@@ -610,7 +624,9 @@
 #ifdef WEHAVE_FSTAT
 	{"fstat",	mac_fstat},
 #endif
+#ifndef TARGET_API_MAC_CARBON
 	{"getbootvol",	mac_getbootvol}, /* non-standard */
+#endif
 	{"getcwd",	mac_getcwd},
 	{"listdir",	mac_listdir, 0},
 	{"lseek",	mac_lseek},
@@ -620,7 +636,9 @@
 	{"rename",	mac_rename},
 	{"rmdir",	mac_rmdir},
 	{"stat",	mac_stat},
+#ifndef TARGET_API_MAC_CARBON_NOTYET
 	{"xstat",	mac_xstat},
+#endif
 	{"sync",	mac_sync},
 	{"remove",	mac_unlink},
 	{"unlink",	mac_unlink},