ó
žS]c           @   sh   d  Z  d d l Z d d l m Z d d l m Z m Z d e f d     YZ d e f d     YZ d S(	   s#   Plugins base classes and functions.iĸĸĸĸN(   t   join(   t   _ArgsTransformert   ProjectCommandt   ArgsTransformerTemplatec           B   s    e  Z d  Z d   Z d   Z RS(   sĨ   Template class for plugins args trasformers.

    Plugins args transformers should subclass it and redefine add_class
    to implement custom arguments mapping.
    c         C   s   | |  _  d S(   s   Construct an ArgTransformer for the given command.

        Args:
            command (ProjectCommand): command that maps to the ArgsTransformer
        N(   t   command(   t   selfR   (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyt   __init__   s    c         C   s   t  d   d S(   sž  Overwrite this method to add custom arguments transformation.

        It should forwarding the arguments that are custom to the
        specific command served by this trasformer (
            i.e., '--anaconda-project-host' --> 'host'
        )

        Inputs:
            - results [list(tuples)]: list of 2 element tuples (option, values):
                           * option (str): name of the option
                            * values (lst(str)): list of the values passed
                                        for the option
            - args [list]: list of the args already passed in

        Returns:
            (list) list of the transformed args (that should include args)
        s   not implementedN(   t   RuntimeError(   R   t   resultst   args(    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyt   add_args   s    (   t   __name__t
   __module__t   __doc__R   R
   (    (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyR      s   	t   CommandTemplatec           B   sJ   e  Z d  Z d Z d Z d   Z e d    Z d d  Z	 d d  Z
 RS(   s+   Represents a command from the project file.c         C   s5   t  t |   j d | d |  |  j |   |  _ d S(   są   Construct a command with the given attributes.

        Args:
            name (str): name of the command
            attributes (dict): named attributes of the command
        t   namet
   attributesN(   t   superR   R   t   args_transformer_clst   _args_transformer(   R   R   R   (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyR   >   s    c         C   s   t  t j d d |  j  S(   s1   Full command path pointing to <conda prefix>/bin.t   CONDA_PREFIXt   bin(   R    t   ost   environR   (   R   (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyt   command_with_conda_prefixH   s    c         C   s%   |  j  j |  } |  j | d | S(   s?   Prepare extra args calling class _args_trasform.transform_args.t
   extra_args(   R   t   transform_argst   choose_args_and_shell(   R   R   R   (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyt   _choose_args_and_shellM   s    c         C   s   t     d S(   s7   Overwrite this method to implement custom plugin logic.N(   t   NotImplementedError(   R   R   R   (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyR   R   s    N(   R   R   R   t   NoneR   R   R   t   propertyR   R   R   (    (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyR   2   s   	
(	   R   R   t   os.pathR    t!   anaconda_project.project_commandsR   R   R   R   (    (    (    s7   lib/python2.7/site-packages/anaconda_project/plugins.pyt   <module>   s
   $