def displace(name, target, location): # first, ensure that the target exists if not os.path.exists(target): print error + " Target %s doesn't exist!"%target print "Try one of these:" listArtPaths() return # if it's a link, kill it if os.path.islink(location): bash("rm", location) # if a folder, move it out the way if os.path.exists(location): # create __displaced if not done so yet displaced = os.path.join(app_path, displacementFolder) if not os.path.exists(displaced): bash("mkdir", displaced) # move folder into displaced folder with datetime displaced = os.path.join(app_path, displacementFolder, "%s-%s"%(name, now())) print warn + " Moving %s folder to %s"%(location, displaced) bash("mv", location, displaced) # create the link bash("ln -sf", target, location) bash("ls -al", location)
def link(version): print "Linking %s version assets"%version # art versionFolder = "24bit" if version != "master": versionFolder = os.path.join("8bit", version) artLink = os.path.join(assets_path, "art-funenglish", versionFolder) artLocation = os.path.join(app_path, "art") displace("art", artLink, artLocation) # audio # ensure destination root audio folder is present audio = os.path.join(app_path, "audio") if not os.path.exists(audio): os.chdir(app_path) bash("mkdir", audio) audioLink = os.path.join(assets_path, "audio-funenglish") audioLocation = os.path.join(app_path, "audio", "english") displace("english", audioLink, audioLocation) # audio audioLink = os.path.join(assets_path, "audio-funspanish") audioLocation = os.path.join(app_path, "audio", "spanish") displace("spanish", audioLink, audioLocation) # audio audioLink = os.path.join(assets_path, "audio-fungerman") audioLocation = os.path.join(app_path, "audio", "german") displace("german", audioLink, audioLocation) # audio audioLink = os.path.join(assets_path, "audio-funchinese") audioLocation = os.path.join(app_path, "audio", "chinese") displace("chinese", audioLink, audioLocation) # audio audioLink = os.path.join(assets_path, "audio-funfrench") audioLocation = os.path.join(app_path, "audio", "french") displace("french", audioLink, audioLocation) audioLink = os.path.join(assets_path, "audio-funsfx") audioLocation = os.path.join(app_path, "audio", "sfx") displace("sfx", audioLink, audioLocation) audioLink = os.path.join(assets_path, "audio-funmusic") audioLocation = os.path.join(app_path, "audio", "music") displace("music", audioLink, audioLocation)
def checkoutRepo(repo, protocol="ssh"): path = os.path.join(repo["base"], repo["path"]) path = os.path.normpath(path) ver = repo["ver"] revision = repo["revision"] print "%s Checking out %s" % (tick, revision) if ver == "hg": bash("hg -R", path, "update", revision) else: bash("git -C", path, "checkout", revision)
def fetchRepo(repo, protocol="ssh"): path = os.path.join(repo["base"], repo["path"]) path = os.path.normpath(path) f, ver = ensureVersionFolder(path) if ver: print "%s Found %s repo at %s" % (tick, ver, path) if ver == "hg": bash("hg -R", path, "pull") else: bash("git -C", path, "fetch") else: name = repo["name"] ver = repo["ver"] # enter the folder and clone the repo url = "ssh://[email protected]/solares/%s" % name if protocol == "https": url = "https://bitbucket.org/solares/%s" % name print "%s Cloning %s" % (tick, url) bash(ver, "clone", url, path)
def crushAudio(platform): # todo add language # print "Crushing %s audio for %s"%(language, platform) print "Crushing audio for %s"%platform script_path = os.path.join(assets_path, "audio-funenglish") os.chdir(script_path) command = "./create_%s_audio.sh"%platform bash(command) # script_path = os.path.join(assets_path, "audio-fungerman") # os.chdir(script_path) # command = "./create_%s_audio.sh"%platform # bash(command) script_path = os.path.join(assets_path, "audio-funsfx") os.chdir(script_path) command = "./create_%s_sfx_audio.sh"%platform bash(command) script_path = os.path.join(assets_path, "audio-funmusic") os.chdir(script_path) command = "./create_%s_music_audio.sh"%platform bash(command)
def listArtPaths(): bash("ls", os.path.join(assets_path, "art-funenglish", "8bit")) return
def crushArt(version): print "Crushing art to %s"%version # TODO move to INI art_script_path = "assets/art-funenglish/scripts" os.chdir(art_script_path) bash("./build.sh", version)
def addFolderToPath(cwd): bash("export PATH=$PATH:%s" % cwd)
def build(args): script_path = os.path.join(path_to_app, "scripts", "build") os.chdir(script_path) args.insert(0, "python build.py") bash(*args)
def status(): # first show branch and commit of the principal app repo bash("git", "-C", path_to_app, "status")
def link(version): print "Linking %s version assets" % version dest_path = os.path.realpath(app_path) os.chdir(skins_path) bash("./link.sh", version, dest_path)
def crush(product, version): print "Crushing %s skin version %s" % (product, version) # change to skin folder # print (os.getcwd()) os.chdir(skins_path) bash("./build.sh", product, version)
def runApp(): bash(coronaPath, "apps/funenglish")