Sebastian/pyinstaller devs:

I think I have a solution, albeit not the most elegant one.  Perhaps one of
the devs that has better knowledge of the workings of pyinstaller during
the hooking phase can make this less ugly.

I have attached files that can be put in the buildtests/libraries directory
(the test_* files), and two files that must be placed in the
PyInstaller/hooks directory.

The ugliness of it is that it detects usage of "import setuparg1" by
setting an attribute into sys so that it can be detected later which path
to add when pubsub is imported later.  The correct path (core/arg1 or
core/kwargs) must be added (and only the correct one) depending on whether
or not setuparg1 has been imported.  A little embarassing, but it does work
on both of the buildtests that are attached.

Thanks Sebastian for providing the framework for the build test, and other
credit goes to whoever posted the first hook over in the trac for ticket
http://www.pyinstaller.org/ticket/312



On Mon, Dec 12, 2011 at 3:05 PM, Sebastian Hilbert <
[email protected]> wrote:

> On Monday, December 12, 2011 02:22:42 PM Giovanni Bajo wrote:
>
> Hi,
>
> > Hi Sebastian,
> >
> > can you please attach to the ticket a small source code that reproduces
> > the issue?
>
> See code below. It is an example taken from
> wiki.wxpython.org/WxLibPubSub
>
> ======================================
>
>
> # first line below is necessary only in wxPython 2.8.11.0 since default
> # API in this wxPython is pubsub version 1 (expect later versions
> # of wxPython to use the kwargs API by default)
> from wx.lib.pubsub import setupkwargs
>
> # regular pubsub import
> from wx.lib.pubsub import pub
>
> class SomeReceiver(object):
>  def __init__(self):
>    pub.subscribe(self.__onObjectAdded, 'object.added')
>
>  def __onObjectAdded(self, data, extra1, extra2=None):
>    # no longer need to access data through message.data.
>    print 'Object', repr(data), 'is added'
>    print extra1
>    if extra2:
>        print extra2
>
>
> a = SomeReceiver()
> pub.sendMessage('object.added', data=42, extra1='hello!')
> pub.sendMessage('object.added', data=42, extra1='hello!', extra2=[2, 3, 5,
> 7,
> 11, 13, 17, 19, 23])
>
> =============================
>
> I cannot make it freeze on pyinstaller 1.5.1
>
> Here is the spec file created by pyinstaller's MakeSpec
>
> =============================
>
> # -*- mode: python -*-
> a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'),
> os.path.join(HOMEPATH,'support\\useUnicode.py'), 'c:
> \\Temp\\pubsub\\pubsub.py'],
>             pathex=['C:\\Temp\\pubsub'])
> pyz = PYZ(a.pure)
> exe = EXE(pyz,
>          a.scripts,
>          exclude_binaries=1,
>          name=os.path.join('build\\pyi.win32\\pubsub', 'pubsub.exe'),
>          debug=False,
>          strip=False,
>          upx=False,
>          console=True )
> coll = COLLECT( exe,
>               a.binaries,
>               a.zipfiles,
>               a.datas,
>               strip=False,
>               upx=False,
>               name=os.path.join('dist', 'pubsub'))
>
> ============================
>
> Once this properly freezes I could have a look at the GNUmed specific bits.
>
> wxpython is 2.8.12.1 for python 2.7
>
> Your help is appreciated.
>
> Sebastian
>
> --
> You received this message because you are subscribed to the Google Groups
> "PyInstaller" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pyinstaller?hl=en.
>
>


-- 
Daniel Hyams
[email protected]

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

Attachment: hook-wx.lib.pubsub.core.py
Description: Binary data

Attachment: hook-wx.lib.pubsub.setuparg1.py
Description: Binary data

Attachment: test_wxpubsub_arg1.py
Description: Binary data

Attachment: test_wxpubsub_arg1.spec
Description: Binary data

Attachment: test_wxpubsub_kwargs.py
Description: Binary data

Attachment: test_wxpubsub_kwargs.spec
Description: Binary data

Reply via email to