Updated for 2.1b2 distribution.
[python/dscho.git] / RISCOS / Modules / getpath_riscos.c
blob7582b173067a42673953be1aa2ee0f9a33780821
1 #include "Python.h"
2 #include "osdefs.h"
4 static char *prefix,*exec_prefix,*progpath,*module_search_path=0;
6 static void
7 calculate_path()
8 { char *pypath=getenv("Python$Path");
9 if(pypath)
10 { module_search_path=malloc(strlen(pypath)+1);
11 if (module_search_path) sprintf(module_search_path,"%s",pypath);
12 else
13 { /* We can't exit, so print a warning and limp along */
14 fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n");
15 fprintf(stderr, "Using default static PYTHONPATH.\n");
18 if(!module_search_path) module_search_path = "<Python$Dir>.Lib";
19 prefix="";
20 exec_prefix=prefix;
21 progpath="<Python$Dir>";
24 /* External interface */
26 char *
27 Py_GetPath()
29 if (!module_search_path)
30 calculate_path();
31 return module_search_path;
34 char *
35 Py_GetPrefix()
37 if (!module_search_path)
38 calculate_path();
39 return prefix;
42 char *
43 Py_GetExecPrefix()
45 if (!module_search_path)
46 calculate_path();
47 return exec_prefix;
50 char *
51 Py_GetProgramFullPath()
53 if (!module_search_path)
54 calculate_path();
55 return progpath;