[Pythonmac-SIG] interrogating I/O Registry

2009-06-21 Thread Brendan Simon (eTRIX)
I have a USB device that registers itself as a serial device
(/dev/usbmodem).

I have used pyusb to detect the device, and now I need to know what
serial device has been "created" so I can talk to it using pyserial.

I don't know what the best way is to find that association, but I came
across the I/O registry via a google search, and I think that will give
me enough info to obtain that association.

Is there a python way of reading the OS X I/O Registry ???

All I've come up with so far is to run the "ioreg" command via the
subprocess module and parse the output.

Is there a better python module to interrogate the I/O registry ??

or is there a better way to find the association between the USB serial
device and the serial device filename that is generated ??

Thanks very much for any help or pointers,
Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] py2app not copying PySerial module

2009-06-23 Thread Brendan Simon (eTRIX)
I'm running py2app for the first time -- following the instructions on
the web.

I've created an app bundle but running the app fails as it can't find a
module named "serial".

The "serial" module is part of PySerial-2.4.  I couldn't find serial.py
on my system but notice that there is a pyserial-2.4-py2.5.egg in the
site-packages directory.  The `file` command tells me it's a zip file
and `unzip -l` shows the serial/*.py files.

Is there a way to include the serial module in the app bundle ??

I've played with --includes and --packages py2app options without any
success.

Is there a way to include eggs with py2app ??  I'm thinking not based on
the web page information.

There must be a way to resolve this, either through py2app or some
manual tweaking.

Thanks for any help,
Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] py2app failed to pack codes with wxPython

2009-07-03 Thread Brendan Simon (eTRIX)
pythonmac-sig-requ...@python.org wrote:
> Subject:
> [Pythonmac-SIG] py2app failed to pack codes with wxPython
> From:
> "Lance Chou" 
> Date:
> Thu, 2 Jul 2009 23:45:04 -0700
>
>
> Hi All,
>
>  
>
>   Recently, I have been trying to pack my application on Mac OS X. The
> application is written in Python and wxPython for its UI.
>
> I pack it by following the tutorial shown on the py2app website. The
> packing is successful but encountes exception while running it.
>
> According to the exception messages, it shows the application cannot
> find the library “wx.lib.platebtn”. It reminds me of when I ran my
> application on Mac OS X with python interpretor, the python
> interpretor also complaint about missing library “wx.lib.platebtn”.
> After I re-installed wxPython, it can be run successfully.
>
>   When I pack my application on Mac OS X, the problem comes again. I’m
> wondering if there’s any solution that I could tell py2app to include
> the library in when packing it.
>
>  
>
>   Any comments or helps are appreciative.
>

It's not installed as an egg is it ???  Py2App doesn't deal with eggs yet.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] open program via a protocol (eg. myapp:command)

2009-07-10 Thread Brendan Simon (eTRIX)
I have an OS X python program that is invoked via a uri on a webpage --
eg. "myapp:command"

The app is invoked fine (via the plist), but I can't seem to extract the
"command" from the system args.  sys.argv contains the name of the
application and some other values.
example:
   sys.argv[0] = 'myapp
   sys.argv[1] = '-psn_0_22123800'


How can I my program read the _uri_ that caused the program to be invoked.

Thanks, Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] open program via a protocol (eg. myapp:command)

2009-07-10 Thread Brendan Simon (eTRIX)
has wrote:
> Brendan Simon (eTRIX) wrote:
> 
>> I have an OS X python program that is invoked via a uri on a webpage --
>> eg. "myapp:command"
>>
>> The app is invoked fine (via the plist), but I can't seem to extract the
>> "command" from the system args.  sys.argv contains the name of the
>> application and some other values.
>> example:
>>   sys.argv[0] = 'myapp
>>   sys.argv[1] = '-psn_0_22123800'
>>
>>
>> How can I my program read the _uri_ that caused the program to be
>> invoked.
> 
> You need to install an Apple event handler that responds to the GetURL
> event. Various ways you can do that, depending on whether your Python
> application is Carbon or Cocoa based, has an event loop or runs in batch
> mode, uses argvemulation, etc. For more specific advice, provide more
> details.

I'm using wxPython.

I think setting argvemulation to True may be the key.  I commented it
out when adding the plist option as I didn't know the correct way to add
to the setup options.

DATA_FILES = []
OPTIONS = {'argv_emulation': True}

URLTYPES=[ { 'CFBundleURLName' : "MyApp", 'CFBundleURLSchemes' : [
"myapp" ] } ]

setup(
app=APP,
data_files=DATA_FILES,
#options={'py2app': OPTIONS},
options=dict(py2app=dict(
plist=dict(
CFBundleURLTypes=URLTYPES,
),
)),

setup_requires=['py2app'],
)

I will play around and see how I go.

Thanks, Brendan.
begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] open program via a protocol (eg. myapp:command)

2009-07-10 Thread Brendan Simon (eTRIX)
has wrote:
> On 10 Jul 2009, at 14:45, Brendan Simon (eTRIX) wrote:
> 
>> has wrote:
>>> Brendan Simon (eTRIX) wrote:
>>>
>>>> I have an OS X python program that is invoked via a uri on a webpage --
>>>> eg. "myapp:command"
>>>> [...]
>>> You need to install an Apple event handler that responds to the GetURL
>>> event. Various ways you can do that, depending on whether your Python
>>> application is Carbon or Cocoa based, has an event loop or runs in batch
>>> mode, uses argvemulation, etc. For more specific advice, provide more
>>> details.
>>
>> I'm using wxPython.
>>
>> I think setting argvemulation to True may be the key.
> 
> The argvemulation option uses Python 2.x's plat-mac/argvemulation.py
> module to handle incoming 'open document' Apple events, unpack their
> direct argument as a list of file paths, and add those paths to
> sys.argv. It doesn't recognise GetURL events, however.

I can confirm that the url does NOT get added to sys.argv when using
argv_emulation :(


> I've no idea if there's anything you need to watch for when Apple events
> in a wxPython-based application, so you might need to do a bit of
> research on that front. The basic code for handling a GetURL event
> should go something like this:
> 
> from Carbon import AE
> from Carbon.AppleEvents import *
> 
> 
> def geturl(requestevent, replyevent): # event handler
> desc = requestevent.AEGetParamDesc(keyDirectObject, typeUTF8Text)
> url = desc.data.decode('utf8')
> # do stuff with URL here...
> 
> AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL, geturl)
> 
> Studying the argvemulation.py module's implementation may also be
> informative.

I had a look at argv_emulation.py and it seems to have most of this
stuff already.  It handles OpenApplication and OpenDocuments Apple
Events.  Guess the 'proper' thing to do would be to extend
argv_emulation.py to handle the IsGetURL event as described above.

I will give it a go and post the results.

Cheers, Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] open program via a protocol (eg. myapp:command)

2009-07-10 Thread Brendan Simon (eTRIX)
Brendan Simon (eTRIX) wrote:
>> I've no idea if there's anything you need to watch for when Apple events
>> in a wxPython-based application, so you might need to do a bit of
>> research on that front. The basic code for handling a GetURL event
>> should go something like this:
>>
>> from Carbon import AE
>> from Carbon.AppleEvents import *
>>
>>
>> def geturl(requestevent, replyevent): # event handler
>> desc = requestevent.AEGetParamDesc(keyDirectObject, typeUTF8Text)
>> url = desc.data.decode('utf8')
>> # do stuff with URL here...
>>
>> AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL, __geturl)
>>
>> Studying the argvemulation.py module's implementation may also be
>> informative.
> 
> I had a look at argv_emulation.py and it seems to have most of this
> stuff already.  It handles OpenApplication and OpenDocuments Apple
> Events.  Guess the 'proper' thing to do would be to extend
> argv_emulation.py to handle the IsGetURL event as described above.
> 
> I will give it a go and post the results.

I registered the __geturl() event handler but it never gets called.

How can I determine if the events are being sent to MyApp ??
I tried:
  $ export AEDebugSends=1; export AEDebugReceives=1
  $ open myapp:xyz


Obviously some event is causing MyApp to open when I type "open
myapp:xyz", but does that actually mean MyApp will receive the event or
just some internal framework that causes the application to be launched ??

Thanks, Brendan.
begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] open program via a protocol (eg. myapp:command)

2009-07-10 Thread Brendan Simon (eTRIX)


Cody Precord wrote:
> Hello,
> 
> On Jul 10, 2009, at 10:35 PM, Brendan Simon (eTRIX) wrote:
> 
>> Brendan Simon (eTRIX) wrote:
>>>>
>>
>> I registered the __geturl() event handler but it never gets called.
>>
>> How can I determine if the events are being sent to MyApp ??
>> I tried:
>>  $ export AEDebugSends=1; export AEDebugReceives=1
>>  $ open myapp:xyz
>>
>>
>> Obviously some event is causing MyApp to open when I type "open
>> myapp:xyz", but does that actually mean MyApp will receive the event or
>> just some internal framework that causes the application to be
>> launched ??
> 
> Did you see my previous reply (I see it in the archives but not in your
> replies)? Here it is again.
> 
> The wx.App object has some builtin method for handling some common
> apple events. I would have to check the wxWidgets source to remember
> exactly which event it responds to but you might want to try and
> override the following method in your App object class.
> 
> def MacOpenFile(self, filename)
> 
> IIRC it will be called with the path of the file that is sent to the
> app for getURL events. If not you need a c extension to add an
> additional apple event handler to your wxApp object. This is actually
> quite easy to do (see examples in wxPython wiki), but I think that the
> above should do what your
> looking for.

Hi Cody,

Yes I did see your previous reply.  I implemented the MacOpenFile()
method as part of MyApp but it never got called.

It didn't work for me.

Google searches seemed to suggest that this only worked for applications
that were already running, rather than a file that causes an application
for be launched.

Also, it may not be called for URLs which is what I'm using.

You mention a C extension may be needed.  I will have a look on the
wxPython wiki ... as you suggest :)

Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] [SOLVED] open program via a protocol (eg. myapp:command)

2009-07-11 Thread Brendan Simon (eTRIX)
Brendan Simon (eTRIX) wrote:
> 
> Cody Precord wrote:
>> Hello,
>>
>> On Jul 10, 2009, at 10:35 PM, Brendan Simon (eTRIX) wrote:
>>
>>> Brendan Simon (eTRIX) wrote:
>>> I registered the __geturl() event handler but it never gets called.

I forget to add self to the 'method' that's why it failed.  It does in
fact get called when the method is defined properly :)


I modified argv_emulation.py from the py2app package.
Added an event handler for the GetURL to extract the url and append to
sys.argv.  The code was based on the existing handler for OpenDocuments
event and the snippet that 'has' posted (changed typeUTF8Text to
typeWildCard as typeUTF8Text didn't exist on my system).

Here is the diff.

k9m:bootstrap $ diff argv_emulation.py.orig argv_emulation.py
10c10,11
< kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias
---
> kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias, \
> kAEInternetSuite, kAEISGetURL, typeWildCard
25a27,29
> #AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL,
> AE.AEInstallEventHandler('GURL', 'GURL',
> self.__geturl)
29a34,35
> #AE.AERemoveEventHandler(kAEInternetSuite, kAEISGetURL)
> AE.AERemoveEventHandler('GURL', 'GURL')
93a100,111
> def __geturl(self, requestevent, replyevent): # event handler
> try:
> listdesc =
requestevent.AEGetParamDesc(keyDirectObject, typeAEList)
> for i in range(listdesc.AECountItems()):
> desc = listdesc.AEGetNthDesc(i+1, typeWildCard)[1]
> url = desc.data.decode('utf8')
> sys.argv.append(url)
> except Exception, e:
> print "argvemulator.py warning: can't unpack an GetURL
event"
>
> self._quit()
>

Should I submit this as a patch somewhere ???

Thanks, Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] py2app creating semi_standalone instead of standalone app

2009-08-04 Thread Brendan Simon (eTRIX)
I have a wxPython app which works on my Mac.  I created an app bundle
and this works on my Mac and my friends Mac :)

All good, except that if I give my friend the source code and get him to
create the app, the app is created as semi_standalone, and the app does
not work as some modules cant be found.  I am assuming the problems is
is related to the semi_standalone versus standalone, but not 100% sure.

Any idea why my friend's build is semi_standalone and mine is standalone
??  It's the same source.

Any ideas on how to make standalone explicit with py2app ??

I see the --semi-standalone option in py2applet, but I don't think my
friend should have to run pyapplet, right ???   Setup is already created.
Hmmm, maybe I have explicitly specify standalone in setup.py somewhere ???

Thanks, Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] py2app creating semi_standalone instead of standalone app

2009-08-04 Thread Brendan Simon (eTRIX)
Maybe it has something to do with this statement in the py2app website.

If the --semi-standalone option is used (forced if a vendor Python
is being used), then the not_stdlib_filter will be automatically
added to ensure that the Python standard library is not included.


My python is 2.5.4 from Python.org.  My freind's python is python 2.5.1
(standard on Leopard from Apple).
I presume my friends python is "a vendor Python" and thus
semi-standalone is being forced.

Still not sure what the correct fix is :(


Brendan Simon (eTRIX) wrote:
> I have a wxPython app which works on my Mac.  I created an app bundle
> and this works on my Mac and my friends Mac :)
>
> All good, except that if I give my friend the source code and get him to
> create the app, the app is created as semi_standalone, and the app does
> not work as some modules cant be found.  I am assuming the problems is
> is related to the semi_standalone versus standalone, but not 100% sure.
>
> Any idea why my friend's build is semi_standalone and mine is standalone
> ??  It's the same source.
>
> Any ideas on how to make standalone explicit with py2app ??
>
> I see the --semi-standalone option in py2applet, but I don't think my
> friend should have to run pyapplet, right ???   Setup is already created.
> Hmmm, maybe I have explicitly specify standalone in setup.py somewhere ???
>
> Thanks, Brendan.
>
>   

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] Pythonmac-SIG Digest, Vol 76, Issue 4

2009-08-05 Thread Brendan Simon (eTRIX)

> Subject:
> Re: [Pythonmac-SIG] py2app creating semi_standalone instead of
> standalone app
> From:
> Henning Hraban Ramm 
> Date:
> Wed, 5 Aug 2009 09:37:51 +0200
> To:
> pythonmac-sig@python.org
>
> To:
> pythonmac-sig@python.org
>
>
> Am 2009-08-05 um 04:35 schrieb Brendan Simon (eTRIX):
>
>> Maybe it has something to do with this statement in the py2app website.
>>
>>If the --semi-standalone option is used (forced if a vendor Python
>>is being used), then the not_stdlib_filter will be automatically
>>added to ensure that the Python standard library is not included.
>>
>>
>> My python is 2.5.4 from Python.org.  My freind's python is python 2.5.1
>> (standard on Leopard from Apple).
>> I presume my friends python is "a vendor Python" and thus
>> semi-standalone is being forced.
>
> exactly
>
>> Still not sure what the correct fix is :(
>
> If you want to create a standalone app, you must install a standard
> python (and the necessary modules), as you can't distribute Apple's.

Really ?!?   I think you may be serious !!!  If it's true it is close to
unbelievable.  Isn't python "free" as a general rule ???
This is a stinky thing that MS would do !!!

The "copyright" statement doesn't mention anything about Apple.  Nor if
i type "license()"

k9m:src brendan$ /usr/bin/python
Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> copyright
Copyright (c) 2001-2007 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.


Anyway, I guess if it is true, then the easy work around is to install
an updated python from python.org :)

Cheers, Brendan.

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] Including images (jpg) in app bundle

2009-08-08 Thread Brendan Simon (eTRIX)
I have a jpg image which is displayed in my wxPython app.  It is loaded
from an 'image' directory.
eg. image/mypic.jpg

This works fine when I type "python mywxapp" from the command line, but
when I build an app bundle it doesn't work.
I've tried two options (see below).  Both copy the jpg to the Resourses
directory, but I loose the images/ directory.

What's the best/appropriate way to get image files in the app ??  It has
to work with manual invocation too.
Put image files in the same directory as the source ???

Thanks, Brendan.

DATA_FILES = [ 'images/mypic.jpg' ]

OPTIONS = {
'argv_emulation' : True,
   }

setup(
app = APP,
data_files = DATA_FILES,
options = { 'py2app' : OPTIONS },
setup_requires=['py2app'],
)


and:

DATA_FILES = []

OPTIONS = {
'argv_emulation' : True,
'resources' : 'images/mypic.jpg',
   }

setup(
app = APP,
data_files = DATA_FILES,
options = { 'py2app' : OPTIONS },
setup_requires=['py2app'],
)


begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] argv_emulation for url open events

2009-08-13 Thread Brendan Simon (eTRIX)
argv emulation does not work for url open events.  eg. click on
webbrowser with link to "myurl:myinfo" does not put "myurl:myinfo" into
sys.argv.

I modified the py2app argv_emulation.py to support this and have
attached a patch.

Is there a py2app developer who could have a look at this, test, and
commit to the py2app source code so that it will be available in the
next release.
My python and Mac OS X skills are "raw" so please feel free to modify it
in any way to improve it :)

Thanks, Brendan.


--- argv_emulation.py.orig  2009-07-11 12:41:18.0 +1000
+++ argv_emulation.py.bjs   2009-08-14 09:33:40.0 +1000
@@ -7,7 +7,8 @@
 import traceback
 from Carbon import AE
 from Carbon.AppleEvents import kCoreEventClass, kAEOpenApplication, \
-kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias
+kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias, \
+kAEInternetSuite, kAEISGetURL, typeWildCard
 from Carbon import Evt
 from Carbon import File
 from Carbon.Events import highLevelEventMask, kHighLevelEvent
@@ -23,10 +24,15 @@
 self.__runapp)
 AE.AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
 self.__openfiles)
+#AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL,
+AE.AEInstallEventHandler('GURL', 'GURL',
+self.__geturl)
 
 def close(self):
 AE.AERemoveEventHandler(kCoreEventClass, kAEOpenApplication)
 AE.AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments)
+#AE.AERemoveEventHandler(kAEInternetSuite, kAEISGetURL)
+AE.AERemoveEventHandler('GURL', 'GURL')
 
 def mainloop(self, mask = highLevelEventMask, timeout = 1*60):
 # Note: this is not the right way to run an event loop in OSX or
@@ -91,6 +97,18 @@
 
 self._quit()
 
+def __geturl(self, requestevent, replyevent): # event handler
+try:
+listdesc = requestevent.AEGetParamDesc(keyDirectObject, 
typeAEList)
+for i in range(listdesc.AECountItems()):
+desc = listdesc.AEGetNthDesc(i+1, typeWildCard)[1]
+url = desc.data.decode('utf8')
+sys.argv.append(url)
+except Exception, e:
+print "argvemulator.py warning: can't unpack an GetURL event"
+
+self._quit()
+
 return ArgvCollector()
 
 def _argv_emulation():
begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


Re: [Pythonmac-SIG] argv_emulation for url open events

2009-08-13 Thread Brendan Simon (eTRIX)
Forgot to mention that the original argv_emulation.py file that I
modified was in the following directory :-

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app-0.3.6-py2.5.egg/py2app/bootstrap

Cheers, Brendan.


Brendan Simon (eTRIX) wrote:
> argv emulation does not work for url open events.  eg. click on
> webbrowser with link to "myurl:myinfo" does not put "myurl:myinfo" into
> sys.argv.
>
> I modified the py2app argv_emulation.py to support this and have
> attached a patch.
>
> Is there a py2app developer who could have a look at this, test, and
> commit to the py2app source code so that it will be available in the
> next release.
> My python and Mac OS X skills are "raw" so please feel free to modify it
> in any way to improve it :)
>
> Thanks, Brendan.
>
>
>   

begin:vcard
fn:Brendan Simon
n:Simon;Brendan
org:eTRIX pty ltd
adr:;;PO Box 306;St Kilda;VIC;3182;Australia
email;internet:brendan.si...@etrix.com.au
title:Managing Director
tel;work:+61-417-380-984
tel;cell:+61-417-380-984
x-mozilla-html:TRUE
version:2.1
end:vcard

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig


[Pythonmac-SIG] argv emulation with python 2.6.5

2010-03-27 Thread Brendan Simon (eTRIX)
I'm porting an app from python 2.5 (2.5.4) to python 2.6 (2.6.5) and
having timeout issues with argv emulation.

Does argv emulation with with python 2.6 (2.6.5) ??

How do I get argv emulation working with 2.6 and/or what is the work
around or alternative solution ??

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] argv emulation with python 2.6.5

2010-03-30 Thread Brendan Simon (eTRIX)
On 31/03/10 12:04 AM, Ronald Oussoren wrote:
>> I'm porting an app from python 2.5 (2.5.4) to python 2.6 (2.6.5) and
>> having timeout issues with argv emulation.
>>
>> Does argv emulation with with python 2.6 (2.6.5) ??
>> 
> Which argv emenulation? AFAIK both bundlebuilder (included in python) and 
> py2app (a standalone project) include something named argv emulation and both 
> should work on 2.6. Other projects might have something simular.
>   

I'm using py2app.  I have successfully used argv emulation with Python
2.5.4, however if I change the path to use Python 2.6.5 and rebuild the
app, app fails the argv emulation (e.g. when issuing 'open MyApp
myprotocol:abc=123')

Is there something special or different that has to be done to get argv
emulation working with Python 2.6 ??

The setup.py was created with python 2.5.4, maybe that's the problem ??

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Subject:, Could py2app bundle all the requirements of my package?

2010-05-21 Thread Brendan Simon (eTRIX)
I think the short answer is yes.
I've had no trouble with py2app getting all my dependencies.
You have a bigger app so it may need some extra tweaking, but py2app has
lots of commands to include and exclude stuff.  It is similar to py2exe
from what I can tell.

Cheers, Brendan.

> Subject:
> [Pythonmac-SIG] Could py2app bundle all the requirements of my package?
> From:
> cool-RR 
> Date:
> Fri, 21 May 2010 00:26:30 +0200
>
> To:
> pythonmac-sig 
>
>
> Hello!
>
> I'm developing a desktop application called GarlicSim:
>
> http://garlicsim.org
>
> I want to distribute it natively to all OSes.
>
> On Windows I have already succeeded packaging it with py2exe and
> InnoSetup.
>
> I have not touched py2app yet. Do you think that py2app could bundle
> all the packages I want?
>
> I want to bundle the entire Python standard library. (My program is a
> sort of a science lab, and a very important part of it is a Python
> shell that I provide, and I want my users to be able to use all of
> Python.)
> I want to bundle wxPython and cairo. (I'm especially worried about
> cairo.) My app is wxPython-based and I want to use cairo for drawing
> widgets.
> I want to bundle a big selection of scientific modules. Scipy, numpy,
> Traits, Mayavi (With VTK, which is especially hard to install.) Pretty
> much most of the things that Enthought provides.
>
> Note that with py2exe I've been able to do all of the above, (except I
> haven't finished bundling all the scientific libraries, just most of
> them.)
>
> (And no, I don't mind my app weighing 1GB.)
>
> Will py2app be able to bundle all these things and how much hair will
> I have left on my head after I get it working?
>
> (Please `cc` any replies to me.)
>
> Thanks for your help,
> Ram Rachum.
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app and python versions

2010-07-26 Thread Brendan Simon (eTRIX)
 I use py2app with Python 2.5.

Even though I'm keen to move to 2.6 (and then 2.7), I would _guess_ that
quite a few people are still using Python 2.5.

Cheers, Brendan.


On 26/07/10 11:04 AM, pythonmac-sig-requ...@python.org wrote:
> Subject:
> [Pythonmac-SIG] py2app and python versions
> From:
> Ronald Oussoren 
> Date:
> Sun, 25 Jul 2010 15:10:25 +0100
>
> To:
> "pythonmac-sig@python.org mac" 
>
>
> Hi,
>
> What is the minimal python version that peoply actually use py2app with?
>
> I want to do some development on py2app and related package later this year 
> to make it fully support python eggs and may want to modernize the code while 
> doing that.  The amount of modernization that is possible depends in part on 
> the minimaly required python version.  
>
> That said, if I start doing serious development it is pretty likely that I 
> accidently break support for versions before 2.6, as that is the minimal 
> version I test PyObjC with.  Python 2.6 would also allow me to rip out all 
> compatibility cruft, including the cruft needed to annotate byte literals 
> without using the byte-literal syntax.
>
> Ronald
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app architecture problem and System Python question

2010-07-26 Thread Brendan Simon (eTRIX)

> Subject:
> Re: [Pythonmac-SIG] py2app architecture problem and System Python
> question
> From:
> Ronald Oussoren 
> Date:
> Mon, 26 Jul 2010 02:25:21 -0700 (PDT)
>
> To:
> Tom MacWright 
> CC:
> pythonmac-sig@python.org
>

>> And how do I test these distributions quickly, as running OSX within
>> VirtualBox isn't supported and I don't have infinite computers to
>> play around with?
>  
> I use OSX 10.5 Server in a Parallels VM to test cross-release support.

Does "OSX within VirtualBox isn't supported" mean :-

* It doesn't work ??
* or, Apple don't allow you to run OS X in VB ??


I'm running OS X 10.6, and I would like to test my Python app bundle on
an OS X 10.5 box, so being able to have a VirtualBox install of OS X
10.5 would be very handy :)
Any idea why it "isn't supported" ??

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython

2011-01-25 Thread Brendan Simon (eTRIX)
I have a wxPython app that is built with py2app.  A user recently
reported the following error when trying to run the app.

Fatal Error: Mismatch between the program and library build versions
detected.
The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx
containers,compatible with 2.6),
and your program used 2.8 (no debug,Unicode,compiler with C++ ABI
102,wx containers,compatible with 2.6).
Abort trap
logout


It appears to be a difference in the wx libraries on the target system
and the wx libraries on the build system.

Unfortunately, at this stage, I do not know what the OS X version is on
the target system.

The app was built using Python 2.5.4, (wxPython 2.8.11.0 or 2.8.4.2 ??)
on OS X 10.6.6.

Is there anyway to fix this with a py2app setting ??

Doesn't py2app copy all the libraries to the app bundle ??  I guess that
doesn't guarantee that the libraries will load on any OS.

What about path settings ??

I presume others have solved this before.  Any suggestions ??

Many thanks,
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython

2011-02-06 Thread Brendan Simon (eTRIX)
On 26/01/11 4:06 AM, Christopher Barker wrote:
> On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote:
>> I have a wxPython app that is built with py2app. A user recently
>> reported the following error when trying to run the app.
>>
>> Fatal Error: Mismatch between the program and library build versions
>> detected.
>> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx
>> containers,compatible with 2.6),
>> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI
>> 102,wx containers,compatible with 2.6).
>> Abort trap
>> logout

As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4
(and beyond).

> Meanwhile a couple questions/thoughts:
> 
>  > It appears to be a difference in the wx libraries on the target system
>> and the wx libraries on the build system.
>>
>> Unfortunately, at this stage, I do not know what the OS X version is on
>> the target system.
>>
>> The app was built using Python 2.5.4, (wxPython 2.8.11.0 or 2.8.4.2 ??)
>> on OS X 10.6.6.
> 
> Is that the "apple's" python? i.e. the one in:
> 
> /System/Library/Frameworks/Python.framework/Versions/2.5
> 
> If so, that is likely your problem. py2app does not bundle up everything
> if you're using Apple's python, so your python install and your users
> may be different.


It's not Apple's python.  It is 2.5.4 from Python.org.


>> Is there anyway to fix this with a py2app setting ??
> 
> not until we figure out what's wrong...
> 
>> Doesn't py2app copy all the libraries to the app bundle ??
> 
> it should, but it won't if you are using Apple's python, and sometimes
> things go wrong. wxPython puts itself in /usr/local/, while putting
> nifty sys.path manipulations in the python installs, so things can get a
> bit confused. But it's done so that one installer can support both
> python,org and apple pythons.
> 
>> I guess that
>> doesn't guarantee that the libraries will load on any OS.
> 
> no, it doesn't, but it should load on any version that your supporting
> libs are built for -- the standard wxPython installers are built for
> 10.4 and above (maybe 10.3.9 --not sure about that), and so is the
> python,org python -- are you using any other third-party libs that
> aren't pure python?


I have more info now.  The app is being run on a PPC Mac with 10.4.11
(Tiger).  Tiger should be fine in terms of ABI compatibility for
wxPython and Python.

I now have a 10.4.11 PowerPC Mac and can replicate the problem, though
it was a 10.2 (Jaguar) system that I upgraded to 10.4 (Tiger).  i.e.
it's not a fresh install of Tiger.

$ file /Applications/MyApp.app/Contents/MyApp
MyApp: Mach-O fat file with 2 architectures
MyApp (for architecture ppc):Mach-O executable ppc
MyApp (for architecture i386):   Mach-O executable i386

$ /Applications/MyApp.app/Contents/MacOS/MyApp
Fatal Error: Mismatch between the program and library build versions
detected.
The library used 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx
containers,compatible with 2.6)
and wxPython used 2.8 (debug,Unicode,compiler with C++ ABI 102,wx
containers,compatible with 2.6)
Abort

$ /Applications/MyApp.app/Contents/MacOS/python
Could not find platform independent libraries 
Consider setting $PYTHONPATH to [:]
'import site' failed; use -v for traceback
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

>>> import sys
>>> for l in sys.path: print l
...

/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk
/Library/Frameworks/Python.framework/Versions/2.5/lib/lib-dynload
>>>

$ ls -l /Library/Frameworks/
$

No output from above command, but it shouldn't matter right, as all
libraries should be in the app bundle, right ??

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython

2011-02-08 Thread Brendan Simon (eTRIX)
I'm still stuck on this.  Has anyone got any suggestions to help solve
the ABI compatibility issue with wx ??

I think it's something to do with building on 10.6 Intel, and trying to
run on 10.4 PPC.  It seems to work ok when run on 10.4 Intel.

My 10.4 Intel box has Apple python 2.3.1 (/usr/bin/python) and wx
2.5.3.1 installed, and python.org 2.5.1 (/usr/local/bin/python) and wx
2.8 (i think).

My 10.4 PPC box has Apple python 2.3.1 (/usr/bin/python) and wx 2.5.3.1
installed.

It really shouldn't matter what I have installed if py2app is truly
packaging up all libraries and dependencies (assuming they are universal
builds).

Thanks, Brendan.


On 6/02/11 8:47 PM, Brendan Simon (eTRIX) wrote:
> On 26/01/11 4:06 AM, Christopher Barker wrote:
>> On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote:
>>> I have a wxPython app that is built with py2app. A user recently
>>> reported the following error when trying to run the app.
>>>
>>> Fatal Error: Mismatch between the program and library build versions
>>> detected.
>>> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx
>>> containers,compatible with 2.6),
>>> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI
>>> 102,wx containers,compatible with 2.6).
>>> Abort trap
>>> logout
> 
> As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4
> (and beyond).
> 
>> Meanwhile a couple questions/thoughts:
>>
>>  > It appears to be a difference in the wx libraries on the target system
>>> and the wx libraries on the build system.
>>>
>>> Unfortunately, at this stage, I do not know what the OS X version is on
>>> the target system.
>>>
>>> The app was built using Python 2.5.4, (wxPython 2.8.11.0 or 2.8.4.2 ??)
>>> on OS X 10.6.6.
>>
>> Is that the "apple's" python? i.e. the one in:
>>
>> /System/Library/Frameworks/Python.framework/Versions/2.5
>>
>> If so, that is likely your problem. py2app does not bundle up everything
>> if you're using Apple's python, so your python install and your users
>> may be different.
> 
> 
> It's not Apple's python.  It is 2.5.4 from Python.org.
> 
> 
>>> Is there anyway to fix this with a py2app setting ??
>>
>> not until we figure out what's wrong...
>>
>>> Doesn't py2app copy all the libraries to the app bundle ??
>>
>> it should, but it won't if you are using Apple's python, and sometimes
>> things go wrong. wxPython puts itself in /usr/local/, while putting
>> nifty sys.path manipulations in the python installs, so things can get a
>> bit confused. But it's done so that one installer can support both
>> python,org and apple pythons.
>>
>>> I guess that
>>> doesn't guarantee that the libraries will load on any OS.
>>
>> no, it doesn't, but it should load on any version that your supporting
>> libs are built for -- the standard wxPython installers are built for
>> 10.4 and above (maybe 10.3.9 --not sure about that), and so is the
>> python,org python -- are you using any other third-party libs that
>> aren't pure python?
> 
> 
> I have more info now.  The app is being run on a PPC Mac with 10.4.11
> (Tiger).  Tiger should be fine in terms of ABI compatibility for
> wxPython and Python.
> 
> I now have a 10.4.11 PowerPC Mac and can replicate the problem, though
> it was a 10.2 (Jaguar) system that I upgraded to 10.4 (Tiger).  i.e.
> it's not a fresh install of Tiger.
> 
> $ file /Applications/MyApp.app/Contents/MyApp
> MyApp: Mach-O fat file with 2 architectures
> MyApp (for architecture ppc):Mach-O executable ppc
> MyApp (for architecture i386):   Mach-O executable i386
> 
> $ /Applications/MyApp.app/Contents/MacOS/MyApp
> Fatal Error: Mismatch between the program and library build versions
> detected.
> The library used 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx
> containers,compatible with 2.6)
> and wxPython used 2.8 (debug,Unicode,compiler with C++ ABI 102,wx
> containers,compatible with 2.6)
> Abort
> 
> $ /Applications/MyApp.app/Contents/MacOS/python
> Could not find platform independent libraries 
> Consider setting $PYTHONPATH to [:]
> 'import site' failed; use -v for traceback
> Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> 
>>>> import sys
>>>> for l in sys.path: print l
> ...
> 
> /Library/Frameworks/Python.framework/Versions/2.5/lib/

Re: [Pythonmac-SIG] py2app with wxpython

2011-02-20 Thread Brendan Simon (eTRIX)

On 18/02/2011 10:00 PM, pythonmac-sig-requ...@python.org wrote:

Subject:
Re: [Pythonmac-SIG] py2app with wxpython
From:
Christopher Barker 
Date:
Thu, 17 Feb 2011 09:12:36 -0800

To:
pythonmac-sig@python.org


On 2/17/11 2:05 AM, Gerhard Schmidt wrote:

Hi,

i try to generate an app from a wxPython project.

Generation the App runs without an error. But when i try to start the
App it terminates.


versions of python (and which binary install), py2app, wxPython, OS-X ?


The logs show that import wx doesn't work.


can you build a really, really simple wx app? (see enclosed)


What am i missing.


I'm not sure, but you do have something extra:

 CFBundleIdentifier = 
"com.acf.vereinsverwaltung",

 )
  ,'packages':  'wx'

you don't need to specify the wx package -- if there is an "import wx" 
in your code, py2app will find it.



  ,'site_packages': True

And I don't remember what this does -- try taking it out and see what 
you get.


-Chris


Do you need to specify 'pythonw' as the interpreter ??
It may depend on python version.  I found (on OS X) that Python 2.7 
requires pythonw rather than python to run my wxPython apps.


Cheers, Brendan.

--
Brendan Simon
www.etrix.com.au

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app with wxpython

2011-02-21 Thread Brendan Simon (eTRIX)
On 21/02/11 10:00 PM, pythonmac-sig-requ...@python.org wrote:
> Subject:
> Re: [Pythonmac-SIG] py2app with wxpython
> From:
> Ned Deily 
> Date:
> Sun, 20 Feb 2011 15:46:05 -0800
>
> To:
> pythonmac-sig@python.org
>
>
> In article <4d61918e.1010...@etrix.com.au>,
>  "Brendan Simon (eTRIX)"  wrote:
>> > Do you need to specify 'pythonw' as the interpreter ??
>> > It may depend on python version.  I found (on OS X) that Python 2.7 
>> > requires pythonw rather than python to run my wxPython apps.
> That sounds very suspicious.  On OS X installs, bin/python and 
> bin/pythonw are supposed to be identical.
Indeed you are right.  The python and pythonw varieties are identical
for Python 2.7 and my wxPython application works fine with either.

I tried again with my Python 2.5.4 install and that does have the problem.

"pythonw myapp.py" works fine.

"python myapp.py" fails with the following error.

Traceback (most recent call last):
  File "myapp.py", line 18, in 
import main as myMain
  File "/Users/brendan/src/main.py", line 19, in 
from theapp import MyApp
  File "/Users/brendan/src/theapp.py", line 20, in 
import wxAnyThread
ImportError: No module named wxAnyThread

It looks like it is just a path issue.  So it should be easy to solve,
but there is a difference in behaviour between python and pythonw with
Python 2.5.4, even though the binaries are identical.  I presume that
the the interpreter looks at the command that it is invoked with and
does something different with sys.path ??

Cheers, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app with wxpython

2011-02-22 Thread Brendan Simon (eTRIX)
On 22/02/11 8:57 PM, Ronald Oussoren wrote:
> On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote:
>
>> On 21/02/11 10:00 PM, pythonmac-sig-requ...@python.org wrote:
>>> Subject:
>>> Re: [Pythonmac-SIG] py2app with wxpython
>>> From:
>>> Ned Deily 
>>> Date:
>>> Sun, 20 Feb 2011 15:46:05 -0800
>>>
>>> To:
>>> pythonmac-sig@python.org
>>>
>>>
>>> In article <4d61918e.1010...@etrix.com.au>,
>>>  "Brendan Simon (eTRIX)"  wrote:
>>>> > Do you need to specify 'pythonw' as the interpreter ??
>>>> > It may depend on python version.  I found (on OS X) that Python 2.7 
>>>> > requires pythonw rather than python to run my wxPython apps.
>>> That sounds very suspicious.  On OS X installs, bin/python and 
>>> bin/pythonw are supposed to be identical.
>> Indeed you are right.  The python and pythonw varieties are identical
>> for Python 2.7 and my wxPython application works fine with either.
>>
>> I tried again with my Python 2.5.4 install and that does have the
>> problem.
>
> Which python 2.5.4 is that (that is, how did you install it)? Are you
> sure that 'python' and 'pythonw' refer to the same python installation
> (what is sys.prefix for these two commands)?
I'm using standard python.org builds.


brendan$ python
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.prefix
/Users/brendan/virtualenv/xxx-py25/bin/..


brendan$ pythonw
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.prefix
/Library/Frameworks/Python.framework/Versions/2.5


Hmmm, it might be something to do with my virtualenv setup (I've only
just started using virtualenv).

brendan$ ls -l ~/virtualenv/xxx-py25/bin/python*
-rwxrwxr-x  1 brendan  staff  30028 27 Jan 22:11
/Users/brendan/virtualenv/xxx-py25/bin/python
lrwxr-xr-x  1 brendan  staff  6 27 Jan 22:11
/Users/brendan/virtualenv/xxx-py25/bin/python2.5 -> python
lrwxr-xr-x  1 brendan  staff 61 27 Jan 22:20
/Users/brendan/virtualenv/xxx-py25/bin/pythonw ->
/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app with wxpython

2011-02-22 Thread Brendan Simon (eTRIX)

On 23/02/2011 1:18 AM, Ronald Oussoren wrote:


On 22 Feb, 2011, at 12:03, Brendan Simon (eTRIX) wrote:


On 22/02/11 8:57 PM, Ronald Oussoren wrote:

On 21 Feb, 2011, at 12:33, Brendan Simon (eTRIX) wrote:


On 21/02/11 10:00 PM, pythonmac-sig-requ...@python.org wrote:

Subject:
Re: [Pythonmac-SIG] py2app with wxpython
From:
Ned Deily 
Date:
Sun, 20 Feb 2011 15:46:05 -0800

To:
pythonmac-sig@python.org


In article<4d61918e.1010...@etrix.com.au>,
  "Brendan Simon (eTRIX)"  wrote:

>  Do you need to specify 'pythonw' as the interpreter ??
>  It may depend on python version.  I found (on OS X) that Python 2.7
>  requires pythonw rather than python to run my wxPython apps.

That sounds very suspicious.  On OS X installs, bin/python and
bin/pythonw are supposed to be identical.
Indeed you are right.  The python and pythonw varieties are 
identical for Python 2.7 and my wxPython application works fine 
with either.


I tried again with my Python 2.5.4 install and that does have the 
problem.


Which python 2.5.4 is that (that is, how did you install it)? Are 
you sure that 'python' and 'pythonw' refer to the same python 
installation (what is sys.prefix for these two commands)?

I'm using standard python.org <http://python.org> builds.


brendan$ python
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.prefix
/Users/brendan/virtualenv/xxx-py25/bin/..


brendan$ pythonw
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.prefix
/Library/Frameworks/Python.framework/Versions/2.5


Hmmm, it might be something to do with my virtualenv setup (I've only 
just started using virtualenv).


brendan$ ls -l ~/virtualenv/xxx-py25/bin/python*
-rwxrwxr-x  1 brendan  staff  30028 27 Jan 22:11 
/Users/brendan/virtualenv/xxx-py25/bin/python
lrwxr-xr-x  1 brendan  staff  6 27 Jan 22:11 
/Users/brendan/virtualenv/xxx-py25/bin/python2.5 -> python
lrwxr-xr-x  1 brendan  staff 61 27 Jan 22:20 
/Users/brendan/virtualenv/xxx-py25/bin/pythonw -> 
/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw



AFAIK pythonw doesn't work in virtualenvs and within a virtualenv the 
python command is the real embedded interpreter, not the pythonw 
wrapper you get otherwise.


This is something that needs to be fixed by someone. I'm more likely 
to work on a simular tool that supports both 2.x and 3.x and doesn't 
install crap I didn't ask for and isn't mentioned in the documentation.


I'm not clear which tool you are referring too.  I'm presuming 
virtualenv, right ??  or are you referring to the pythonw wrapper ??


Does virtualenv have some downsides that I'm not aware of ??
It seems like a great idea to be able to install separate modules into 
separate virtual environments so that each project can use different 
modules, or different versions of the same module, etc.


Cheers, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython on OS X

2011-03-01 Thread Brendan Simon (eTRIX)
On 8/02/11 10:55 PM, Brendan Simon (eTRIX) wrote:
> On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote:
>>>> I have a wxPython app that is built with py2app. A user recently
>>>> reported the following error when trying to run the app.
>>>>
>>>> Fatal Error: Mismatch between the program and library build versions
>>>> detected.
>>>> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx
>>>> containers,compatible with 2.6),
>>>> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI
>>>> 102,wx containers,compatible with 2.6).
>>>> Abort trap
>>>> logout
>> As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4
>> (and beyond).
>>

It turns out that previous builds of my application DO work on PowerPC
OS X 10.4, it's only recent builds
that fail with the ABI compatibility error.

The app bundle is built with python.org 2.5.4 using pythonw
(/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw).  It
contains a libwx_macud-2.8.0.dylib file which I think is the culprit.  I
interrogated this file (strings and grep) and noted an ABI difference.

An app that works on PowerPC and Intel 10.4.11.

$ cat ./MyApp.app/Contents/Frameworks/libwx_macud-2.8.0.dylib | strings
| grep ABI
2.8 (debug,Unicode,compiler with C++ ABI 102,wx containers,compatible
with 2.6)
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)

An app that does NOT work on PowerPC 10.4.11 but does work on Intel 10.4.11.

$ cat ./MyApp.app/Contents/Frameworks/libwx_macud-2.8.0.dylib | strings
| grep ABI
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)

The latter has TWO identical lines with ABI 1002.  i.e. it does NOT have
the ABI 102 for some reason.

A search of my filesystem reveals that none of the wx libraries appear
to have ABI 102 in the wx libraries.

$ find /usr -name "libwx_macud-2.8.0.dylib" -ls
1412128 lrwxr-xr-x1 root wheel  27 15 Aug  2009
/usr/lib/libwx_macud-2.8.0.dylib -> libwx_macud-2.8.0.5.0.dylib
2271698288 lrwxr-xr-x1 root wheel  27  5 Aug 
2010
/usr/local/lib/wxPython-unicode-2.8.11.0/lib/libwx_macud-2.8.0.dylib ->
libwx_macud-2.8.0.7.0.dylib
24113538 lrwxr-xr-x1 root wheel  27 18 Jun  2008
/usr/local/lib/wxPython-unicode-2.8.4.0/lib/libwx_macud-2.8.0.dylib ->
libwx_macud-2.8.0.1.1.dylib
24122618 lrwxr-xr-x1 root wheel  27 18 Jun  2008
/usr/local/lib/wxPython-unicode-2.8.4.2/lib/libwx_macud-2.8.0.dylib ->
libwx_macud-2.8.0.1.1.dylib

$ find /usr -name "libwx_macud-2.8.0.dylib" | xargs strings | grep ABI
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)
2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
with 2.6)

I'm not sure what has changed to cause this.

* OS X updates
* Code changes that use various interpreters, specified as: python,
  pythonw,
  /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw, etc.
* Installs of new pythons (e.g. python 2.7, python 3.x)
* Installs of newer wxPython ??  ANSI versus Unicode versions ??


Any ideas as to why my wx library no longer has the ABI 102 compatibility ??
I'm thinking it is most likely a wxPython build or install problem.

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] C++ ABI 1002/102 incompatibility with wxPython on OS X

2011-03-01 Thread Brendan Simon (eTRIX)


On 2/03/11 8:34 AM, Brendan Simon (eTRIX) wrote:
> On 8/02/11 10:55 PM, Brendan Simon (eTRIX) wrote:
>> On 1/25/11 1:20 AM, Brendan Simon (eTRIX) wrote:
>>>>> I have a wxPython app that is built with py2app. A user recently
>>>>> reported the following error when trying to run the app.
>>>>>
>>>>> Fatal Error: Mismatch between the program and library build versions
>>>>> detected.
>>>>> The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1002,wx
>>>>> containers,compatible with 2.6),
>>>>> and your program used 2.8 (no debug,Unicode,compiler with C++ ABI
>>>>> 102,wx containers,compatible with 2.6).
>>>>> Abort trap
>>>>> logout
>>> As others have informed me, the C++ ABI changed from gcc-3.3 to gcc-3.4
>>> (and beyond).
>>>
>
> It turns out that previous builds of my application DO work on PowerPC
> OS X 10.4, it's only recent builds
> that fail with the ABI compatibility error.
>
> The app bundle is built with python.org 2.5.4 using pythonw
> (/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw).  It
> contains a libwx_macud-2.8.0.dylib file which I think is the culprit. 
> I interrogated this file (strings and grep) and noted an ABI difference.
>
> An app that works on PowerPC and Intel 10.4.11.
>
> $ cat ./MyApp.app/Contents/Frameworks/libwx_macud-2.8.0.dylib |
> strings | grep ABI
> 2.8 (debug,Unicode,compiler with C++ ABI 102,wx containers,compatible
> with 2.6)
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
>
> An app that does NOT work on PowerPC 10.4.11 but does work on Intel
> 10.4.11.
>
> $ cat ./MyApp.app/Contents/Frameworks/libwx_macud-2.8.0.dylib |
> strings | grep ABI
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
>
> The latter has TWO identical lines with ABI 1002.  i.e. it does NOT
> have the ABI 102 for some reason.
>
> A search of my filesystem reveals that none of the wx libraries appear
> to have ABI 102 in the wx libraries.
>
> $ find /usr -name "libwx_macud-2.8.0.dylib" -ls
> 1412128 lrwxr-xr-x1 root wheel  27 15 Aug 
> 2009 /usr/lib/libwx_macud-2.8.0.dylib -> libwx_macud-2.8.0.5.0.dylib
> 2271698288 lrwxr-xr-x1 root wheel  27  5 Aug 
> 2010
> /usr/local/lib/wxPython-unicode-2.8.11.0/lib/libwx_macud-2.8.0.dylib
> -> libwx_macud-2.8.0.7.0.dylib
> 24113538 lrwxr-xr-x1 root wheel  27 18 Jun 
> 2008
> /usr/local/lib/wxPython-unicode-2.8.4.0/lib/libwx_macud-2.8.0.dylib ->
> libwx_macud-2.8.0.1.1.dylib
> 24122618 lrwxr-xr-x1 root wheel  27 18 Jun 
> 2008
> /usr/local/lib/wxPython-unicode-2.8.4.2/lib/libwx_macud-2.8.0.dylib ->
> libwx_macud-2.8.0.1.1.dylib
>
> $ find /usr -name "libwx_macud-2.8.0.dylib" | xargs strings | grep ABI
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
> 2.8 (debug,Unicode,compiler with C++ ABI 1002,wx containers,compatible
> with 2.6)
>
> I'm not sure what has changed to cause this.
>
> * OS X updates
> * Code changes that use various interpreters, specified as:
>   python, pythonw,
>   /Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw, etc.
> * Installs of new pythons (e.g. python 2.7, python 3.x)
> * Installs of newer wxPython ??  ANSI versus Unicode versions ??
>
>
> Any ideas as to why my wx library no longer has the ABI 102
> compatibility ??
> I'm thinking it is most likely a wxPython build or install problem.
The other possibility is that the builds that do work may have been
built on another Mac running 10.5, not my current Mac running 10.6. 
Will have dig up the old Mac and see if that makes a difference.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] py2app 0.5.2 fails to copy main-i386 file

2011-03-10 Thread Brendan Simon (eTRIX)
I upgraded to py2app 0.5.2 and now my app does not build :(
I'm using OS X 10.6 and Python 2.5.4 from python.org.

  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py",
line 51, in copyfile
fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory:

'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app/apptemplate/prebuilt/main-i386'
>

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/shutil.py(58)copyfile()
-> fsrc.close()
(Pdb) interrupted
make: *** [dist/SureAnalysis.app] Error 1


I thought I read that this was fixed in 0.5.2 (from 0.5.1) but it does
not seem to be the case.

I did see a message to copy main-fat to main-i386.  I tried that and the
app builds ok.
I note that there is also main-intel, main-universal, etc.  I presume
main-fat is the one to use ??

My app does not parse the command line arguments anymore when invoked
with 'open'
e.g. $ open myurl:mycommand

I remember modifying something with argv emulation quite a while ago (1
or 2 years ago).  Is this still expected with py2app 0.5.2 ??

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app 0.5.2 and argv emulation with URLs/URIs

2011-03-10 Thread Brendan Simon (eTRIX)


On 11/03/11 1:04 AM, Ronald Oussoren wrote:
>
> On 10 Mar, 2011, at 7:05, Brendan Simon (eTRIX) wrote:
>
>> I upgraded to py2app 0.5.2 and now my app does not build :(
>> I'm using OS X 10.6 and Python 2.5.4 from python.org <http://python.org>.
>>
>> My app does not parse the command line arguments anymore when invoked
>> with 'open'
>> e.g. $ open myurl:mycommand
>>
>> I remember modifying something with argv emulation quite a while ago
>> (1 or 2 years ago).  Is this still expected with py2app 0.5.2 ?? 
>> i.e. should opening URLs/URIs work out of the box ??
>
> There is a problem with the source package of py2app. I want to do a
> new release later this week that fixes the issue.
>
> (The problem is that not all files are included in the sdist archive
> because our setup.py relied on setuptools including all files that are
> in the repository, and that no longer works because we switched to
> mercurial).

Any feedback on the argv_emulation issue when open URLs/URIs ??

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] [patch] GetURL argv emulation for py2app 0.5.2

2011-03-10 Thread Brendan Simon (eTRIX)
Below is my patch to get URLs/URIs to be added to sys.argv when an app
is opened via the Launcher.

It should be applied to:

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app/bootstrap/argv_emulation.py

Can this patch *please* be integrated (please modify if necessary) in to
0.5.3 release !!

eg.  You can test with "open myapp myurl:test"

The sys.argv attribute should include "myurl:test" :)

NOTE: for some reason the AppleEvent constants kAEInternetSuite and
kAEISGetURL does not work as they are set to 'gurl' (lowercase). 
However using 'GURL' does work :)

Cheers, Brendan.


--- argv_emulation_orig.py2011-03-11 08:49:13.0 +1100
+++ argv_emulation.py2011-03-11 09:47:00.0 +1100
@@ -7,7 +7,8 @@
 import traceback
 from Carbon import AE
 from Carbon.AppleEvents import kCoreEventClass, kAEOpenApplication, \
-kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias
+kAEOpenDocuments, keyDirectObject, typeAEList, typeAlias, \
+kAEInternetSuite, kAEISGetURL, typeChar
 from Carbon import Evt
 from Carbon import File
 from Carbon.Events import highLevelEventMask, kHighLevelEvent
@@ -23,10 +24,14 @@
 self.__runapp)
 AE.AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
 self.__openfiles)
+#AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL,
self.__geturl)
+AE.AEInstallEventHandler('GURL', 'GURL', self.__geturl)
 
 def close(self):
 AE.AERemoveEventHandler(kCoreEventClass, kAEOpenApplication)
 AE.AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments)
+#AE.AERemoveEventHandler(kAEInternetSuite, kAEISGetURL)
+AE.AERemoveEventHandler('GURL', 'GURL')
 
 def mainloop(self, mask = highLevelEventMask, timeout = 1*60):
 # Note: this is not the right way to run an event loop in
OSX or
@@ -91,6 +96,20 @@
 
 self._quit()
 
+def __geturl(self, requestevent, replyevent):
+try:
+listdesc = requestevent.AEGetParamDesc(keyDirectObject,
typeAEList)
+for i in range(listdesc.AECountItems()):
+desc = listdesc.AEGetNthDesc(i+1, typeChar)[1]
+url = desc.data.decode('utf8')
+sys.argv.append(url)
+except Exception, e:
+print "argvemulator.py warning: can't unpack a GetURL
event"
+import traceback
+traceback.print_exc()
+
+self._quit()
+
 return ArgvCollector()
 
 def _argv_emulation():


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [patch] GetURL argv emulation for py2app 0.5.2

2011-03-12 Thread Brendan Simon (eTRIX)
On 12/03/11 10:00 PM, pythonmac-sig-requ...@python.org wrote:
> On 10 Mar, 2011, at 18:04, Brendan Simon (eTRIX) wrote:
>> > Below is my patch to get URLs/URIs to be added to sys.argv when an app
>> > is opened via the Launcher.
>> > 
>> > It should be applied to:
>> > 
>> > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/py2app/bootstrap/argv_emulation.py
>> > 
>> > Can this patch *please* be integrated (please modify if necessary) in to
>> > 0.5.3 release !!
> Which OS release are you on? I've tried to test with python 2.5 and 2.7 on 
> OSX 10.6 and those seem to work fine without your patch (even with the 
> lowercase values you mention furtheron).
>
> My test has a simple main.py script that saves sys.argv in a text file. When 
> I add that file to an application bundle with py2app and then start the 
> bundle with 'open -a dist/myapp.app file:/usr/bin/ssh' the saved argv 
> contains the file to open. As code says more than my description I've 
> attached the unittest testcase I've tried.
>
> Is this test testing the failure your reporting or did I misread your message?

I am running on OS 10.6, but my app needs to run on 10.4, 10.5 and 10.6
(PPC and Intel).
I am using Python 2.5.4.

I don't think your test would work if you were to use a custom url,
rather than 'file:' and a filename/path.

If I ran the command "open myurl:mycommand" from the terminal, and my
plist has configured 'myurl' as a recognised url, then the app bundle
should fire up.  It may need to be in the Application folder for it to
work ??

I expect 'myurl:mycommand' to be appended to sys.argv.

Here is a snippet of my py2app setup.py.

# A custom plist for letting it associate with a URL protocol.
URLTYPES = [
 {
   'CFBundleURLName' : "MyUrl",
   'CFBundleURLSchemes' : [ "myurl" ]
 }
   ]

Plist = dict(
NSAppleScriptEnabled = 'YES',
CFBundleIdentifier = 'com.myurl',
LSMinimumSystemVersion = "10.4",
CFBundleURLTypes = URLTYPES
)

OPTIONS = {
'argv_emulation' : True,
'iconfile' : 'images/myurl.icns',
'plist' : Plist,
   }

Hope that helps,
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [patch] GetURL argv emulation for py2app 0.5.2

2011-03-12 Thread Brendan Simon (eTRIX)


On 13/03/11 1:30 AM, Ronald Oussoren wrote:
> On 12 Mar, 2011, at 6:36, Brendan Simon (eTRIX) wrote:
>> I am running on OS 10.6, but my app needs to run on 10.4, 10.5 and
>> 10.6 (PPC and Intel).
>> I am using Python 2.5.4.
>>
>> I don't think your test would work if you were to use a custom url,
>> rather than 'file:' and a filename/path.
>>
>> If I ran the command "open myurl:mycommand" from the terminal, and my
>> plist has configured 'myurl' as a recognised url, then the app bundle
>> should fire up.  It may need to be in the Application folder for it
>> to work ??
>>
>> I expect 'myurl:mycommand' to be appended to sys.argv.
>>
>> Here is a snippet of my py2app setup.py.
>>
>> # A custom plist for letting it associate with a URL protocol.
>> URLTYPES = [
>>  {
>>'CFBundleURLName' : "MyUrl",
>>'CFBundleURLSchemes' : [ "myurl" ]
>>  }
>>]
>>
>> Plist = dict(
>> NSAppleScriptEnabled = 'YES',
>> CFBundleIdentifier = 'com.myurl',
>> LSMinimumSystemVersion = "10.4",
>> CFBundleURLTypes = URLTYPES
>> )
>>
>> OPTIONS = {
>> 'argv_emulation' : True,
>> 'iconfile' : 'images/myurl.icns',
>> 'plist' : Plist,
>>}
>>
>> Hope that helps,
>
> It sure does, this helped me to reproduce the issue.  I've added another 
>
> From your original e-mail:
>
>> +def __geturl(self, requestevent, replyevent):
>> +try:
>> +listdesc = requestevent.AEGetParamDesc(keyDirectObject,
>> typeAEList)
>> +for i in range(listdesc.AECountItems()):
>> +desc = listdesc.AEGetNthDesc(i+1, typeChar)[1]
>> +url = desc.data.decode('utf8')
>
> Is the decode really necessary? With this one of the times in sys.argv
> will be a Unicode string rather than a byte string. I'd therefore
> prefer to not have the decode call.
>
> I've added your patch without the decode call to my repository,
> including some tests that ensure that future versions won't accidently
> break the code.
>
> Thank you for the patch,

My pleasure re the patch.  It's nice to be able to contribute back to
the open-source community (even if it is just a tiny bit).

I did the original patch back in 2009.  I don't know why the
decode('utf8') is in there.  I suspect it was a copy-n-paste from
somewhere, either some from some code I found via googling or from some
code posted on this mailing list.

I'm more than happy to remove the decode it as I presume the application
itself can do that if necessary.

Cheers, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] [patch] GetURL argv emulation for py2app 0.5.2

2011-03-12 Thread Brendan Simon (eTRIX)


On 11/03/11 10:04 AM, Brendan Simon (eTRIX) wrote:
> NOTE: for some reason the AppleEvent constants kAEInternetSuite and
> kAEISGetURL does not work as they are set to 'gurl' (lowercase). 
> However using 'GURL' does work :)
>
> Cheers, Brendan.

Was thinking it may be "nicer" to convert the constants to upper case
rather than having a magic string ??

-AE.AEInstallEventHandler('GURL', 'GURL', self.__geturl)
+AE.AEInstallEventHandler(kAEInternetSuite.upper(), 
kAEISGetURL.upper(), self.__geturl)


-AE.AERemoveEventHandler('GURL', 'GURL')
+AE.AERemoveEventHandler(kAEInternetSuite.upper(), 
kAEISGetURL.upper())

or

kAEInternetSuite = kAEInternetSuite.upper()

kAEISGetURL = kAEISGetURL.upper())


I'm not fussed either way, as long as it works :)

Cheers, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] python 2.7 problem with crcmod -- "ImportError: No module named predefined"

2011-05-01 Thread Brendan Simon (eTRIX)
I get the following error when trying to run my app when built with
py2app and python 2.7.

  File "crcmod/__init__.pyc", line 7, in 
ImportError: No module named predefined


The app works fine when built with Python 2.5 or Python 2.6.

It seems the folks in py2exe land are having the same issue.

http://thread.gmane.org/gmane.comp.python.py2exe/4301
http://thread.gmane.org/gmane.comp.python.py2exe/4302


Any ideas what would be causing this and how it can be
fixed/solved/worked-around ??

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] python 2.7 problem with crcmod -- "ImportError: No module named predefined"

2011-05-02 Thread Brendan Simon (eTRIX)


On 3/05/11 6:18 AM, Ronald Oussoren wrote:
>> I get the following error when trying to run my app when built with
>> py2app and python 2.7.
>>
>>   File "crcmod/__init__.pyc", line 7, in 
>> ImportError: No module named predefined
>>
>>
>> The app works fine when built with Python 2.5 or Python 2.6.
>>
>> It seems the folks in py2exe land are having the same issue.
>>
>> http://thread.gmane.org/gmane.comp.python.py2exe/4301
>> http://thread.gmane.org/gmane.comp.python.py2exe/4302
>>
>>
>> Any ideas what would be causing this and how it can be
>> fixed/solved/worked-around ??
>
> The crcmod package contains a module named crcmod. My guess is that
> both py2app and py2exe get confused by this and try to fetch
> 'crcmod.predefined' from the nested module instead of the toplevel
> package.  This basicly means that both py2*s have a bug in their
> emulation of the __import__ code.  
>
> I'll see if I can create a testcase for this for the modulegraph
> package, it should then be fairly easy to actually fix the issue. As
> this is only a problem with python2.7 this may end up being a bug in
> the stdlib though.
>
> As a workaround try adding includes for crcmod.predefined, or even the
> entire crcmod package (setup(..., package=['crcmod'], ...))

Yep.  Forcing inclusion of the module in setup does resolve the issue. 
Here is the snippet of my setup file that worked for me :)

Hopefully py2app can be fixed so this is not necessary, but at least I
have a workaround now.

Thanks Ronald !!

PACKAGES = [ 'crcmod', ]

OPTIONS = {
'argv_emulation' : True,
'iconfile' : 'images/myapp.icns',
'plist' : Plist,
'packages' : PACKAGES,
   }

setup(
app = APP,
data_files = DATA_FILES,
options = { 'py2app' : OPTIONS },
setup_requires=['py2app'],
)


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] python 2.7 problem with crcmod -- "ImportError: No module named predefined"

2011-05-03 Thread Brendan Simon (eTRIX)


On 3/05/11 5:01 PM, Ronald Oussoren wrote:
> The crcmod package contains a module named crcmod. My guess is that
> both py2app and py2exe get confused by this and try to fetch
> 'crcmod.predefined' from the nested module instead of the toplevel
> package.  This basicly means that both py2*s have a bug in their
> emulation of the __import__ code.  
>>>
>>> I'll see if I can create a testcase for this for the modulegraph
>>> package, it should then be fairly easy to actually fix the issue. As
>>> this is only a problem with python2.7 this may end up being a bug in
>>> the stdlib though.
>>>
>>> As a workaround try adding includes for crcmod.predefined, or even
>>> the entire crcmod package (setup(..., package=['crcmod'], ...))
>>
>> Yep.  Forcing inclusion of the module in setup does resolve the
>> issue.  Here is the snippet of my setup file that worked for me :)
>>
>> Hopefully py2app can be fixed so this is not necessary, but at least
>> I have a workaround now.
>
> I think I can fix this in modulegraph, I'm not quite sure why it works
> in 2.6 but not in 2.7 though. Are you using the same version of crcmod
> in both cases?
>
> My current impresssion of what's going on here: crcmod.__init__ contains:
>
> try:
> from crcmod.crcmod import *
> import crcmod.predefined
> except ImportError:
> # Make this backward compatible
> from crcmod import *
> import predefined
>
> A test with a simular package structure fails on both 2.6 and 2.7, but
> works with 3.2. Modulegraph fails because it creates a MissingModule
> node for crcmod.predefined, which seems to indicate a bug in how we
> process imports in a package as it should have created a MissingModule
> node for crcmod.crcmod.predefined for the second import statement and
> then a real node for the last one.
Ah, yes, there are different versions of crcmod installed.

$ /Library/Frameworks/Python.framework/Versions/2.5/bin/pip freeze |
grep crcmod
crcmod==1.5

$ /Library/Frameworks/Python.framework/Versions/2.6/bin/pip freeze |
grep crcmod
crcmod==1.6.1

$ /Library/Frameworks/Python.framework/Versions/2.7/bin/pip freeze |
grep crcmod
crcmod==1.7

-- Brendan.
___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] py2app under Lion--any issues?

2011-07-21 Thread Brendan Simon (eTRIX)


On 22/07/11 5:45 AM, pythonmac-sig-requ...@python.org wrote:
> Subject:
> Re: [Pythonmac-SIG] py2app under Lion--any issues?
> From:
> "Russell E. Owen" 
> Date:
> 5:38 AM
>
> To:
> pythonmac-sig@python.org
>
>
> In article <20110721001520.gb12...@panix.com>,
>  Aahz  wrote:
>
> Ronald Oussouran points out in the Lion thread that:
>
>> > Both (the more compatible 32-bit python.org Python binary installer and 
>> > the 64-bit/32-bit version)
>> > should work, but only the 64-bit/32-bit installer is truly useful:  the 
>> > xcode version for Lion is from the 4.x series and that no longer supports 
>> > building PPC extensions, hence the Python installed by the 32-bit 
>> > installer 
>> > cannot build new extensions.
> That's a very serious limitation indeed.
I note that Lion EULA now permits use of up to 4 instances of the OS
running in Virutal Machines, so you be able to use OS X (10.6 or 10.5 or
10.4) in a VM (VirtualBox, Parallels, VMWare, etc) to do your PowerPC
builds ??  Maybe over kill, but it's also not a bad way to do some
testing on the target OS :)

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] how to retrieve unique serial number from usb storage device

2011-11-25 Thread Brendan Simon (eTRIX)
Anyone know how to retrieve the unique serial number of a usb storage
device using python on OS X ??

Is there a way to do it using ioreg command ??
My python app currently parses ioreg output to discover VID/PID
combinations, so adding a bit of extra logic to get a usb unique serial
number should be quite easy.

Perhaps pyusb might be of use ??
I have steered away from pyusb in the past as I found it wasn't as
portable when creating app bundles.  i.e. found that compiled libraries
bundled in app would not work on a older version of OS X.  using ioreg
was more portable (for me at the time).

Thanks,
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] how to retrieve unique serial number from usb storage device

2011-11-25 Thread Brendan Simon (eTRIX)
On 26/11/11 12:12 AM, David Hughes wrote:
> On 25/11/2011 11:22, Brendan Simon (eTRIX) wrote:
>> Anyone know how to retrieve the unique serial number of a usb storage
>> device using python on OS X ??
>
> How about using
>
> system_profiler SPUSBDataType

I treid the system_profiler and got the following results when I plugged
a couple of usb flash sticks in.
I couldn't see anything that resembles a unique usb storage device
serial number :(  I think it is supposed to be a 12 digit (hex) number.

Either system_profiler doesn't report it, or these devices don't have
unique serial numbers (unlikely), or I am missing something (not unlikely).

Any thoughts ??


> Composite Device:
>
>   Capacity: 262.1 MB (262,144,000 bytes)
>   Removable Media: Yes
>   Detachable Drive: Yes
>   BSD Name: disk1
>   Product ID: 0x0151
>   Vendor ID: 0x0457  (Silicon Integrated Systems Corp.)
>   Version: 1.00
>   Speed: Up to 480 Mb/sec
>   Location ID: 0xfa13 / 7
>   Current Available (mA): 500
>   Current Required (mA): 98
>   Partition Map Type: MBR (Master Boot Record)
>   S.M.A.R.T. status: Not Supported
>   Volumes:
> USB-DRIVE:
>   Capacity: 261.9 MB (261,865,472 bytes)
>   Available: 124.7 MB (124,735,488 bytes)
>   Writable: Yes
>   File System: MS-DOS FAT16
>   BSD Name: disk1s1
>   Mount Point: /Volumes/USB-DRIVE
>   Content: DOS_FAT_16


> USB HD:
>
>   Capacity: 8.01 GB (8,006,926,336 bytes)
>   Removable Media: Yes
>   Detachable Drive: Yes
>   BSD Name: disk1
>   Product ID: 0x1f00
>   Vendor ID: 0x13fe  (Phison Electronics Corp.)
>   Version: 1.10
>   Speed: Up to 480 Mb/sec
>   Location ID: 0xfa13 / 7
>   Current Available (mA): 500
>   Current Required (mA): 200
>   Partition Map Type: MBR (Master Boot Record)
>   S.M.A.R.T. status: Not Supported
>   Volumes:
> KINGSTON:
>   Capacity: 8 GB (8,002,797,568 bytes)
>   Available: 4.78 GB (4,780,769,280 bytes)
>   Writable: Yes
>   File System: MS-DOS FAT32
>   BSD Name: disk1s1
>   Mount Point: /Volumes/KINGSTON
>   Content: Windows_FAT_32


___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] py2app: argv emulation failing on OS X 10.9 Mavericks

2013-12-18 Thread Brendan Simon (eTRIX)
I have a python app that uses argv emulation with a custom url handler. 
i.e. when my url is clicked in a web page, it opens my app and passes
the url as an argument to the app.

My app works great on OS X 10.4, 10.5, 10.6, 10.7 and 10.8, but fails on
10.9 (Mavericks) :(  No arguments are passed to the app.  I'm use python
2.7.5 and py2app 0.7.3.

Here's the issue on bitbucket.
https://bitbucket.org/ronaldoussoren/py2app/issue/129/mavericks-osx-109-program-argument-passing

Does anyone know what the problem might be and whether there are any
fixes or work arounds ?

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Installing/updating development py2app

2014-01-30 Thread Brendan Simon (eTRIX)
Hi py2app devs,

A little while ago I  installed py2app from development branch to test
fixes on OS X 10.9.  I installed with "python setup.py develop",
including the other development modules that py2app complained about
(version compatibility).

My issue wasn't fixed, but looks like recent commits will fix the
issue.  I pulled the latest revision of py2app.  Do I need to do "python
setup.py develop" again ??  I did so, just to be sure.

The problem seems to have been fixed or improved, but now my application
crashes.  I'm not sure if I need to update the other modules (altgraph,
etc).  Do I need to do that?  Do I need to do "python setup.py develop"
everytime ?

What the best way, or recommend procedure, to try out new py2app commits ?

Thanks, Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] Code signing py2app generated apps

2014-06-07 Thread Brendan Simon (eTRIX)
Is there anything special one needs to do to sign py2app generated apps ?

I've tried:  codesign -s  

but I when verifying it with "codesign -v" I get:

src/dist/SureAnalysis.app: Unknown format in import.
In architecture: i386

The certificate is a .p12 file that was imported with KeyChain.app to
the System destination keychain.

I've read that all binaries and frameworks need to be signed.  Is there
an easy way of doing that ?  Is there a tool to determine which files
need to be signed ?

Thanks,
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] Code signing py2app generated apps

2014-06-08 Thread Brendan Simon (eTRIX)

> On 6/7/14, 9:31 AM, Brendan Simon (eTRIX) wrote:
>> Is there anything special one needs to do to sign py2app generated
>> apps ?
>>
>> I've tried:  codesign -s  
>>
>> but I when verifying it with "codesign -v" I get:
>>
>>  src/dist/SureAnalysis.app: Unknown format in import.
>>  In architecture: i386
>>
>> The certificate is a .p12 file that was imported with KeyChain.app to
>> the System destination keychain.
>
> This works for me:
>
> codesign --deep --signature-size 9400  -f -s "Developer ID
> Application: Kevin Walzer"  cbk/QuickWho.app
>
> I use cx_freeze in this app, not py2app, but this also worked for me
> with py2app.
>
> --Kevin

Tried the above codesign suggestion but I still get the same error =>
Unknown format in import.

The certificate issuer is: DigiCert SHA2 Assured ID Code Signing CA

The app uses python2.7 (32-bit) and wxPython 2.8.12.1 (Carbon). 
Universal bundles with i386 and ppc architectures.

I wonder if building the app to use only 64-bit and/or i386/x86_64
architectures and/or wxPython (Cocoa) would make a difference ?

Thanks for any thoughts :)
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


[Pythonmac-SIG] codesigning py2app/wxPython app failing

2015-08-22 Thread Brendan Simon (eTRIX)
I'm trying to codesign a wxPython app bundle generated with py2app.
(python2.7, wxPython 3.0.2, Intel 64/32-bit, build on 10.10.5, XCode 6.4
installed)

I'm getting the following error:

$ codesign - -f --deep -s dist/.app
dist/.app: code failed to satisfy specified code requirement(s)
In subcomponent:
/dist/.app/Contents/Frameworks/libncursesw.5.dylib

I've read that this can be a problem if a framework is signed, but it
isn't.  Also "codesign -f" is supposed to replace any signed objects
anyway, right?

$ codesign - dist/.app/Contents/Frameworks/libncursesw.5.dylib
dist/.app/Contents/Frameworks/libncursesw.5.dylib: code object is
not signed at all
In architecture: x86_64

For testing, I removed libncursesw.5.lib, but now codesign complains
about dist/.app/Contents/Frameworks/libwx_osx_cocoau-3.0.0.2.0.dylib.

If I remove libwx_osx_cocoau-3.0.0.2.0.dylib, it complains about
dist/.app/Contents/Frameworks/Python.framework.

If I remove Python.framework, it complains about
dist/.app/Contents/MacOS/python

If I remove python, I don't get any errors referencing any files or
directories, but I still get the "code failed to satisyfy specified code
requirement(s)".

$ codesign - -f --deep -s "Sureshot" dist/.app
dist/.app: code failed to satisfy specified code requirement(s)


I set up the following environment variable to resolve a
codesign_allocate error.  There were other codesign_allocate binaries on
my system but this is the only one that seemed to not complain.

export CODESIGN_ALLOCATE="/usr/bin/codesign_allocate"

Any ideas about what is going on and how to resolve this?

Is it a certificate issue perhaps?  I purchased a class2 cert from
sslstart.com.  I was a renewed one and I'm not 100% sure I'm using the
correct private key for the certificate.  Would that cause the above errors?

I've never had any success signing an app.  I get the same errors with
another cert/private key that someone else provided to me (from
www.digicert.com).  KeyChain says that both certs were signed by an
unknown authority.  Could this be the issue?

Thanks for any help.
Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing

2015-08-23 Thread Brendan Simon (eTRIX)
On 23/08/2015 8:00 pm, pythonmac-sig-requ...@python.org wrote:
> Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
> From:
> Kevin Walzer 
> Date:
> 23/08/2015 2:22 pm
>
> To:
> Glyph 
> CC:
> pythonmac-sig@python.org
>
>
> On 8/23/15 12:11 AM, Glyph wrote:
>> I was /going/ to say something about how "codesigning" certificates
>> have different X509 extensions in them, but then I clicked the link
>> to "sslstart.com " and I got redirected to
>> mac-protect dot info (not in URL syntax because it looks to be
>> malware) saw this popup:
>
> I saw that too, but I suspect Brendan simply mistyped the domain.
> startssl.com is a valid CA for codesigning certs, and they have the
> lowest-cost certificates in the business.
Yes that was my bad.  startssl.com is correct.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG


Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing

2015-08-23 Thread Brendan Simon (eTRIX)
On 23/08/2015 8:00 pm, pythonmac-sig-requ...@python.org wrote:
>
> Subject:
> Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
> From:
> Kevin Walzer 
> Date:
> 23/08/2015 1:08 pm
>
> To:
> pythonmac-sig@python.org
>
>
> On 8/22/15 10:44 PM, Brendan Simon (eTRIX) wrote:
>>
>> $ codesign - -f --deep -s dist/.app
>>
> The "deep" flag doesn't work anymore. Pretty much every binary object
> must be signed.
>
> Here's what I use to codesign one of my apps (the specific example is
> Perl, my current Python project is awaiting an update, but I'll roll
> something similar for the Python project).
>
> First I start with the dylibs:
>
> find build/FileMorph.app -type f -name "*.bundle"  -exec codesign
> --verbose --signature-size 9400 -f -s "My Credentials" {} \;
> find build/FileMorph.app -type f -name "*.dylib"  -exec codesign
> --verbose --signature-size 9400 -f -s "My Credentials" {} \;
>
> Next, the frameworks and executables:
>
> codesign  --verbose --signature-size 9400 -f -s "My Credentials"
> build/FileMorph.app/Contents/Frameworks/Tk.framework/Versions/8.6/Resources/Wish.app/Contents/MacOS/Wish
> codesign  --verbose --signature-size 9400 -f -s "My Credentials"
> build/FileMorph.app/Contents/Frameworks/Tk.framework/Versions/Current
> codesign --verbose --signature-size 9400 -f -s "My Credentials"
> build/FileMorph.app/Contents/Frameworks/Tcl.framework/Versions/Current
> codesign  --verbose --signature-size 9400 -f -s "My Credentials"
> build/FileMorph.app/Contents/MacOS/perl
>
> Finally, the app itself:
>
> codesign  --signature-size 9400 -f -s "My Credentials" --verbose=2 
> build/FileMorph.app

Thanks for the help :)  Unfortunately I haven't made any progress :(
I've tried singing some of the binaries and frameworks from a bash
script (and manually) but I still get errors :(



export CODESIGN_ALLOCATE="/usr/bin/codesign_allocate"
#export
CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"

$ find dist/.app -type f -name "*.dylib"

dist/.app/Contents/Frameworks/libncursesw.5.dylib
dist/.app/Contents/Frameworks/libwx_osx_cocoau-3.0.0.2.0.dylib

$ find dist/.app -type f -name "*.dylib" -exec codesign -
--signature-size 9400 -f -s  {} \;

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
for architecture x86_64 object:
/dist/.app/Contents/Frameworks/libncursesw.5.dylib malformed
object (load command 3 cmdsize not a multiple of 8)

dist/.app.app/Contents/Frameworks/libncursesw.5.dylib: code
failed to satisfy specified code requirement(s)
dist/.app.app/Contents/Frameworks/libwx_osx_cocoau-3.0.0.2.0.dylib:
code failed to satisfy specified code requirement(s)

# codesign /Python.framework/Versions/Current/Python

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
for architecture x86_64 object:
/Users/brendan/eclipse-workspaces/sureshotgps/SA-v5.6/src/dist/SureAnalysis-signed-ss.app/Contents/Frameworks/Python.framework/Versions/2.7/Python
malformed object (load command 3 cmdsize not a multiple of 8)

# codesign /Python.framework/Versions/Current

dist/SureAnalysis-signed-ss.app/Contents/Frameworks/Python.framework/Versions/Current/Python:
code failed to satisfy specified code requirement(s)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
for architecture x86_64 object:
/Users/brendan/eclipse-workspaces/sureshotgps/SA-v5.6/src/dist/SureAnalysis-signed-ss.app/Contents/Frameworks/Python.framework/Versions/2.7/Python
malformed object (load command 3 cmdsize not a multiple of 8)

# codesign /Python.framework/Versions/Current

dist/..app/Contents/Frameworks/Python.framework/Versions/Current:
code failed to satisfy specified code requirement(s)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate:
for architecture x86_64 object:
/dist/.app/Contents/MacOS/python malformed object (load
command 10 cmdsize not a multiple of 8)

# codesign /Contents/MacOS/python

dist/SureAnalysis-signed-ss.app/Contents/MacOS/python: code failed to
satisfy specified code requirement(s)

# codesign dist/.app

dist/..app: code object is not signed at all
In subcomponent:
/dist/..app/Contents/Frameworks/libncursesw.5.dylib



Is this a codesign_allocate issue?
The codesign_allocate tool in /usr/bin does NOT ask me for username and
password, however if I use the one in /Applications/Xcode.app/ then a
dialog pops up a number of times asking me for username and password. 
That looks promising by I still get the foll

Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing

2015-08-24 Thread Brendan Simon (eTRIX)
On 24/08/2015 1:23 am, pythonmac-sig-requ...@python.org wrote:
> Subject:
> Re: [Pythonmac-SIG] codesigning py2app/wxPython app failing
> From:
> Kevin Walzer 
> Date:
> 24/08/2015 1:23 am
>
> To:
> pythonmac-sig@python.org
>
>
> On 8/23/15 8:09 AM, Brendan Simon (eTRIX) wrote:
>> Thanks for the help :)  Unfortunately I haven't made any progress :(
>> I've tried singing some of the binaries and frameworks from a bash
>> script (and manually) but I still get errors :(
>
> I don't quite understand codesign_allocate and why you are using it
> instead of codesign, but in my experience setting a signature size,
> i.e. --signature-size 9400, sometimes fixes codesign failures.

I have no idea what codesign_allocate is or why I need it.  I'm not
using codesing_allocate directly.  if the CODESIGN_ALLOCATE env var is
not set, then codesign complains about not being able to find or use the
helper tool.

dist/.app/Contents/Frameworks/libncursesw.5.dylib: the
codesign_allocate helper tool cannot be found or used

Is this not normal?  Maybe there is something screwy with my OS X system
or Xcode install?

Interestingly, the man page for codesign does not menthod the
--signature-size option, but codesign doesn't complain about it.

Brendan.

___
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG