Mailing List Archive

CVS: python/dist/src/Mac/Python macmain.c,1.74,1.75
Update of /cvsroot/python/python/dist/src/Mac/Python
In directory usw-pr-cvs1:/tmp/cvs-serv26303

Modified Files:
macmain.c
Log Message:
Allow .pyc files as applets as well as .py files. .py files have
priority, for safety reasons.


Index: macmain.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Python/macmain.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** macmain.c 29 Mar 2002 14:27:06 -0000 1.74
--- macmain.c 29 Mar 2002 14:43:50 -0000 1.75
***************
*** 477,481 ****

static int
! locateResourcePy(char * resourceName, char * resourceURLCStr, int length) {
CFBundleRef mainBundle = NULL;
CFURLRef URL, absoluteURL;
--- 477,482 ----

static int
! locateResourcePy(CFStringRef resourceType, char *resourceName, char *resourceURLCStr, int length)
! {
CFBundleRef mainBundle = NULL;
CFURLRef URL, absoluteURL;
***************
*** 501,505 ****
/* Look for py files in the main bundle by type */
arrayRef = CFBundleCopyResourceURLsOfType( mainBundle,
! CFSTR("py"),
NULL );

--- 502,506 ----
/* Look for py files in the main bundle by type */
arrayRef = CFBundleCopyResourceURLsOfType( mainBundle,
! resourceType,
NULL );

***************
*** 542,546 ****
** is there
*/
! if (locateResourcePy("__rawmain__.py", scriptpath, 1024)) {
/* If we have a raw main we don't do AppleEvent processing.
** Notice that this also means we keep the -psn.... argv[1]
--- 543,547 ----
** is there
*/
! if (locateResourcePy(CFSTR("py"), "__rawmain__.py", scriptpath, 1024)) {
/* If we have a raw main we don't do AppleEvent processing.
** Notice that this also means we keep the -psn.... argv[1]
***************
*** 549,557 ****
*/
script = scriptpath;
} else {
/* Otherwise we look for __main__.py. Whether that is
** found or not we also process AppleEvent arguments.
*/
! if (locateResourcePy("__main__.py", scriptpath, 1024))
script = scriptpath;

--- 550,562 ----
*/
script = scriptpath;
+ } else if (locateResourcePy(CFSTR("pyc"), "__rawmain__.pyc", scriptpath, 1024)) {
+ script = scriptpath;
} else {
/* Otherwise we look for __main__.py. Whether that is
** found or not we also process AppleEvent arguments.
*/
! if (locateResourcePy(CFSTR("py"), "__main__.py", scriptpath, 1024))
! script = scriptpath;
! else if (locateResourcePy(CFSTR("pyc"), "__main__.pyc", scriptpath, 1024))
script = scriptpath;