Getting rid of pre-Carbon (MacOS8) support. All code depending on
TARGET_API_MAC_OS8 (or !TARGET_API_MAC_CARBON) is gone. Also some
TARGET_API_MAC_OSX conditional code is gone, because it is no longer
used on OSX-only Python (only in MacPython-OS9).
diff --git a/Mac/Modules/macmodule.c b/Mac/Modules/macmodule.c
index 8b3bcc5..e6ac881 100644
--- a/Mac/Modules/macmodule.c
+++ b/Mac/Modules/macmodule.c
@@ -32,11 +32,6 @@
#include <string.h>
#include <errno.h>
-#if TARGET_API_MAC_OS8
-/* Skip for Carbon */
-#include "macstat.h"
-#endif
-
#ifdef USE_GUSI
/* Remove defines from macstat.h */
#undef S_IFMT
@@ -49,9 +44,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#else /* USE_GUSI */
-#if TARGET_API_MAC_OS8
-#define stat macstat
-#endif
#endif /* USE_GUSI */
#ifdef USE_GUSI2
@@ -239,24 +231,6 @@
}
#endif
-#if TARGET_API_MAC_OS8
-static PyObject *
-mac_getbootvol(self, args)
- PyObject *self;
- PyObject *args;
-{
- char *res;
- if (!PyArg_ParseTuple(args, ""))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- res = getbootvol();
- Py_END_ALLOW_THREADS
- if (res == NULL)
- return mac_error();
- return PyString_FromString(res);
-}
-#endif
-
static PyObject *
mac_getcwd(self, args)
PyObject *self;
@@ -471,38 +445,12 @@
static PyTypeObject StatResultType;
-#ifdef TARGET_API_MAC_OS8
-static PyStructSequence_Field xstat_result_fields[] = {
- COMMON_STAT_RESULT_FIELDS
- { "st_rsize" },
- { "st_creator" },
- { "st_type "},
- {0}
-};
-
-static PyStructSequence_Desc xstat_result_desc = {
- "mac.xstat_result",
- stat_result__doc__,
- xstat_result_fields,
- 13
-};
-
-static PyTypeObject XStatResultType;
-#endif
-
static PyObject *
_pystat_from_struct_stat(struct stat st, void* _mst)
{
PyObject *v;
-#if TARGET_API_MAC_OS8
- struct macstat *mst;
-
- if (_mst != NULL)
- v = PyStructSequence_New(&XStatResultType);
- else
-#endif
- v = PyStructSequence_New(&StatResultType);
+ v = PyStructSequence_New(&StatResultType);
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long)st.st_dev));
@@ -516,26 +464,12 @@
PyFloat_FromDouble((double)st.st_mtime));
PyStructSequence_SET_ITEM(v, 9,
PyFloat_FromDouble((double)st.st_ctime));
-#if TARGET_API_MAC_OS8
- if (_mst != NULL) {
- mst = (struct macstat *) _mst;
- PyStructSequence_SET_ITEM(v, 10,
- PyInt_FromLong((long)mst->st_rsize));
- PyStructSequence_SET_ITEM(v, 11,
- PyString_FromStringAndSize(mst->st_creator,
- 4));
- PyStructSequence_SET_ITEM(v, 12,
- PyString_FromStringAndSize(mst->st_type,
- 4));
+ if (PyErr_Occurred()) {
+ Py_DECREF(v);
+ return NULL;
}
-#endif
- if (PyErr_Occurred()) {
- Py_DECREF(v);
- return NULL;
- }
-
- return v;
+ return v;
}
@@ -579,38 +513,6 @@
}
#endif /* WEHAVE_FSTAT */
-#if TARGET_API_MAC_OS8
-static PyObject *
-mac_xstat(self, args)
- PyObject *self;
- PyObject *args;
-{
- struct macstat mst;
- struct stat st;
- char *path;
- int res;
- if (!PyArg_ParseTuple(args, "s", &path))
- return NULL;
- /*
- ** Convoluted: we want stat() and xstat() to agree, so we call both
- ** stat and macstat, and use the latter only for values not provided by
- ** the former.
- */
- Py_BEGIN_ALLOW_THREADS
- res = macstat(path, &mst);
- Py_END_ALLOW_THREADS
- if (res != 0)
- return mac_error();
- Py_BEGIN_ALLOW_THREADS
- res = stat(path, &st);
- Py_END_ALLOW_THREADS
- if (res != 0)
- return mac_error();
-
- return _pystat_from_struct_stat(st, (void*) &mst);
-}
-#endif
-
static PyObject *
mac_sync(self, args)
PyObject *self;
@@ -684,9 +586,6 @@
#ifdef WEHAVE_FSTAT
{"fstat", mac_fstat, 1},
#endif
-#if TARGET_API_MAC_OS8
- {"getbootvol", mac_getbootvol, 1}, /* non-standard */
-#endif
{"getcwd", mac_getcwd, 1},
{"listdir", mac_listdir, 1},
{"lseek", mac_lseek, 1},
@@ -696,9 +595,6 @@
{"rename", mac_rename, 1},
{"rmdir", mac_rmdir, 1},
{"stat", mac_stat, 1},
-#if TARGET_API_MAC_OS8
- {"xstat", mac_xstat, 1},
-#endif
{"sync", mac_sync, 1},
{"remove", mac_unlink, 1},
{"unlink", mac_unlink, 1},
@@ -823,8 +719,4 @@
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
-#if TARGET_API_MAC_OS8
- PyStructSequence_InitType(&XStatResultType, &xstat_result_desc);
- PyDict_SetItemString(d, "xstat_result", (PyObject*) &XStatResultType);
-#endif
}