summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-24 20:42:55 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-24 20:42:55 (GMT)
commite2ae77b8b8a62e648bb1864a9b36ef3280984404 (patch)
treee03ad6f126a16529b2fb43671903e357bcb05835 /Python
parentc6ac8a78f668123ec5c2c3d5a824e7886e9a1c60 (diff)
downloadcpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.zip
cpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.tar.gz
cpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.tar.bz2
SF patch #474590 -- RISC OS support
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c15
-rw-r--r--Python/import.c38
2 files changed, 46 insertions, 7 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 144a62f..ac2aa5a 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -13,6 +13,10 @@
#include <unistd.h>
#endif
+#ifdef RISCOS
+#include "unixstuff.h"
+#endif
+
/* The default encoding used by the platform file system APIs
Can remain NULL for all platforms that don't have such a concept
*/
@@ -536,7 +540,9 @@ builtin_execfile(PyObject *self, PyObject *args)
FILE* fp = NULL;
PyCompilerFlags cf;
int exists;
+#ifndef RISCOS
struct stat s;
+#endif
if (!PyArg_ParseTuple(args, "s|O!O!:execfile",
&filename,
@@ -558,12 +564,21 @@ builtin_execfile(PyObject *self, PyObject *args)
exists = 0;
/* Test for existence or directory. */
+#ifndef RISCOS
if (!stat(filename, &s)) {
if (S_ISDIR(s.st_mode))
errno = EISDIR;
else
exists = 1;
}
+#else
+ if (object_exists(filename)) {
+ if (isdir(filename))
+ errno = EISDIR;
+ else
+ exists = 1;
+ }
+#endif /* RISCOS */
if (exists) {
Py_BEGIN_ALLOW_THREADS
diff --git a/Python/import.c b/Python/import.c
index 626695c..f00a563 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -983,13 +983,10 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
#else
/* XXX How are you going to test for directories? */
#ifdef RISCOS
- {
- static struct filedescr fd = {"", "", PKG_DIRECTORY};
- if (isdir(buf)) {
- if (find_init_module(buf))
- return &fd;
- }
- }
+ if (isdir(buf) &&
+ find_init_module(buf) &&
+ case_ok(buf, len, namelen, name))
+ return &fd_package;
#endif
#endif
#ifdef macintosh
@@ -1069,6 +1066,8 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
#include <sys/types.h>
#include <dirent.h>
+#elif defined(RISCOS)
+#include "oslib/osfscontrol.h"
#endif
static int
@@ -1198,6 +1197,31 @@ case_ok(char *buf, int len, int namelen, char *name)
}
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;
+
/* assuming it's a case-sensitive filesystem, so there's nothing to do! */
#else
return 1;
_cleanup'>contrib_patrick_fradin_code_cleanup Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/generic
ModeNameSize
-rw-r--r--README264logstatsplain
-rw-r--r--regc_color.c17775logstatsplain
-rw-r--r--regc_cvec.c5706logstatsplain
-rw-r--r--regc_lex.c24495logstatsplain
-rw-r--r--regc_locale.c39062logstatsplain
-rw-r--r--regc_nfa.c36234logstatsplain
-rw-r--r--regcomp.c59666logstatsplain
-rw-r--r--regcustom.h4206logstatsplain
-rw-r--r--rege_dfa.c17820logstatsplain
-rw-r--r--regerror.c3515logstatsplain
-rw-r--r--regerrs.h1078logstatsplain
-rw-r--r--regex.h11196logstatsplain
-rw-r--r--regexec.c28360logstatsplain
-rw-r--r--regfree.c2086logstatsplain
-rw-r--r--regfronts.c2394logstatsplain
-rw-r--r--regguts.h12377logstatsplain
-rw-r--r--tcl.decls56570logstatsplain
-rw-r--r--tcl.h84837logstatsplain
-rw-r--r--tclAlloc.c17499logstatsplain
-rw-r--r--tclAsync.c9184logstatsplain
-rw-r--r--tclBasic.c153077logstatsplain
-rw-r--r--tclBinary.c46002logstatsplain
-rw-r--r--tclCkalloc.c33335logstatsplain
-rw-r--r--tclClock.c9794logstatsplain
-rw-r--r--tclCmdAH.c66246logstatsplain
-rw-r--r--tclCmdIL.c119803logstatsplain
-rw-r--r--tclCmdMZ.c82373logstatsplain
-rw-r--r--tclCompCmds.c115453logstatsplain
-rw-r--r--tclCompExpr.c27655logstatsplain
-rw-r--r--tclCompile.c112808logstatsplain
-rw-r--r--tclCompile.h42424logstatsplain
-rw-r--r--tclConfig.c9754logstatsplain
-rw-r--r--tclDate.c58480logstatsplain
-rw-r--r--tclDecls.h211797logstatsplain
-rw-r--r--tclDictObj.c71593logstatsplain
-rw-r--r--tclEncoding.c83930logstatsplain
-rw-r--r--tclEnv.c20563logstatsplain
-rw-r--r--tclEvent.c33061logstatsplain
-rw-r--r--tclExecute.c190598logstatsplain
-rw-r--r--tclFCmd.c28366logstatsplain
-rw-r--r--tclFileName.c71477logstatsplain
-rw-r--r--tclFileSystem.h3556logstatsplain
-rw-r--r--tclGet.c9373logstatsplain
-rw-r--r--tclGetDate.y35173logstatsplain
-rw-r--r--tclHash.c32886logstatsplain
-rw-r--r--tclHistory.c3876logstatsplain
-rw-r--r--tclIO.c269080logstatsplain
-rw-r--r--tclIO.h16519logstatsplain
-rw-r--r--tclIOCmd.c43694logstatsplain
-rw-r--r--tclIOGT.c40010logstatsplain
-rw-r--r--tclIOSock.c2833logstatsplain
-rw-r--r--tclIOUtil.c129981logstatsplain
-rw-r--r--tclIndexObj.c14685logstatsplain
-rw-r--r--tclInitScript.h3285logstatsplain
-rw-r--r--tclInt.decls28987logstatsplain
-rw-r--r--tclInt.h97038logstatsplain
-rw-r--r--tclIntDecls.h64087logstatsplain
-rw-r--r--tclIntPlatDecls.h28214logstatsplain
-rw-r--r--tclInterp.c71958logstatsplain
-rw-r--r--tclLink.c13417logstatsplain
-rw-r--r--tclListObj.c52858logstatsplain
-rw-r--r--tclLiteral.c31523logstatsplain
-rw-r--r--tclLoad.c20333logstatsplain
-rw-r--r--tclLoadNone.c3800logstatsplain
-rw-r--r--tclMain.c22161logstatsplain
-rw-r--r--tclMath.h755logstatsplain
-rw-r--r--tclNamesp.c178586logstatsplain