Hello all,

So i'm trying to do an enthought hook.
I've staretd to read doc on hook.
So far I've managed to have a hook-enthought file and the hook is triggered
by my script:

print "in enthought hook!"
def hook(mod):
    import enthought
    if hasattr(enthought, "__path__"):
        import sys
        for p in enthought.__path__:
            sys.path.insert(1,p)
    print sys.path
    return mod

First thing I've done is to add all enthougth package to system path.
But now I don't understand what is next phase.

1/pyinstaller see "from enthought.mayavi.core.ui.api import MayaviScene, ...
"
2/pyinstaller start to scan 'enthought.mayavi'
So it call analyse_r('enthought.mayavi') that call analyse_one('enthought')
and the hook is triggered.

So what is the next step?
What should I do so pyinstaller will bundle the needed file of my app?

I've seen distutils hooks:
def hook(mod):
    import distutils
    if hasattr(distutils, "distutils_path"):
        import os
        import marshal
        mod_path = os.path.join(distutils.distutils_path, "__init__.pyc")
        parsed_code = marshal.loads(open(mod_path, "r").read()[8:])
        mod.__init__('distutils', mod_path, parsed_code)
    return mod

But I don't really understand marshall etc...

The thing I've seen is that every path in enthought.__path__ contains a
__init__.py, so I suspect I need to do something with them?

Thx for any help!

Laurent

-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De
la part de Antonio Valentino
Envoyé : mercredi 13 janvier 2010 10:58
À : PyInstaller
Objet : [PyInstaller] Re: Now having even more fun.

Hi Laurent,

On Jan 13, 10:29 am, Laurent Dufrechou <[email protected]>
wrote:
> Hi antonio,
>
> I saw your previous emails on the subject :) Can you send me the work 
> you did before on hooks?

Unfortunately I don't remember if i saved it.
I should look in my backups at home.

Anyway I can say that there was a hierarchy of hooks for all enthought
components (at leas all the one I was interested in).
As a starting point for my hooks I used

http://www.pyinstaller.org/browser/trunk/hooks/hook-PIL.Image.py
http://www.pyinstaller.org/browser/trunk/hooks/shared_PIL_Image.py

If I remember well I also added some machinery for backend selection.

> To be honest I'm very newbie with hook mechnism, so it will help me a lot!
>
> For point 3, don't know if it is related to patch in ticket39, but 
> currently, manifest are currently well handled so far on my platform 
> (python26/win32).

Please look at

http://groups.google.com/group/pyinstaller/browse_thread/thread/cffcb4ccb024
1b75/cd2226f0f941c618?hl=en&lnk=gst&q=valentino#cd2226f0f941c618

--
Antonio Valentino

-- 
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.

Reply via email to