# the tamarin mercurial repository url tamarin_repository = "http://hg.mozilla.org/tamarin-redux" # the tamarin revision that shall be used with this version of caspin tamarin_revision = "227bc825a1bd" # the download url for the latest ActionScript 3 Compiler version asc_url = "ftp.mozilla.org/pub/js/tamarin/builds/asc/latest/asc.jar" # the initial working directory cwd = os.getcwd() # clear the tamarin directory if os.path.exists(cwd + "/tamarin"): colors.println("y", "clearing tamarin directory...") shutil.rmtree(cwd + "/tamarin") # the mercurial command cmd = "hg clone -r " + tamarin_revision + " " + tamarin_repository + " " + cwd + "/tamarin" colors.println("y", "checking out tamarin...\n(this may take serveral minutes depending on your internet connection)") # invoke the mercurial command to check out tamarin os.system(cmd); # apply the changes to tamarin that are necessarry via a patch if apply_tamarin_path: colors.println("y", "patching tamarin...") os.chdir(cwd + "/tamarin/") os.system("hg patch --no-commit ../tamarin_changes.diff")
# get the modification timestamps of the output files if os.path.exists(outfile_cpp): outfile_mod_date = os.path.getmtime(outfile_cpp) if os.path.exists(outfile_h): mod_date = os.path.getmtime(outfile_h) if mod_date > outfile_mod_date: outfile_mod_date = mod_date gen_required = infile_mod_date >= outfile_mod_date # only continue if we need to if gen_required: colors.printf("r", infile + ":") colors.println("d", "\tglue generation required...") else: colors.printf("g", infile + ":") colors.println("d", "\tup to date...") exit() for i in range(2, len(sys.argv)): # append all imported .abc files cmd += sys.argv[i] + " " # use the first argument as output filename cmd += infile_abc #if len(sys.argv) > 2: # cmd += " --native-id-namespace " + sys.argv[2] + " " # generate the C++ glue code from .abc files
def build_config(config): colors.printf("d", "build the ") colors.printf("r", config) colors.println("d", " configuration? [y/n]") return raw_input("")
# append all requested .as files cmd += sys.argv[i] + " " file_list = files.search(sys.argv[i]) for file in file_list: mod_date = os.path.getmtime(file) build_required = build_required or mod_date >= outfile_mod_date i = i + 1 # only continue if we need to if build_required: colors.printf("r", outfile + ":") colors.println("d", "\tbuild required...") else: colors.printf("g", outfile + ":") colors.println("d", "\tup to date...") exit() # a small hack for asc.jar to navigate back to the correct working directory # otherwise the output file wouldn't be placed correctly dummy_file = open("dummy_file.as", "w") dummy_file.close() # invoke the ActionScript compiler result = os.system(cmd + " dummy_file.as") # remove the dummy file if os.path.exists("dummy_file.as"):
#!/usr/bin/env python import sys sys.path.append("tools") import os import colors import shutil if os.name != "posix": colors.println("r", "ERROR: only usable on unix systems") exit() # the initial working directory cwd = os.getcwd() if not os.path.exists(cwd + "/tamarin/bin"): os.mkdir(cwd + "/tamarin/bin") os.chdir(cwd + "/tamarin/bin") def build_config(config): colors.printf("d", "build the ") colors.printf("r", config) colors.println("d", " configuration? [y/n]") return raw_input("") build_debug_debugger = build_config("DEBUG_DEBUGGER")