ó
mÜJ]c           @` s¢   d  Z  d d l m Z m Z m Z m Z d d l Z e j e ƒ Z	 d d l
 Z
 d d l m Z d d l m Z d d l m Z d d l m Z d Z d
 „  Z d S(   u¾   Provide a ``main`` function to run bokeh commands.

The following are equivalent:

* Running the ``bokeh`` command line script:

  .. code-block:: sh

      bokeh serve --show app.py

* Using ``python -m bokeh``:

  .. code-block:: sh

      python -m bokeh serve --show app.py

* Executing ``main`` programmatically:

  .. code-block:: python

      from bokeh.command.bootstrap import main

      main(["bokeh", "serve", "--show", "app.py"])

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   __version__(   t	   nice_joini   (   t   die(   t   subcommandsu   mainc         C` s#  t  |  ƒ d k r6 t d t d „  t j Dƒ ƒ ƒ n  t j d |  d d d ƒ } | j d d	 d
 d d t ƒ| j	 d d ƒ } xN t j D]C } | j
 | j d | j ƒ} | d | ƒ } | j d | j ƒ qŠ W| j |  d ƒ } y | j | ƒ Wn' t k
 r} t d t | ƒ ƒ n Xd S(   uì   Execute the Bokeh command.

    Args:
        argv (seq[str]) : a list of command line arguments to process

    Returns:
        None

    The first item in ``argv`` is typically "bokeh", and the second should
    be the name of one of the available subcommands:

    * :ref:`html <bokeh.command.subcommands.html>`
    * :ref:`info <bokeh.command.subcommands.info>`
    * :ref:`json <bokeh.command.subcommands.json>`
    * :ref:`png <bokeh.command.subcommands.png>`
    * :ref:`sampledata <bokeh.command.subcommands.sampledata>`
    * :ref:`secret <bokeh.command.subcommands.secret>`
    * :ref:`serve <bokeh.command.subcommands.serve>`
    * :ref:`static <bokeh.command.subcommands.static>`
    * :ref:`svg <bokeh.command.subcommands.svg>`

    i   u*   ERROR: Must specify subcommand, one of: %sc         s` s   |  ] } | j  Vq d  S(   N(   t   name(   t   .0t   x(    (    s6   lib/python2.7/site-packages/bokeh/command/bootstrap.pys	   <genexpr>]   s    t   progi    t   epilogu;   See '<command> --help' to read about a specific subcommand.u   -vu	   --versiont   actionu   versiont   versiont   helpu   Sub-commandst   parsert   invokeu   ERROR: N(   t   lenR   R   R   t   allt   argparset   ArgumentParsert   add_argumentR   t   add_subparserst
   add_parserR   R   t   set_defaultsR   t
   parse_argst	   Exceptiont   str(   t   argvR   t   subst   clst	   subparsert
   subcommandt   argst   e(    (    s6   lib/python2.7/site-packages/bokeh/command/bootstrap.pyt   mainE   s     $	
	(   u   main(   t   __doc__t
   __future__R    R   R   R   t   loggingt	   getLoggert   __name__t   logR   t   bokehR   t   bokeh.util.stringR   t   utilR   t    R   t   __all__R$   (    (    (    s6   lib/python2.7/site-packages/bokeh/command/bootstrap.pyt   <module>   s   "