[Python-checkins] python/dist/src/PC/os2emx getpathp.c,1.1,1.2
aimacintyre@users.sourceforge.net
aimacintyre@users.sourceforge.net
Thu, 02 Jan 2003 04:42:00 -0800
Update of /cvsroot/python/python/dist/src/PC/os2emx
In directory sc8-pr-cvs1:/tmp/cvs-serv32063
Modified Files:
getpathp.c
Log Message:
catch up with zipimport changes to std getpathp.c
Index: getpathp.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/PC/os2emx/getpathp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** getpathp.c 17 Feb 2002 05:23:30 -0000 1.1
--- getpathp.c 2 Jan 2003 12:41:58 -0000 1.2
***************
*** 251,254 ****
--- 251,256 ----
char *pythonhome = Py_GetPythonHome();
char *envpath = getenv("PYTHONPATH");
+ char zip_path[MAXPATHLEN+1];
+ size_t len;
get_progpath();
***************
*** 268,277 ****
envpath = NULL;
/* We need to construct a path from the following parts.
(1) the PYTHONPATH environment variable, if set;
! (2) the PYTHONPATH config macro, with the leading "."
of each component replaced with pythonhome, if set;
! (3) the directory containing the executable (argv0_path).
! The length calculation calculates #2 first.
*/
--- 270,293 ----
envpath = NULL;
+ /* Calculate zip archive path */
+ strncpy(zip_path, progpath, MAXPATHLEN);
+ zip_path[MAXPATHLEN] = '\0';
+ len = strlen(zip_path);
+ if (len > 4) {
+ zip_path[len-3] = 'z'; /* change ending to "zip" */
+ zip_path[len-2] = 'i';
+ zip_path[len-1] = 'p';
+ }
+ else {
+ zip_path[0] = 0;
+ }
+
/* We need to construct a path from the following parts.
(1) the PYTHONPATH environment variable, if set;
! (2) the zip archive file path;
! (3) the PYTHONPATH config macro, with the leading "."
of each component replaced with pythonhome, if set;
! (4) the directory containing the executable (argv0_path).
! The length calculation calculates #3 first.
*/
***************
*** 290,293 ****
--- 306,310 ----
bufsz += strlen(PYTHONPATH) + 1;
bufsz += strlen(argv0_path) + 1;
+ bufsz += strlen(zip_path) + 1;
if (envpath != NULL)
bufsz += strlen(envpath) + 1;
***************
*** 310,313 ****
--- 327,335 ----
if (envpath) {
strcpy(buf, envpath);
+ buf = strchr(buf, '\0');
+ *buf++ = DELIM;
+ }
+ if (zip_path[0]) {
+ strcpy(buf, zip_path);
buf = strchr(buf, '\0');
*buf++ = DELIM;