[Python-checkins] python/dist/src/Modules main.c,1.67,1.68

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Fri, 02 Aug 2002 07:11:25 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv4439/Modules

Modified Files:
	main.c 
Log Message:
Added one call to Py_Main(), for OSX framework builds only, that will get the
actual script to run in case we are running from an applet. If we are indeed
running an applet we skip the normal option processing leaving it all to the
applet code.

This allows us to get use the normal python binary in the Python.app bundle,
giving us all the normal command line options through PythonLauncher while
still allowing Python.app to be used as the template for building applets.

Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used
on OSX anymore.


Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** main.c	2 Aug 2002 02:27:13 -0000	1.67
--- main.c	2 Aug 2002 14:11:23 -0000	1.68
***************
*** 136,139 ****
--- 136,155 ----
  	PySys_ResetWarnOptions();
  
+ #if defined(WITH_NEXT_FRAMEWORK)
+ 	/* If we are running from a framework it could be that we are actually
+ 	** the main program for an applet. If so, the next call will return the
+ 	** filename that we are supposed to run.
+ 	*/
+ 	filename = PyMac_GetAppletScriptFile();
+ 	if (filename != NULL) {
+ 		if ((fp = fopen(filename, "r")) == NULL) {
+ 			fprintf(stderr, "%s: can't open file '%s'\n",
+ 				argv[0], filename);
+ 			exit(2);
+ 		}
+ 	}
+ 	/* Skip option-processing if we are an applet */
+ 	if (filename == NULL)
+ #endif
  	while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) {
  		if (c == 'c') {
***************
*** 262,266 ****
  		unbuffered = 1;
  
! 	if (command == NULL && _PyOS_optind < argc &&
  	    strcmp(argv[_PyOS_optind], "-") != 0)
  	{
--- 278,282 ----
  		unbuffered = 1;
  
! 	if (command == NULL && filename == NULL && _PyOS_optind < argc &&
  	    strcmp(argv[_PyOS_optind], "-") != 0)
  	{