return file
def process(template, filename, destname, copy_codefragment=0,
- rsrcname=None, others=[], raw=0, progress="default"):
+ rsrcname=None, others=[], raw=0, progress="default", destroot=""):
if progress == "default":
progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
except os.error:
pass
process_common(template, progress, code, rsrcname, destname, 0,
- copy_codefragment, raw, others, filename)
+ copy_codefragment, raw, others, filename, destroot)
def update(template, filename, output):
def process_common(template, progress, code, rsrcname, destname, is_update,
- copy_codefragment, raw=0, others=[], filename=None):
+ copy_codefragment, raw=0, others=[], filename=None, destroot=""):
if MacOS.runtimemodel == 'macho':
return process_common_macho(template, progress, code, rsrcname, destname,
- is_update, raw, others, filename)
+ is_update, raw, others, filename, destroot)
if others:
raise BuildError, "Extra files only allowed for MachoPython applets"
# Create FSSpecs for the various files
progress.inc(0)
def process_common_macho(template, progress, code, rsrcname, destname, is_update,
- raw=0, others=[], filename=None):
+ raw=0, others=[], filename=None, destroot=""):
# Check that we have a filename
if filename is None:
raise BuildError, "Need source filename on MacOSX"
builder.mainprogram = filename
builder.builddir = destdir
builder.name = shortname
+ builder.destroot = destroot
if rsrcname:
realrsrcname = macresource.resource_pathname(rsrcname)
builder.files.append((realrsrcname,
# Verbosity level.
verbosity = 1
+
+ # Destination root directory
+ destroot = ""
def setup(self):
# XXX rethink self.name munging, this is brittle.
execname = os.path.basename(self.executable)
execpath = pathjoin(self.execdir, execname)
if not self.symlink_exec:
- self.files.append((self.executable, execpath))
+ self.files.append((self.destroot + self.executable, execpath))
self.execpath = execpath
if self.mainprogram is not None:
"mainprogram=", "creator=", "nib=", "plist=", "link",
"link-exec", "help", "verbose", "quiet", "argv", "standalone",
"exclude=", "include=", "package=", "strip", "iconfile=",
- "lib=", "python=", "semi-standalone", "bundle-id=")
+ "lib=", "python=", "semi-standalone", "bundle-id=", "destroot=")
try:
options, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
builder.includePackages.append(arg)
elif opt == '--strip':
builder.strip = 1
+ elif opt == '--destroot':
+ builder.destroot = arg
if len(args) != 1:
usage("Must specify one command ('build', 'report' or 'help')")
echo See Mac/OSX/README for details; \
else \
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
+ --destroot $(DESTDIR) \
--python $(INSTALLED_PYTHONW) \
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
$(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
+ --destroot $(DESTDIR) \
--python $(INSTALLED_PYTHONW) \
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
$(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
else \
echo $(BUILDPYTHON) $(bundlebuilder) \
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
+ --destroot $(DESTDIR) \
--python $(INSTALLED_PYTHONW) \
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
--creator Pimp build; \
$(BUILDPYTHON) $(bundlebuilder) \
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
+ --destroot $(DESTDIR) \
--python $(INSTALLED_PYTHONW) \
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
else \
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
--python $(INSTALLED_PYTHONW) \
+ --destroot $(DESTDIR) \
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
--extra $(srcdir)/Lib/idlelib \
$(srcdir)/Lib/idlelib/idle ; \
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
--python $(INSTALLED_PYTHONW) \
+ --destroot $(DESTDIR) \
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
--extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \
$(srcdir)/Lib/idlelib/idle ; \
install_BuildApplet:
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
+ --destroot $(DESTDIR) \
--python $(INSTALLED_PYTHONW) \
--output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \
$(srcdir)/Mac/scripts/BuildApplet.py
buildtools.process(template, filename, dstfilename, 1)
else:
- SHORTOPTS = "o:r:ne:v?P"
- LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=")
+ SHORTOPTS = "o:r:ne:v?PR"
+ LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=", "destroot=")
try:
options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS)
except getopt.error:
raw = 0
extras = []
verbose = None
+ destroot = ''
for opt, arg in options:
if opt in ('-o', '--output'):
dstfilename = arg
verbose = Verbose()
elif opt in ('-?', '--help'):
usage()
+ elif opt in ('-d', '--destroot'):
+ destroot = arg
# On OS9 always be verbose
if sys.platform == 'mac' and not verbose:
verbose = 'default'
buildtools.update(template, filename, dstfilename)
else:
buildtools.process(template, filename, dstfilename, 1,
- rsrcname=rsrcfilename, others=extras, raw=raw, progress=verbose)
+ rsrcname=rsrcfilename, others=extras, raw=raw,
+ progress=verbose, destroot=destroot)
def usage():
print "BuildApplet creates an application from a Python source file"
print "Usage:"
- print " BuildApplet interactive, single file, no options"
- print " BuildApplet src1.py src2.py ... non-interactive multiple file"
- print " BuildApplet [options] src.py non-interactive single file"
+ print " BuildApplet interactive, single file, no options"
+ print " BuildApplet src1.py src2.py ... non-interactive multiple file"
+ print " BuildApplet [options] src.py non-interactive single file"
print "Options:"
- print " --output o Output file; default based on source filename, short -o"
- print " --resource r Resource file; default based on source filename, short -r"
- print " --noargv Build applet without drag-and-drop sys.argv emulation, short -n, OSX only"
- print " --extra src[:dst] Extra file to put in .app bundle, short -e, OSX only"
- print " --verbose Verbose, short -v"
- print " --help This message, short -?"
+ print " --output o Output file; default based on source filename, short -o"
+ print " --resource r Resource file; default based on source filename, short -r"
+ print " --noargv Build applet without drag-and-drop sys.argv emulation, short -n, OSX only"
+ print " --extra src[:dst] Extra file to put in .app bundle, short -e, OSX only"
+ print " --verbose Verbose, short -v"
+ print " --help This message, short -?"
sys.exit(1)
class Verbose: