ó ÈKQc@s^dZddlZddlZddlZddlZejdƒZd„Zdd„Z dS(s4Utility to use the Closure Compiler CLI from Python.iÿÿÿÿNs"([0-9][.0-9]*)cCsVtjddgdtjƒ}|jƒ\}}|jƒd}tj|ƒjdƒS(s=Returns the string for the current version of Java installed.tjavas-versiontstderrii(t subprocesstPopentPIPEt communicatet splitlinest_VERSION_REGEXtsearchtgroup(tproctunused_stdoutdatat stderrdatat version_line((sU/Users/alexmahan/git/google-earth-day/closure/library/closure/bin/build/jscompiler.pyt_GetJavaVersionscCsÕtjjtƒƒtjjdƒks8tjdƒdSdd|g}x|D]}|d|g7}qNW|r{||7}ntjddj|ƒƒtj |d tj ƒ}|j ƒ\}}|j d krÑdS|S( sDPrepares command-line call to Closure Compiler. Args: compiler_jar_path: Path to the Closure compiler .jar file. source_paths: Source paths to build, in order. flags: A list of additional flags to pass on to Closure Compiler. Returns: The compiled source, as a string, or None if compilation failed. s1.6sVClosure Compiler requires Java 1.6 or higher. Please visit http://www.java.com/getjavaNRs-jars--jss(Compiling with the following command: %st tstdouti( t distutilstversiont LooseVersionRtloggingterrortinfotjoinRRRRt returncode(tcompiler_jar_patht source_pathstflagstargstpathR t stdoutdatatunused_stderrdata((sU/Users/alexmahan/git/google-earth-day/closure/library/closure/bin/build/jscompiler.pytCompile%s    ( t__doc__tdistutils.versionRRtreRtcompileRRtNoneR (((sU/Users/alexmahan/git/google-earth-day/closure/library/closure/bin/build/jscompiler.pyts