def generate_war(app, env, args): java_cmd = app.java_cmd(args) if os.path.exists(os.path.join(app.path, 'tmp')): shutil.rmtree(os.path.join(app.path, 'tmp')) if os.path.exists(os.path.join(app.path, 'precompiled')): shutil.rmtree(os.path.join(app.path, 'precompiled')) java_cmd.insert(2, '-Dprecompile=yes') try: result = subprocess.call(java_cmd, env=os.environ) if not result == 0: print "~" print "~ Precompilation has failed, stop deploying." print "~" sys.exit(-1) except OSError: print "Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). " sys.exit(-1) war_path = os.path.join(tempfile.gettempdir(), os.path.basename(app.path)) package_as_war(app, env, war_path, "%s.war" % war_path) return "%s.war" % war_path
def generate_war(app, env, args): java_cmd = app.java_cmd(args) if os.path.exists(os.path.join(app.path, 'tmp')): shutil.rmtree(os.path.join(app.path, 'tmp')) if os.path.exists(os.path.join(app.path, 'precompiled')): shutil.rmtree(os.path.join(app.path, 'precompiled')) java_cmd.insert(2, '-Dprecompile=yes') try: result = subprocess.call(java_cmd, env=os.environ) if not result == 0: print "~" print "~ Precompilation has failed, stop deploying." print "~" sys.exit(-1) except OSError: print "Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). " sys.exit(-1) generate_web_inf(app.path) war_path = os.path.join(tempfile.gettempdir(), os.path.basename(app.path)) package_as_war(app, env, war_path, "%s.war" % war_path) return "%s.war" % war_path
def generate_war(app, env, args): java_cmd = app.java_cmd(args) if os.path.exists(os.path.join(app.path, 'tmp')): shutil.rmtree(os.path.join(app.path, 'tmp')) if os.path.exists(os.path.join(app.path, 'precompiled')): shutil.rmtree(os.path.join(app.path, 'precompiled')) java_cmd.insert(2, '-Dprecompile=yes') try: result = subprocess.call(java_cmd, env=os.environ) if not result == 0: print "~" print "~ Precompilation has failed, stop deploying." print "~" sys.exit(-1) except OSError: print "error" sys.exit(-1) war_path = os.path.join(tempfile.gettempdir(), os.path.basename(app.path)) package_as_war(app, env, war_path, "%s.war" % war_path) return "%s.war" % war_path
java_cmd.insert(2, '-Dprecompile=yes') try: subprocess.call(java_cmd, env=os.environ) except OSError: print "Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly (the java executable should reside at JAVA_HOME/bin/java). " sys.exit(-1) if os.path.exists(os.path.join(app.path, 'tmp')): shutil.rmtree(os.path.join(app.path, 'tmp')) print '~' print '~ Packaging' print '~ ---------' war_path = os.path.join(tempfile.gettempdir(), '%s.war' % os.path.basename(app.path)) package_as_war(app, env, war_path, None) print '~' print '~ Deploying' print '~ ---------' if os.name == 'nt': os.system('%s/bin/appcfg.cmd update %s' % (gae_path, war_path)) else: os.system('%s/bin/appcfg.sh update %s' % (gae_path, war_path)) print "~ " print "~ Done!" print "~ " sys.exit(-1)