Changeset 486

Show
Ignore:
Timestamp:
Wed Jul 23 15:03:40 2008
Author:
htgoebel
Message:

Moved extraction of zipfile (see r475) from launch.c into the new
support/_pyi_egg_extract.py/ module.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/source/common/launch.c

    r475 r486  
    695 695 }  
    696 696  
    697   /* Add a zipfile to sys.path from a toc entry  
    698    * Return non zero on failure  
    699    */  
    700   int installZipfile(TOC *ptoc)  
    701   {  
    702           int rc;  
    703           char *tmpl = "sys.path.append(r\"%s" SEP "%s\")\n";  
    704           char *cmd = (char *) malloc(strlen(tmpl) + strlen(f_workpath)  
    705                                       + strlen(ptoc->name)+ 10);  
    706           sprintf(cmd, tmpl, f_workpath, ptoc->name);  
    707           /*VS(cmd);*/  
    708           rc = PI_PyRun_SimpleString(cmd);  
    709           if (rc != 0)  
    710           {  
    711                   FATALERROR("Error in command: %s\n", cmd);  
    712                   free(cmd);  
    713                   return -1;  
    714           }  
    715    
    716           free(cmd);  
    717           return 0;  
    718   }  
    719 697  
    720 698 /*  
     
    727 705         VS("Installing import hooks\n");  
    728 706  
    729           /* Iterate through toc looking for zlibs (type 'z') or  
    730            *  zipfiles (type 'Z')  
    731            */  
      707         /* Iterate through toc looking for zlibs (type 'z') */  
    732 708         ptoc = f_tocbuff;  
    733 709         while (ptoc < f_tocend) {  
    734                   if (ptoc->typcd == 'z')  
      710                 if (ptoc->typcd == 'z')   
    734 710                 {  
    735 711                         VS("%s\n", ptoc->name);  
    736 712                         installZlib(ptoc);  
    737 713                 }  
    738                   else if (ptoc->typcd == 'Z')  
    739                   {  
    740                           VS("zipfile: %s\n", ptoc->name);  
    741                           installZipfile(ptoc);  
    742                   }  
    743 714  
    744 715                 ptoc = incrementTocPtr(ptoc);  
     
    885 856 }  
    886 857 /*  
    887    * extract all binaries (type 'b') and zipfiles (type 'Z')  
    888    * to the filesystem  
      858  * extract all binaries (type 'b') to the filesystem  
    889 859  */  
    890 860 int extractBinaries(char **workpath)  
     
    894 864         VS("Extracting binaries\n");  
    895 865         while (ptoc < f_tocend) {  
    896                   if (ptoc->typcd == 'b' || ptoc->typcd == 'Z')  
      866                 if (ptoc->typcd == 'b')  
    896 866                 if (extract2fs(ptoc))  
    897 867                 return -1;