diff Python/import.c @ 42622:4d2aa4bfb2d6

Remove RISCOS support
author Skip Montanaro <skip@pobox.com>
date Thu, 16 Aug 2007 14:35:24 +0000
parents 0fcc18aba385
children d7517c306791
line wrap: on
line diff
--- a/Python/import.c	Thu Aug 16 08:08:41 2007 +0000
+++ b/Python/import.c	Thu Aug 16 14:35:24 2007 +0000
@@ -94,13 +94,6 @@
 /* these tables define the module suffixes that Python recognizes */
 struct filedescr * _PyImport_Filetab = NULL;
 
-#ifdef RISCOS
-static const struct filedescr _PyImport_StandardFiletab[] = {
-	{"/py", "U", PY_SOURCE},
-	{"/pyc", "rb", PY_COMPILED},
-	{0, 0}
-};
-#else
 static const struct filedescr _PyImport_StandardFiletab[] = {
 	{".py", "U", PY_SOURCE},
 #ifdef MS_WINDOWS
@@ -109,7 +102,6 @@
 	{".pyc", "rb", PY_COMPILED},
 	{0, 0}
 };
-#endif
 
 static PyTypeObject NullImporterType;	/* Forward reference */
 
@@ -144,13 +136,8 @@
 	if (Py_OptimizeFlag) {
 		/* Replace ".pyc" with ".pyo" in _PyImport_Filetab */
 		for (; filetab->suffix != NULL; filetab++) {
-#ifndef RISCOS
 			if (strcmp(filetab->suffix, ".pyc") == 0)
 				filetab->suffix = ".pyo";
-#else
-			if (strcmp(filetab->suffix, "/pyc") == 0)
-				filetab->suffix = "/pyo";
-#endif
 		}
 	}
 
@@ -1131,9 +1118,7 @@
 	char *filemode;
 	FILE *fp = NULL;
 	PyObject *path_hooks, *path_importer_cache;
-#ifndef RISCOS
 	struct stat statbuf;
-#endif
 	static struct filedescr fd_frozen = {"", "", PY_FROZEN};
 	static struct filedescr fd_builtin = {"", "", C_BUILTIN};
 	static struct filedescr fd_package = {"", "", PKG_DIRECTORY};
@@ -1326,25 +1311,6 @@
 				}
 			}
 		}
-#else
-		/* XXX How are you going to test for directories? */
-#ifdef RISCOS
-		if (isdir(buf) &&
-		    case_ok(buf, len, namelen, name)) {
-			if (find_init_module(buf)) {
-				return &fd_package;
-			}
-			else {
-				char warnstr[MAXPATHLEN+80];
-				sprintf(warnstr, "Not importing directory "
-					"'%.*s': missing __init__.py", 
-					MAXPATHLEN, buf);
-				if (PyErr_WarnEx(PyExc_ImportWarning,
-						 warnstr, 1)) {
-					return NULL;
-				}
-		}
-#endif
 #endif
 #if defined(PYOS_OS2)
 		/* take a snapshot of the module spec for restoration
@@ -1480,9 +1446,6 @@
 #define INCL_DOSERRORS
 #define INCL_NOPMAPI
 #include <os2.h>
-
-#elif defined(RISCOS)
-#include "oslib/osfscontrol.h"
 #endif
 
 static int
@@ -1568,31 +1531,6 @@
 	}
 	return 0 ; /* Not found */
 
-/* RISC OS */
-#elif defined(RISCOS)
-	char canon[MAXPATHLEN+1]; /* buffer for the canonical form of the path */
-	char buf2[MAXPATHLEN+2];
-	char *nameWithExt = buf+len-namelen;
-	int canonlen;
-	os_error *e;
-
-	if (Py_GETENV("PYTHONCASEOK") != NULL)
-		return 1;
-
-	/* workaround:
-	   append wildcard, otherwise case of filename wouldn't be touched */
-	strcpy(buf2, buf);
-	strcat(buf2, "*");
-
-	e = xosfscontrol_canonicalise_path(buf2,canon,0,0,MAXPATHLEN+1,&canonlen);
-	canonlen = MAXPATHLEN+1-canonlen;
-	if (e || canonlen<=0 || canonlen>(MAXPATHLEN+1) )
-		return 0;
-	if (strcmp(nameWithExt, canon+canonlen-strlen(nameWithExt))==0)
-		return 1; /* match */
-
-	return 0;
-
 /* OS/2 */
 #elif defined(PYOS_OS2)
 	HDIR hdir = 1;
@@ -1668,38 +1606,6 @@
 	return 0;
 }
 
-#else
-
-#ifdef RISCOS
-static int
-find_init_module(buf)
-	char *buf;
-{
-	int save_len = strlen(buf);
-	int i = save_len;
-
-	if (save_len + 13 >= MAXPATHLEN)
-		return 0;
-	buf[i++] = SEP;
-	strcpy(buf+i, "__init__/py");
-	if (isfile(buf)) {
-		buf[save_len] = '\0';
-		return 1;
-	}
-
-	if (Py_OptimizeFlag)
-		strcpy(buf+i, "o");
-	else
-		strcpy(buf+i, "c");
-	if (isfile(buf)) {
-		buf[save_len] = '\0';
-		return 1;
-	}
-	buf[save_len] = '\0';
-	return 0;
-}
-#endif /*RISCOS*/
-
 #endif /* HAVE_STAT */
 
 
@@ -3007,7 +2913,6 @@
 		PyErr_SetString(PyExc_ImportError, "empty pathname");
 		return -1;
 	} else {
-#ifndef RISCOS
 		struct stat statbuf;
 		int rv;
 
@@ -3021,17 +2926,6 @@
 				return -1;
 			}
 		}
-#else
-		if (object_exists(path)) {
-			/* it exists */
-			if (isdir(path)) {
-				/* it's a directory */
-				PyErr_SetString(PyExc_ImportError,
-						"existing directory");
-				return -1;
-			}
-		}
-#endif
 	}
 	return 0;
 }