Ñò
4×ÛQc           @   s7   d  Z  d d k Z d d k Z d „  Z d d „ Z d S(   s6   Utility to use the Uglify JS Compiler CLI from Python.iÿÿÿÿNc           C   s   t  i d d g ƒ d S(   s2    Returns whether the uglify-js tool is available. t   whicht   uglifyjsN(   t
   subprocesst   check_output(    (    (    s   ../tools\uglify_js.pyt   check_available   s    c         C   s†   d g } | i  |  ƒ | i  d d g ƒ | o | | 7} n t i d d i | ƒ ƒ y t i | ƒ SWn t i j
 o d SXd S(   s  
    Prepares command-line call to uglify-js compiler.

    Args:
      source_paths: Source paths to build, in order.
      flags: A list of additional flags to pass on to uglify-js.

    Returns:
      The compiled source, as a string, or None if compilation failed.
    R   s   -cs   -ms(   Compiling with the following command: %st    N(   t   extendt   loggingt   infot   joinR   R   t   CalledProcessError(   t   source_pathst   flagst   args(    (    s   ../tools\uglify_js.pyt   compile   s    	(   t   __doc__R   R   R   t   NoneR   (    (    (    s   ../tools\uglify_js.pyt   <module>   s   	