Steven Palm
2003-12-09 04:32:25 UTC
Okay, I've managed to get a Macintosh bundle built that runs on a
system other than my own (although only tested on two Panther (10.3)
systems).
only places I found them.
Also, here is the macbuild.py script I used (stealing enough from
distbuild.py to make it work):
import bundlebuilder, os, glob
packageroot = "/Users/n9yty/my_cvs/bitpim/bitpim"
myapp = bundlebuilder.AppBuilder(verbosity=1)
myapp.mainprogram = os.path.join(packageroot, "bp.py")
myapp.standalone = 1
myapp.name = "bitpim"
myapp.strip = 1
myapp.includePackages.append("sha")
exts=[ '*.xy', '*.png', '*.ttf', '*.wav', '*.jpg', '*.css', '*.htb',
'*.pdc' ]
for wildcard in exts:
for file in glob.glob(os.path.join(packageroot, 'resources',
wildcard)):
myapp.files.append( (file, os.path.join("Contents",
"Resources", 'resources', os.path.basename(file))) )
for file in glob.glob(os.path.join(packageroot, 'com_*.py')):
myapp.resources.append(file)
myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.dylib")
myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.rsrc")
myapp.libs.append("/usr/local/lib/libwx_mac_gl-2.4.0.dylib")
myapp.setup()
myapp.build()
There is, undoubtedly, a cleaner way, and this could likely be
integrated into distbuild.py. The odd line in there (for me) is the
myapp.files.append() bit which takes a tuple specifying the file to
add, and the path inside the MacOS X bundle to put it. I'm sure that
makes perfect sense to someone used to tuples. :^)
The downside is that since this bundles the libwx_mac_* and wxPython
shared libraries as well as the bitpim stuff, it weights in at just
over 16MB. But it *IS* a drag-n-drop install application.
-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--
system other than my own (although only tested on two Panther (10.3)
systems).
Looking at the bitpim source, my guess is that this line is causing
resourcedirectory=os.path.abspath(os.path.join(os.path.dirname(sys.argv
[0]), 'resources'))
Using sys.argv like this can cause problems on OS X, which sends some
extra args in when launched from the Finder. I'd suggest trying it
resourcedirectory=os.path.abspath(os.path.join(sys.path[0]),
'resources'))
That is how I determine the root directory of my program, which runs
on Windows, Linux and Mac.
I made the changes outlined above in guihelper.py and bpaudio.py, theresourcedirectory=os.path.abspath(os.path.join(os.path.dirname(sys.argv
[0]), 'resources'))
Using sys.argv like this can cause problems on OS X, which sends some
extra args in when launched from the Finder. I'd suggest trying it
resourcedirectory=os.path.abspath(os.path.join(sys.path[0]),
'resources'))
That is how I determine the root directory of my program, which runs
on Windows, Linux and Mac.
only places I found them.
Also, here is the macbuild.py script I used (stealing enough from
distbuild.py to make it work):
import bundlebuilder, os, glob
packageroot = "/Users/n9yty/my_cvs/bitpim/bitpim"
myapp = bundlebuilder.AppBuilder(verbosity=1)
myapp.mainprogram = os.path.join(packageroot, "bp.py")
myapp.standalone = 1
myapp.name = "bitpim"
myapp.strip = 1
myapp.includePackages.append("sha")
exts=[ '*.xy', '*.png', '*.ttf', '*.wav', '*.jpg', '*.css', '*.htb',
'*.pdc' ]
for wildcard in exts:
for file in glob.glob(os.path.join(packageroot, 'resources',
wildcard)):
myapp.files.append( (file, os.path.join("Contents",
"Resources", 'resources', os.path.basename(file))) )
for file in glob.glob(os.path.join(packageroot, 'com_*.py')):
myapp.resources.append(file)
myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.dylib")
myapp.libs.append("/usr/local/lib/libwx_mac-2.4.0.rsrc")
myapp.libs.append("/usr/local/lib/libwx_mac_gl-2.4.0.dylib")
myapp.setup()
myapp.build()
There is, undoubtedly, a cleaner way, and this could likely be
integrated into distbuild.py. The odd line in there (for me) is the
myapp.files.append() bit which takes a tuple specifying the file to
add, and the path inside the MacOS X bundle to put it. I'm sure that
makes perfect sense to someone used to tuples. :^)
The downside is that since this bundles the libwx_mac_* and wxPython
shared libraries as well as the bitpim stuff, it weights in at just
over 16MB. But it *IS* a drag-n-drop install application.
-. ----. -.-- - -.--
Steve Palm - ***@n9yty.com
-. ----. -.-- - -.--