First of all a big "thank you" to the maintainers - py2exe is extremely useful, and your efforts are much appreciated here :)
 
 
I'd like to be able to rename executables built with py2exe 0.6.6, so I have downloaded  py2exe-0.6.6-libname-fix.patch from http://www.py2exe.org/index.cgi/ProblemsToBeFixed
 
\source\start.c is giving me grief when trying to patch the sources, though; patching the released 0.6.6. as well as the CVS doesn't work for me.
 
I'm terribly inexperienced with patching with .diff files, so I hope someone can bring some clarity to these matters.
 
Hints, suggestions are most welcome - thanks in advance
 
 
 
Here's what I have tried so far, first the released version, then the CVS version.
 
 
Trying to patch the CVS version (directory renamed to py2exe-0.6.6), I get:
 
C:\>patch -p0 <py2exe-0.6.6-libname-fix.patch
patching file py2exe-0.6.6/py2exe/build_exe.py
Hunk #1 succeeded at 778 (offset 5 lines).
patching file py2exe-0.6.6/source/start.c
Hunk #1 succeeded at 136 (offset 10 lines).
Hunk #2 FAILED at 273.
1 out of 2 hunks FAILED -- saving rejects to file py2exe-0.6.6/source/start.c.rej
 
 
Contents of the file start.c.rej:
----------------start file --------------
***************
*** 269,290 ****
   */
   char *fname;
   size_t lib_dir_len;
-  pZipBaseName = pScript - 1;
   /* let pZipBaseName point to the basename of the zippath */
-  while (pZipBaseName > p_script_info->zippath && \
          *(pZipBaseName-1) != '\\')
    pZipBaseName--;
 
 
-  /* dirname is the directory of the executable */
-  strcpy(libdirname, dirname);
   /* length of lib director name */
-  lib_dir_len = pZipBaseName-p_script_info->zippath; /* incl. tail slash */
   if (lib_dir_len) {
-   char *p = libdirname+strlen(libdirname);
-   *p++ = '\\';
-   strncpy(p, p_script_info->zippath, lib_dir_len-1);
    p += lib_dir_len-1;
    *p++ = '\0';
   }
   /* Fully-qualify it */
--- 273,293 ----
   */
   char *fname;
   size_t lib_dir_len;
+  pZipBaseName = libfilename + strlen(libfilename);
   /* let pZipBaseName point to the basename of the zippath */
+  while (pZipBaseName > libfilename && \
          *(pZipBaseName-1) != '\\')
    pZipBaseName--;
 
 
   /* length of lib director name */
+  lib_dir_len = pZipBaseName-libfilename; /* incl. tail slash */
   if (lib_dir_len) {
+   char *p = libdirname;
+   strncpy(p, libfilename, lib_dir_len-1);
    p += lib_dir_len-1;
    *p++ = '\0';
+  } else {
+   libdirname[0] = '\0';
   }
   /* Fully-qualify it */
--------- file ends -----------------
 
 
 
 
Trying to patch the released version's source code, I get:
 
C:\>patch -p0 <py2exe-0.6.6-libname-fix.patch
patching file py2exe-0.6.6/py2exe/build_exe.py
patching file py2exe-0.6.6/source/start.c
Hunk #2 FAILED at 263.
1 out of 2 hunks FAILED -- saving rejects to file py2exe-0.6.6/source/start.c.rej
 
Contents of the file start.c.rej:
----------------start file --------------
***************
*** 259,280 ****
   */
   char *fname;
   size_t lib_dir_len;
-  pZipBaseName = pScript - 1;
   /* let pZipBaseName point to the basename of the zippath */
-  while (pZipBaseName > p_script_info->zippath && \
          *(pZipBaseName-1) != '\\')
    pZipBaseName--;
 
 
-  /* dirname is the directory of the executable */
-  strcpy(libdirname, dirname);
   /* length of lib director name */
-  lib_dir_len = pZipBaseName-p_script_info->zippath; /* incl. tail slash */
   if (lib_dir_len) {
-   char *p = libdirname+strlen(libdirname);
-   *p++ = '\\';
-   strncpy(p, p_script_info->zippath, lib_dir_len-1);
    p += lib_dir_len-1;
    *p++ = '\0';
   }
   /* Fully-qualify it */
--- 263,283 ----
   */
   char *fname;
   size_t lib_dir_len;
+  pZipBaseName = libfilename + strlen(libfilename);
   /* let pZipBaseName point to the basename of the zippath */
+  while (pZipBaseName > libfilename && \
          *(pZipBaseName-1) != '\\')
    pZipBaseName--;
 
 
   /* length of lib director name */
+  lib_dir_len = pZipBaseName-libfilename; /* incl. tail slash */
   if (lib_dir_len) {
+   char *p = libdirname;
+   strncpy(p, libfilename, lib_dir_len-1);
    p += lib_dir_len-1;
    *p++ = '\0';
+  } else {
+   libdirname[0] = '\0';
   }
   /* Fully-qualify it */
---------file ends --------------