Changeset 288
- Timestamp:
- Tue Sep 5 07:44:44 2006
- Files:
-
- trunk/Build.py (modified) (diff)
- trunk/source/common/launch.h (modified) (diff)
- trunk/source/common/launch.c (modified) (diff)
- trunk/carchive.py (modified) (diff)
- trunk/support/loader/inprocsrvr_6rw.dll (modified)
- trunk/support/loader/run_6dc.exe (modified)
- trunk/support/loader/inprocsrvr_7rw.dll (modified)
- trunk/support/loader/run_7dc.exe (modified)
- trunk/support/loader/run_6rw.exe (modified)
- trunk/support/loader/run_7rw.exe (modified)
- trunk/support/loader/inprocsrvr_6rc.dll (modified)
- trunk/support/loader/inprocsrvr_7rc.dll (modified)
- trunk/support/loader/run_6rc.exe (modified)
- trunk/support/loader/run_7rc.exe (modified)
- trunk/support/loader/inprocsrvr_6dw.dll (modified)
- trunk/support/loader/inprocsrvr_7dw.dll (modified)
- trunk/support/loader/run_6dw.exe (modified)
- trunk/support/loader/run_7dw.exe (modified)
- trunk/support/loader/inprocsrvr_6dc.dll (modified)
- trunk/support/loader/inprocsrvr_7dc.dll (modified)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
trunk/Build.py
r276 r288 326 326 return cachedfile 327 327 328 UNCOMPRESSED, COMPRESSED , SOURCEFORM = range(3)328 UNCOMPRESSED, COMPRESSED = range(2) 328 328 class PKG(Target): 329 329 typ = 'PKG' … … 354 354 'BINARY':COMPRESSED, 355 355 'EXECUTABLE':COMPRESSED, 356 'PYSOURCE':SOURCEFORM } 356 'PYSOURCE':COMPRESSED, 357 'PYMODULE':COMPRESSED } 357 358 else: 358 self.cdict = { 'PYSOURCE': SOURCEFORM}359 self.cdict = { 'PYSOURCE':UNCOMPRESSED } 358 359 self.__postinit__() 359 360 def check_guts(self, last_build): -
trunk/source/common/launch.h
r164 r288 138 138 EXTDECLPROC(PyObject *, Py_BuildValue, (char *, ...)); 139 139 EXTDECLPROC(PyObject *, PyFile_FromString, (char *, char *)); 140 EXTDECLPROC(PyObject *, PyString_FromStringAndSize, (const char *, int)); 140 141 EXTDECLPROC(PyObject *, PyObject_CallFunction, (PyObject *, char *, ...)); 141 142 EXTDECLPROC(PyObject *, PyModule_GetDict, (PyObject *)); -
trunk/source/common/launch.c
r287 r288 65 65 DECLPROC(Py_BuildValue); 66 66 DECLPROC(PyFile_FromString); 67 DECLPROC(PyString_FromStringAndSize); 67 68 DECLPROC(PyObject_CallFunction); 68 69 DECLPROC(PyModule_GetDict); … … 113 114 static COOKIE f_cookie; 114 115 116 unsigned char *extract(TOC *ptoc); 117 115 118 /* 116 119 * The functions in this file defined in reverse order so that forward … … 275 278 GETPROC(dll, Py_BuildValue); 276 279 GETPROC(dll, PyFile_FromString); 280 GETPROC(dll, PyString_FromStringAndSize); 277 281 GETPROC(dll, PyObject_CallFunction); 278 282 GETPROC(dll, PyModule_GetDict); … … 582 586 marshal = PyImport_ImportModule("marshal"); 583 587 marshaldict = PyModule_GetDict(marshal); 584 loadfunc = PyDict_GetItemString(marshaldict, "load"); 585 586 /* Reopen the archive as a Python file. We cannot use PyFile_FromFile 587 * because that would require this boot-loader and Python DLL to share 588 * the same libc, while they purposely don't. 589 */ 590 fclose(f_fp); 591 pyfile = PyFile_FromString(f_archivename, "rb"); 592 if (PyErr_Occurred()) 593 { 594 PyErr_Print(); 595 return -1; 596 } 588 loadfunc = PyDict_GetItemString(marshaldict, "loads"); 597 589 598 590 /* Iterate through toc looking for module entries (type 'm') … … 603 595 if (ptoc->typcd == 'm' || ptoc->typcd == 'M') 604 596 { 597 unsigned char *modbuf = extract(ptoc); 598 599 /* .pyc/.pyo files have 8 bytes header. Skip it and get a Python 600 * string directly pointing at the marshalled code. 601 */ 602 PyObject *mods = PyString_FromStringAndSize(modbuf + 8, 603 ntohl(ptoc->ulen) - 8); 604 605 605 VS(ptoc->name); 606 606 VS("\n"); 607 607 608 /* Go to start of Python module (start + 8) and load the code object */ 609 res = PyObject_CallMethod(pyfile, "seek", "(ii)", f_pkgstart + ntohl(ptoc->pos) + 8, 0); 610 Py_XDECREF(res); 611 612 co = PyObject_CallFunction(loadfunc, "O", pyfile); 608 co = PyObject_CallFunction(loadfunc, "O", mods); 613 609 mod = PyImport_ExecCodeModule(ptoc->name, co); 614 610 … … 623 619 PyErr_Clear(); 624 620 } 621 622 Py_DECREF(mods); 623 free(modbuf); 625 624 } 626 625 ptoc = incrementTocPtr(ptoc); 627 626 } 628 627 629 /* Close the file and release the object. */630 res = PyObject_CallMethod(pyfile, "close", "()");631 Py_XDECREF(res);632 Py_DECREF(pyfile);633 634 /* After closing the python file, we can reopen it as normal file. */635 f_fp = fopen(f_archivename, "rb");636 if (f_fp == NULL) {637 VS("Cannot reopen archive: ");638 VS(f_archivename);639 VS("\n");640 }641 628 return 0; 642 629 } -
trunk/carchive.py
r43 r288 205 205 entry[1] is fullpathname of the file. 206 206 entry[2] is a flag for it's storage format (0==uncompressed, 207 1==compressed , 2==Python source format)207 1==compressed) 207 207 entry[3] is the entry's type code. 208 208 Version 5: … … 220 220 s = '' 221 221 flag = 0 222 elif flag == 2: 222 elif typcd == 's': 223 # If it's a source code file, add \0 terminator as it will be 224 # executed as-is by the bootloader. 223 225 s = open(pathnm, 'r').read() 224 226 s = s + '\n\0'
