On Fri, 2010-04-23 at 07:25 -0700, Tim Diggins wrote:
> Hi -
> 
> I'm trying to build a very simple (minimalistic) wx project using
> pyinstaller on mac.
> 
> I've tried --onefile, and also --onedir (but copying all the dist
> contents into the app's MacOS directory)
> 
> both times I get the an error in my logs as per
> http://groups.google.com/group/pyinstaller/browse_thread/thread/e3459bb873052912/0f6febe767f35450?#0f6febe767f35450
> 
> 23/04/2010 15:19:41 [0x0-0x63c63c].Small__App[18442] This program
> needs access to the screen.
> 23/04/2010 15:19:41 [0x0-0x63c63c].Small__App[18442] Please run with
> 'pythonw', not 'python', and only when you are logged
> 23/04/2010 15:19:41 [0x0-0x63c63c].Small__App[18442] in on the main
> display of your Mac.
> 
> I'm surprised I get this error when doing --onedir, given that I
> thought the issue was with the wx and backgrounding of the onefile.
> 
> I'm not very knowledgable about plists, but keen to help resolve
> this...
> 
> any suggestions?

Hi Tim,

I'm aware of this problem on the Mac. I'm tickling around with the
attached patch. Would you mind testing it?

Obviously, you will need to re-execute Make.py, and rebuild the
bootloader from scratch after having applied it.

-- 
Giovanni Bajo   ::  [email protected]
Develer S.r.l.  ::  http://www.develer.com

My Blog: http://giovanni.bajo.it
Last post: Grey on black: combining greylisting with blacklists

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyinstaller?hl=en.

Index: source/linux/Make.py
===================================================================
--- source/linux/Make.py	(revision 825)
+++ source/linux/Make.py	(working copy)
@@ -177,8 +177,10 @@
 
     somevars['CFLAGS'] = string.join(cflags) # override
     if sys.platform.startswith("darwin"):
+        somevars['CFLAGS'] += " -I/Developer/Headers/FlatCarbon"
         somevars['LDFLAGS'] += " -F$(PYTHONFRAMEWORKPREFIX)"
         somevars['LDFLAGS'] += " -mmacosx-version-min=%s" % somevars["MACOSX_DEPLOYMENT_TARGET"]
+        somevars['LDFLAGS'] += " -framework Carbon"
         somevars['LINKFORSHARED'] = "" #override
     files = ['$(OPT)', '$(LDFLAGS)', '$(LINKFORSHARED)', 'getpath.c'] + \
             files + \
Index: source/linux/main.c
===================================================================
--- source/linux/main.c	(revision 825)
+++ source/linux/main.c	(working copy)
@@ -29,6 +29,10 @@
 #include "getpath.h"
 #include <sys/wait.h>
 
+#ifdef __APPLE__
+#include "Processes.h"
+#endif
+
 #ifdef FREEZE_EXCEPTIONS
 extern unsigned char M_exceptions[];
 static struct _frozen _PyImport_FrozenModules[] = {
@@ -113,6 +117,14 @@
 
     if (workpath) {
         /* we're the "child" process */
+#ifdef __APPLE__
+        /* Switch the current process to be foreground (was background because
+           of the LSBackgroundOnly flag set by the Info.plist file created in
+           Build.py, which in turn is set to avoid a dock icon to appear for the
+           parent process whose purpose is unpacking the archive)*/
+        ProcessSerialNumber psn = { 0, kCurrentProcess };
+        OSStatus returnCode = TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+#endif
         VS("Already have a workpath - running!\n");
         rc = doIt(argc, argv);
     }
@@ -147,4 +159,3 @@
     }
     return rc;
 }
-

Reply via email to