summaryrefslogtreecommitdiff
path: root/Mac/scripts/buildappbundle.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 +0000
committerJack Jansen <jack.jansen@cwi.nl>2003-11-19 14:34:18 +0000
commit28ecf70db57828db2ca279643bf9aeca7662f35c (patch)
tree09b7767bbc411f85313b58d6fe7e5e67d9392973 /Mac/scripts/buildappbundle.py
parent6045b9c93511c767f6cfa2d2fa299c76181acd9b (diff)
downloadcpython-git-28ecf70db57828db2ca279643bf9aeca7662f35c.tar.gz
Getting rid of support for MacOS9 and earlier. This is the first step,
and the biggest in size, but probably the easiest. Hunting through the source code comes next.
Diffstat (limited to 'Mac/scripts/buildappbundle.py')
-rwxr-xr-xMac/scripts/buildappbundle.py104
1 files changed, 0 insertions, 104 deletions
diff --git a/Mac/scripts/buildappbundle.py b/Mac/scripts/buildappbundle.py
deleted file mode 100755
index 281c6fea6d..0000000000
--- a/Mac/scripts/buildappbundle.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#! /usr/bin/env python
-
-# XXX This will be replaced by a main program in Mac/Lib/bundlebuilder.py,
-# but for now this is kept so Jack won't need to change his scripts...
-
-
-"""\
-buildappbundle creates an application bundle
-Usage:
- buildappbundle [options] executable
-Options:
- --output o Output file; default executable with .app appended, short -o
- --link Symlink the executable instead of copying it, short -l
- --plist file Plist file (default: generate one), short -p
- --nib file Main nib file or lproj folder for Cocoa program, short -n
- --resource r Extra resource file to be copied to Resources, short -r
- --creator c 4-char creator code (default: '????'), short -c
- --verbose increase verbosity level (default: quiet), short -v
- --help This message, short -? or -h
-"""
-
-
-import sys
-import os
-import getopt
-from bundlebuilder import AppBuilder
-from plistlib import Plist
-
-
-def usage():
- print __doc__
- sys.exit(1)
-
-
-def main():
- output = None
- symlink = 0
- creator = "????"
- plist = None
- nib = None
- resources = []
- verbosity = 0
- SHORTOPTS = "o:ln:r:p:c:v?h"
- LONGOPTS=("output=", "link", "nib=", "resource=", "plist=", "creator=", "help",
- "verbose")
- try:
- options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS)
- except getopt.error:
- usage()
- if len(args) != 1:
- usage()
- executable = args[0]
- for opt, arg in options:
- if opt in ('-o', '--output'):
- output = arg
- elif opt in ('-l', '--link'):
- symlink = 1
- elif opt in ('-n', '--nib'):
- nib = arg
- elif opt in ('-r', '--resource'):
- resources.append(arg)
- elif opt in ('-c', '--creator'):
- creator = arg
- elif opt in ('-p', '--plist'):
- plist = arg
- elif opt in ('-v', '--verbose'):
- verbosity += 1
- elif opt in ('-?', '-h', '--help'):
- usage()
- if output is not None:
- builddir, bundlename = os.path.split(output)
- else:
- builddir = os.curdir
- bundlename = None # will be derived from executable
- if plist is not None:
- plist = Plist.fromFile(plist)
-
- builder = AppBuilder(name=bundlename, executable=executable,
- builddir=builddir, creator=creator, plist=plist, resources=resources,
- symlink_exec=symlink, verbosity=verbosity)
-
- if nib is not None:
- resources.append(nib)
- nibname, ext = os.path.splitext(os.path.basename(nib))
- if ext == '.lproj':
- # Special case: if the main nib is a .lproj we assum a directory
- # and use the first nib from there. XXX Look: an arbitrary pick ;-)
- files = os.listdir(nib)
- for f in files:
- if f[-4:] == '.nib':
- nibname = os.path.split(f)[1][:-4]
- break
- else:
- nibname = ""
- if nibname:
- builder.plist.NSMainNibFile = nibname
- if not hasattr(builder.plist, "NSPrincipalClass"):
- builder.plist.NSPrincipalClass = "NSApplication"
- builder.setup()
- builder.build()
-
-
-if __name__ == '__main__':
- main()