I've used py2app for many years and have really appreciated how it makes it
so easy to distribute my app.  I'm now running into problems and would
appreciate suggestions for how to debug.  My setup:
-- Snow Leopard
-- 32-bit Python 2.7 from python.org
-- py2app 6.3
-- only external package is wxPython 2.8.12.0 (32-bit, Carbon, unicode)

The changes from my last successful use of py2app six months ago are (1)
moving from python 2.6 to python 2.7; (2) upgrading to latest py2app (don't
know what I had before but I think it was at least a couple years old); and
(3) changes to my python code that should not be significant.

When I do
    python setup.mac.py py2app
everything seems to operate fine.  Stuff gets copied to build dir, creates
app bundle, stripping, etc...  (Tried this both with and without -A).

When I run out of the dist dir:
    $ ./dist/OpenSTV.app/Contents/MacOS/OpenSTV
I get
    Bus error
with a dump.

I don't know where to begin debugging this and would greatly appreciate
pointers.  My setup.mac.py is copied below and also the dump that OS X
provides.  Note that my setup is a little complicated because I use
__import__ and have to explicitly list the stuff that is being imported that
way.

Jeff

==== setup.mac.py ====
import sys
import os
import glob
import shutil
import pkgutil
from setuptools import setup

from openstv.version import v as OpenSTV_version

# Remove the build and dist folders
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("dist", ignore_errors=True)

# generic arguments for setup()
name = "OpenSTV"
description = "Implements the single transferable vote, instant runoff "\
              "voting, and several other voting systems."
author = "Jeff O'Neill"
author_email = "jeff.one...@example.org"
url = "http://www.openstv.org";
license = "OpenSTV EULA"

packages = ["openstv",
            "openstv.MethodPlugins",
            "openstv.LoaderPlugins",
            "openstv.ReportPlugins"]

data_files = [ ("", ["openstv/Help.html",
                     "openstv/License.html"]),
               ("Icons",
                 ["openstv/Icons/pie.ico",
                  "openstv/Icons/blt.ico",
                  "openstv/Icons/splash.png"]) ]

# Get list of plugins because they won't be automatically included
includes = []
pluginPackageNames = ["openstv.MethodPlugins", "openstv.LoaderPlugins",
                      "openstv.ReportPlugins"]
for x in pluginPackageNames:
    package = __import__(x, fromlist="dummy")
    ppath = package.__path__
    pname = package.__name__ + "."
    for importer, modname, ispkg in pkgutil.iter_modules(ppath, pname):
        includes.append(modname)

if sys.platform == "darwin":
    #
    # Usage: ./setup.py
    #
    # py2app options
    plist = {
        "CFBundleDocumentTypes":
            [{"CFBundleTypeName": "OpenSTV ballot file",
             "CFBundleTypeIconFile": "blt.icns",
             "CFBundleTypeExtensions": ["blt", "txt"],
             "CFBundleTypeRole": "Viewer"}]
    }
    py2app_options = dict(
        includes = includes,
        plist = plist,
        iconfile = 'openstv/Icons/pie.icns',
        no_strip = 0,
    )
    setup(name = name,
          script_name = 'setup.py',
          script_args = ['py2app'],
          version = OpenSTV_version,
          description = description,
          author = author,
          author_email = author_email,
          url = url,
          license = license,
          packages = packages,
          data_files = data_files,
          options = dict(py2app = py2app_options),
          scripts = ['openstv/OpenSTV.py'],
          app = ['openstv/OpenSTV.py'],
          setup_requires = ["py2app"],
          )
    os.system("hdiutil create -ov -imagekey zlib-level=9 -srcfolder
dist/OpenSTV.app dist/OpenSTV.dmg")


==== Dump ====
Process:         OpenSTV [1299]
Path:
/Users/joneill/OpenSTV/OpenSTV/dist/OpenSTV.app/Contents/MacOS/OpenSTV
Identifier:      OpenSTV
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  bash [466]

Date/Time:       2011-06-05 21:15:26.454 -0400
OS Version:      Mac OS X 10.6.7 (10J869)
Report Version:  6

Interval Since Last Report:          1290371 sec
Crashes Since Last Report:           17
Per-App Crashes Since Last Report:   16
Anonymous UUID:                      4449D1E2-549A-4752-9ACA-F453FB09A892

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: copy


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                   0x953caedb objc_msgSend + 27
1   com.apple.CoreFoundation          0x9387f8ee cacheBundleInfo + 190
2   com.apple.CoreFoundation          0x9387f82d _CFAppVersionCheckLessThan
+ 157
3   com.apple.CoreFoundation          0x93879704 __CFInitialize + 2004
4   dyld                              0x8fe0ee40
ImageLoaderMachO::doImageInit(ImageLoader::LinkContext const&) + 154
5   dyld                              0x8fe0ee74
ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 30
6   dyld                              0x8fe0d31e
ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&,
unsigned int) + 246
7   dyld                              0x8fe0d3d1
ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 61
8   dyld                              0x8fe0200b
dyld::runInitializers(ImageLoader*) + 34
9   dyld                              0x8fe0b299 dlopen + 558
10  libSystem.B.dylib                 0x94128848 dlopen + 66
11  ...thonmac.unspecified.OpenSTV    0x00005a9f main + 63
12  ...thonmac.unspecified.OpenSTV    0x000017e2 start + 258
13  ...thonmac.unspecified.OpenSTV    0x00001709 start + 41

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00103bc0  ebx: 0x93880964  ecx: 0x918f3858  edx: 0x001012f0
  edi: 0x00000000  esi: 0x00103bc0  ebp: 0xbfffefe8  esp: 0xbfffef94
   ss: 0x0000001f  efl: 0x00010206  eip: 0x953caedb   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x00000000

Binary Images:
    0x1000 -     0x6ff7 +org.pythonmac.unspecified.OpenSTV (
    1,
    9,
    0
) ((
    1,
    9,
    0
)) <62637566-0890-030C-A884-540872ADC1F3>
/Users/joneill/OpenSTV/OpenSTV/dist/OpenSTV.app/Contents/MacOS/OpenSTV
0x8fe00000 - 0x8fe4162b  dyld 132.1 (???)
<A4F6ADCC-6448-37B4-ED6C-ABB2CD06F448> /usr/lib/dyld
0x9236a000 - 0x92378fe7  libz.1.dylib 1.2.3 (compatibility 1.0.0)
<3CE8AA79-F077-F1B0-A039-9103A4A02E92> /usr/lib/libz.1.dylib
0x93877000 - 0x939f2fe7  com.apple.CoreFoundation 6.6.4 (550.42)
<C78D5079-663E-9734-7AFA-6CE79A0539F1>
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
0x93e1b000 - 0x93e61ff7  libauto.dylib ??? (???)
<29422A70-87CF-10E2-CE59-FEE1234CFAAE> /usr/lib/libauto.dylib
0x94121000 - 0x942c8ff7  libSystem.B.dylib 125.2.10 (compatibility 1.0.0)
<ADF8138B-2384-2FC0-CCBF-C4721B53568A> /usr/lib/libSystem.B.dylib
0x94fe6000 - 0x94fe9fe7  libmathCommon.A.dylib 315.0.0 (compatibility 1.0.0)
<1622A54F-1A98-2CBE-B6A4-2122981A500E> /usr/lib/system/libmathCommon.A.dylib
0x953c5000 - 0x95472fe7  libobjc.A.dylib 227.0.0 (compatibility 1.0.0)
<DF8E4CFA-3719-3415-0BF1-E8C5E561C3B1> /usr/lib/libobjc.A.dylib
0x97cc9000 - 0x97d33fe7  libstdc++.6.dylib 7.9.0 (compatibility 7.0.0)
<411D87F4-B7E1-44EB-F201-F8B4F9227213> /usr/lib/libstdc++.6.dylib
0x990fa000 - 0x9927cfe7  libicucore.A.dylib 40.0.0 (compatibility 1.0.0)
<D375C1CF-C88D-C5F6-3C49-CD429023FBAC> /usr/lib/libicucore.A.dylib
0xffff0000 - 0xffff1fff  libSystem.B.dylib ??? (???)
<ADF8138B-2384-2FC0-CCBF-C4721B53568A> /usr/lib/libSystem.B.dylib

_________________________________________________________
OpenSTV -- Software for ranked-choice and preferential voting systems
http://www.OpenSTV.org
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to