﻿# Setup file for the NodeBox OS X application.
#
# You can create the application by running:
#
#     python macsetup.py py2app -A
#
# This creates a linked distribution, so changes to the python files only require you to restart the application.
# This is the preferred way to develop.
# To create a full distribution, use the macbuild.sh shell script to pull in all the right files.

from distutils.core import setup
import py2app

from setup import *

all_modules = ['__future__', '_LWPCookieJar', '_MozillaCookieJar', '_strptime', '_threading_local', 'aifc', 'asynchat', 'asyncore', 'atexit', 'audiodev', 'base64', 'BaseHTTPServer', 'Bastion', 'binhex', 'bisect', 'calendar', 'cgi', 'CGIHTTPServer', 'cgitb', 'chunk', 'cmd', 'code', 'codecs', 'codeop', 'colorsys', 'commands', 'compileall', 'ConfigParser', 'contextlib', 'Cookie', 'cookielib', 'copy', 'copy_reg', 'cProfile', 'csv', 'dbhash', 'decimal', 'difflib', 'dircache', 'dis', 'doctest', 'DocXMLRPCServer', 'dumbdbm', 'dummy_thread', 'dummy_threading', 'filecmp', 'fileinput', 'fnmatch', 'formatter', 'fpformat', 'ftplib', 'functools', 'getopt', 'getpass', 'gettext', 'glob', 'gopherlib', 'gzip', 'hashlib', 'heapq', 'hmac', 'htmlentitydefs', 'htmllib', 'HTMLParser', 'httplib', 'ihooks', 'imaplib', 'imghdr', 'imputil', 'inspect', 'keyword', 'linecache', 'locale', 'macpath', 'macurl2path', 'mailbox', 'mailcap', 'markupbase', 'md5', 'mhlib', 'mimetools', 'mimetypes', 'MimeWriter', 'mimify', 'modulefinder', 'multifile', 'mutex', 'netrc', 'new', 'nntplib', 'ntpath', 'nturl2path', 'opcode', 'optparse', 'os', 'os2emxpath', 'pdb', 'pickle', 'pickletools', 'pipes', 'pkgutil', 'platform', 'popen2', 'poplib', 'posixfile', 'posixpath', 'pprint', 'profile', 'pstats', 'pty', 'py_compile', 'pyclbr', 'pydoc', 'Queue', 'quopri', 'random', 're', 'repr', 'rexec', 'rfc822', 'rlcompleter', 'robotparser', 'runpy', 'sched', 'sets', 'sgmllib', 'sha', 'shelve', 'shlex', 'shutil', 'SimpleHTTPServer', 'SimpleXMLRPCServer', 'site', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'SocketServer', 'sre', 'sre_compile', 'sre_constants', 'sre_parse', 'stat', 'statvfs', 'string', 'StringIO', 'stringold', 'stringprep', 'struct', 'subprocess', 'sunau', 'sunaudio', 'symbol', 'symtable', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'textwrap', 'this', 'threading', 'timeit', 'toaiff', 'token', 'tokenize', 'trace', 'traceback', 'tty', 'types', 'unittest', 'urllib', 'urllib2', 'urlparse', 'user', 'UserDict', 'UserList', 'UserString', 'uu', 'uuid', 'warnings', 'wave', 'weakref', 'webbrowser', 'whichdb', 'xdrlib', 'xmllib', 'xmlrpclib', 'zipfile']

all_packages = ['bsddb', 'compiler', 'ctypes', 'curses', 'distutils', 'email', 'encodings', 'idlelib', 'hotshot', 'logging', 'sqlite3', 'wsgiref', 'xml']

# lib-dynload
all_modules += ['ColorPicker', 'MacOS', 'Nav', 'OSATerminology', '_AE', '_AH', '_App', '_CF', '_CG', '_CarbonEvt', '_Cm', '_Ctl', '_Dlg', '_Drag', '_Evt', '_File', '_Fm', '_Folder', '_Help', '_IBCarbon', '_Icn', '_Launch', '_List', '_Menu', '_Mlte', '_OSA', '_Qd', '_Qdoffs', '_Qt', '_Res', '_Scrap', '_Snd', '_TE', '_Win', '_bisect', '_bsddb', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_csv', '_ctypes', '_ctypes_test', '_curses', '_curses_panel', '_elementtree', '_functools', '_hashlib', '_heapq', '_hotshot', '_locale', '_lsprof', '_multibytecodec', '_random', '_sha256', '_sha512', '_socket', '_sqlite3', '_ssl', '_struct', '_testcapi', '_tkinter', '_weakref', 'array', 'audioop', 'autoGIL', 'binascii', 'bsddb185', 'bz2', 'cPickle', 'cStringIO', 'cmath', 'collections', 'crypt', 'datetime', 'dbm', 'dl', 'fcntl', 'gestalt', 'grp', 'icglue', 'imageop', 'itertools', 'math', 'mmap', 'nis', 'operator', 'parser', 'pyexpat', 'readline', 'resource', 'rgbimg', 'select', 'strop', 'syslog', 'termios', 'time', 'unicodedata', 'zlib']

# lib-tk
all_modules += ['Canvas', 'Dialog', 'FileDialog', 'FixTk', 'ScrolledText', 'SimpleDialog', 'Tix', 'Tkconstants', 'Tkdnd', 'Tkinter', 'tkColorChooser', 'tkCommonDialog', 'tkFileDialog', 'tkFont', 'tkMessageBox', 'tkSimpleDialog', 'turtle']

# plat-mac
all_modules += ['Audio_mac', 'EasyDialogs', 'FrameWork', 'MiniAEFrame', 'PixMapWrapper', 'aepack', 'aetools', 'aetypes', 'applesingle', 'appletrawmain', 'appletrunner', 'argvemulator', 'bgenlocations', 'buildtools', 'bundlebuilder', 'cfmfile', 'findertools', 'gensuitemodule', 'ic', 'icopen', 'macerrors', 'macfs', 'macostools', 'macresource', 'pimp', 'plistlib', 'terminalcommand', 'videoreader']
all_packages += ['Carbon', 'CodeWarrior', 'Explorer', 'Finder', 'Netscape', 'StdSuites', 'SystemEvents', 'Terminal']



plist = dict(
    CFBundleDocumentTypes = [
        dict(
            CFBundleTypeExtensions = ["py"],
            CFBundleTypeName = "Python Source File",
            CFBundleTypeRole = "Editor",
            NSDocumentClass = "NodeBoxDocument",
            CFBundleTypeIconFile = "NodeBoxFile.icns",
        ),
    ],
    CFBundleIconFile = NAME + '.icns',
    CFBundleName = NAME,
    CFBundleShortVersionString = VERSION,
    CFBundleVersion='',
    CFBundleGetInfoString= VERSION,
    CFBundleExecutable = NAME,
    LSMinimumSystemVersion = "10.4.0",
    CFBundleIdentifier = 'net.nodebox.NodeBox',
    CFBundleSignature = 'ndbx',
    CFBundleInfoDictionaryVersion=VERSION,
    NSHumanReadableCopyright= u'Copyright © 2003-2007 NodeBox. All Rights Reserved.',
    CFBundleHelpBookFolder='NodeBox Help',
    CFBundleHelpBookName='NodeBox Help',
    NSAppleScriptEnabled='YES',
    OSAScriptingDefinition='NodeBox.sdef',
)

if __name__=='__main__':

    setup(name = NAME,
        version = VERSION,
        data_files = [
            'Resources/English.lproj',
            'Resources/Credits.rtf',
            'Resources/NodeBox.icns',
            'Resources/NodeBoxFile.icns',
            'Resources/NodeBox.sdef',
        ],
        app = [dict(script='macboot.py', plist=plist)],
        options = dict(py2app=dict(
            includes = ['DrawingPrimitives', 'Numeric'] + all_modules,
            packages = all_packages,
            site_packages = True,
            optimize = 2,
        )),
    )
