Changeset 458
- Timestamp:
- Mon May 5 12:39:20 2008
- Files:
-
- branches/crypt/hooks/hook-gadfly.py (added)
- branches/crypt/source/common/launch.c (modified) (diff)
- branches/crypt/doc/CHANGES.txt (modified) (diff)
- branches/crypt/archive.py (modified) (diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
branches/crypt/source/common/launch.c
r455 r458 173 173 174 174 175 int testTempPath(char *buff) 175 #ifdef WIN32 176 177 int getTempPath(char *buff) 176 178 { 177 char base[16]; 178 int n; 179 int i; 180 char *ret; 181 char prefix[16]; 182 183 GetTempPath(MAX_PATH, buff); 184 sprintf(prefix, "_MEI%d", getpid()); 185 186 // Windows does not have a race-free function to create a temporary 187 // directory. Thus, we rely on _tempnam, and simply try several times 188 // to avoid stupid race conditions. 189 for (i=0;i<5;i++) { 190 ret = _tempnam(buff, prefix); 191 if (mkdir(ret) == 0) { 192 strcpy(buff, ret); 193 strcat(buff, "\\"); 194 free(ret); 195 return 1; 196 } 197 free(ret); 198 } 199 return 0; 200 } 179 201 180 n = strlen(buff);181 if ( buff[n-1] == '/' || buff[n-1] == '\\' )182 sprintf(base, "_MEI%d", getpid());183 else184 sprintf(base, "%s_MEI%d", SEP, getpid());185 strcat(buff, base);186 #ifdef WIN32187 if (mkdir(buff) == 0) {188 202 #else 189 if (mkdir(buff, 0700) == 0) { 190 #endif 191 strcat(buff, SEP); 192 return 1; 193 } 194 return 0; 203 204 int testTempPath(char *buff) 205 { 206 strcat(buff, "/_MEIXXXXXX"); 207 if (mkdtemp(buff)) 208 { 209 strcat(buff, "/"); 210 return 1; 211 } 212 return 0; 195 213 } 196 214 197 voidgetTempPath(char *buff)215 int getTempPath(char *buff) 197 215 { 198 #ifdef WIN32199 GetTempPath(MAX_PATH, buff);200 testTempPath(buff);201 #else202 216 static const char *envname[] = { 203 217 "TMPDIR", "TEMP", "TMP", 0 … … 214 228 strcpy(buff, p); 215 229 if (testTempPath(buff)) 216 return; 230 return 1; 216 230 } 217 231 } … … 220 234 strcpy(buff, dirname[i]); 221 235 if (testTempPath(buff)) 222 return; 236 return 1; 222 236 } 223 buff[0] = '\0'; 224 #endif 237 return 0; 225 238 } 239 240 #endif 241 226 242 /* 227 243 * Set up paths required by rest of this module … … 831 847 strcpy(fnm, path); 832 848 strcat(fnm, name); 833 if (stat(fnm, &sbuf) == -1) { 834 VS("%s\n", fnm); 835 return fopen(fnm, "wb"); 836 } 837 return NULL; 849 if (stat(fnm, &sbuf) == 0) { 850 OTHERERROR("WARNING: file already exists but should not: %s\n", fnm); 851 } 852 return fopen(fnm, "wb"); 838 853 } 839 854 /* … … 851 866 852 867 if (!f_workpath) { 853 getTempPath(f_temppath); 868 if (!getTempPath(f_temppath)) 869 { 870 FATALERROR("INTERNAL ERROR: cannot create temporary directory!\n"); 871 return -1; 872 } 854 873 #ifdef WIN32 855 874 strcpy(f_temppathraw, f_temppath); … … 860 879 f_workpath = f_temppath; 861 880 } 881 862 882 out = openTarget(f_workpath, ptoc->name); 863 883 864 884 if (out == NULL) { 865 885 FATALERROR("%s could not be extracted!\n", ptoc->name); 886 return -1; 866 887 } 867 888 else { … … 1095 1116 if ( finfo.attrib & _A_SUBDIR ) 1096 1117 clear(fnm); 1097 else 1098 remove(fnm); 1118 else if (remove(fnm)) { 1119 /* HACK: Possible concurrency issue... spin a little while */ 1120 Sleep(100); 1121 remove(fnm); 1122 } 1099 1123 } 1100 1124 void clear(const char *dir) -
branches/crypt/doc/CHANGES.txt
r456 r458 10 10 2.5 version) 11 11 + Add import hooks per SQLAlchemy (thanks to Greg Copeland) 12 + Add import hook for gadfly. 12 13 + Improve import hooks for PyGTK (thanks to Marco Bonifazi and foxx). 13 14 + Add fix for the very annoying "MSVCRT71 could not be extracted" bug, … … 29 30 inside a package, the module is now removed from the parent's 30 31 namespace (to match the behaviour of Python itself). 32 + Fix random race-condition at startup of one-file packages, that was 33 causing this exception to be generated: "PYZ entry 'encodings' (0j) 34 is not a valid code object". 31 35 32 36 PyInstaller 1.3 -
branches/crypt/archive.py
r228 r458 276 276 class DummyZlib: 277 277 def decompress(self, data): 278 r eturn data278 raise RuntimeError, "zlib required but cannot be imported" 278 278 def compress(self, data, lvl): 279 r eturn data279 raise RuntimeError, "zlib required but cannot be imported" 279 279 280 280 import iu
