File: make_wb_bundle.py

package info (click to toggle)
svn-workbench 1.5.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,400 kB
  • ctags: 1,585
  • sloc: python: 12,163; sh: 74; makefile: 46; ansic: 9
file content (87 lines) | stat: -rw-r--r-- 2,778 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
# make_wb_bundle.py
#
import bundlebuilder
import sys

# make sure that we get 2.6 and not an earlier version
if not hasattr(sys, 'frozen'):
    import wxversion
    wxversion.select('2.6')

import wx
import os
import traceback

try:
    # workbench sources
    sys.path.append( '../../Source' )
    # the pysvn package
    sys.path.append( '../../../Extension/Source' )

    # Create the AppBuilder
    myapp = bundlebuilder.AppBuilder (verbosity=1)

    # Tell it where to find the main script - the one that loads on startup
    myapp.mainprogram = '../../Source/wb_main.py'
    myapp.standalone = 1
    myapp.name = 'WorkBench.app'
    myapp.iconfile = '../../Source/wb.icns'

    # create the bundle here
    myapp.builddir = sys.argv[1]

    # includePackages forces certain packages to be added to the app bundle
    #myapp.includePackages.append("Menu")

    # Here you add supporting files and/or folders to your bundle
    #myapp.resources.append(os.path.join(packageroot,"icons" ))

    # bundlebuilder does not yet have the capability to detect what shared  libraries
    # are needed by your app - so in this case I am adding the wxPython  libs manually

    wx_ver = '%d.%d.%d.%d%s' % wx.VERSION
    wx_3ver = '%d.%d.%d' % wx.VERSION[0:3]
    wx_2ver = '%d.%d.0' % wx.VERSION[0:2]

    for libname_fmt in [
            "/usr/local/lib/wxPython-unicode-%s/lib/libwx_macud-%s.dylib",
            "/usr/local/lib/wxPython-unicode-%s/lib/libwx_macud_gl-%s.dylib",
            "/usr/local/lib/wxPython-unicode-%s/lib/libwx_macud_gizmos-%s.dylib",
            "/usr/local/lib/wxPython-unicode-%s/lib/libwx_macud_stc-%s.dylib",
            ]:
        for args in [(wx_ver, wx_3ver),(wx_ver, wx_2ver)]:
            lib_found = False
            libname = libname_fmt % args
            if os.path.exists( libname ):
                print 'Info: Manually adding lib %s' % libname
                myapp.libs.append( libname )
                lib_found = True
        if not lib_found:
            raise ValueError( 'Cannot find lib %s' % libname )

    # add in libs from Fink
    if os.path.exists( '/sw' ):
        for libname in [
                "/sw/lib/libintl.3.dylib",
                "/sw/lib/libiconv.2.dylib",
                ]:
            print 'Info: Manually adding lib %s' % libname
            myapp.libs.append( libname )
    if os.path.exists( '/opt/local' ):
        for libname in [
                "/opt/local/lib/libapr-1.0.dylib",
                "/opt/local/lib/libz.1.dylib",
                ]:
            print 'Info: Manually adding lib %s' % libname
            myapp.libs.append( libname )

    # Here we build the app!
    myapp.setup()
    myapp.build()

except:
    traceback.print_exc( file=sys.stderr )
    sys.exit( 1 )

sys.exit( 0 )