On 5/3/2010 12:04 AM, Tim Diggins wrote:
        Two additional questions (not related to wx, only to mac):

        1) The .app is getting made (it seems to me) in the wrong
        location: It
        should be made in the "dist" directory (as it is a distributable);
        however, it is being made one directory ABOVE the project
        directory so I
        do the following after the build:
        mv ../PROJECT.app dist/PROJECT.app


    This is a bug of the BUNDLE() class in Build.py. More generically,
    all classes exported to the .spec usually allow the spec itself to
    specify the full path of the resulting file (or directory, in this
    case), so BUNDLE() should probably be modified to receive the
    directory name as argument, and the spec should then be generated so
    to use os.path.join("dist", "foobar.app").


Ok -- changing the BUNDLE() class was very easy. (attached patch).
If you accept that it would mean (for now) that page
http://www.pyinstaller.org/wiki/MacOsCompatibility should change the
code at the bottom to:

    *

      import  sys
      if  sys.platform.startswith("darwin"):
           app=  BUNDLE(exe,
                        *name**=*os.path.join('dist','NAME.app'),
                        version=version)

  I haven't made any attempt to adapt to previous use of the appname
keyword argument as specified currently on that page.


Thanks. I have applied the (amended) patch in [837]. I have also updated the wiki page.


        2) I'm keen to use the onedir, as that makes some things easier (and
        onefile brings no benefits that I can see).
        At present I'm just moving dist/PROJECT/* to
        dist/PROJECT.app/Contents/MacOS/
        but it would be better to try to fix the situation for MacOS -
        shall I
        have a look and see if I can solve #155 in the source, following
        your
        comments?


    Sure! It really should not be difficult. Have a look at how
    COLLECT() copies files around, and do something like that for BUNDLE().


Ok... I can see how that works in the code. I'm wondering what the spec
file should look like... Won't the BUNDLE call end up looking almost
identical to the COLLECT call?

Maybe it would be better to pass the result of the COLLECT call to the
BUNDLE call? Or perhaps make the BUNDLE function a superset of the
COLLECT functionality (but just degrading to COLLECT on other platforms).

Well, from a semantic point of view, BUNDLE() should do more than COLLECT(): not only it would create any special file required (.plist, etc.) but it would also know the internal structure of the BUNDLE(), so to be able to move files into the correct subdirectory.

So, I would go with a totally different class (just like it is now) and then maybe you can internally reuse some code between the two.

When I look at the spec file generated for the Mac at present there is
some platform specificity, like:
     exe = EXE(pyz,
           a.scripts,
           exclude_binaries=1,
           name=os.path.join('build*/pyi.darwin/small_app'*, 'small_app'),
           ...

Yes, the platform name should be removed. I think the best solution is to have Makespec.py generate something like "pyi.$PLATFORM" and then substitute that within EXE().

Also, on Windows, Makespec generates "small_app.exe". That's wrong as well: the extension should be appended later. This modification needs to be backward compatible with existing spec files, so it should first check if there's already an .exe extension just in case.

and platform variability, like:
     if *sys.platform.startswith("darwin")*:
         app = BUNDLE(exe,
         ...

I was planning to have BUNDLE() to be a no-op on the other platforms. I would even rename it as MACBUNDLE(), to make it more clear.

It seems to me it might be better to put as much of the platform
variability into the pyinstaller code itself...

Absolutely! Spec file should absolutely be platform-independent, so that one can use the same spec file for the same project on all platforms.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com

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