ó
¦w>]c           @@  s´   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z m Z d  d l m	 Z	 d  d l
 m Z e r• d  d l m Z m Z m Z m Z n  d „  Z d „  Z d	 „  Z d S(
   i    (   t   absolute_importN(   t   pytomlt   six(   t   InstallationError(   t   MYPY_CHECK_RUNNING(   t   Anyt   Tuplet   Optionalt   Listc         C@  s#   t  |  t ƒ o" t d „  |  Dƒ ƒ S(   Nc         s@  s!   |  ] } t  | t j ƒ Vq d  S(   N(   t
   isinstanceR   t   string_types(   t   .0t   item(    (    s6   lib/python2.7/site-packages/pip/_internal/pyproject.pys	   <genexpr>   s    (   R	   t   listt   all(   t   obj(    (    s6   lib/python2.7/site-packages/pip/_internal/pyproject.pyt   _is_list_of_str   s    c         C@  sL   t  j j |  d ƒ } t j rH t | t j ƒ rH | j t j	 ƒ  ƒ } n  | S(   Ns   pyproject.toml(
   t   ost   patht   joinR   t   PY2R	   t	   text_typet   encodet   syst   getfilesystemencoding(   t   setup_py_dirR   (    (    s6   lib/python2.7/site-packages/pip/_internal/pyproject.pyt   make_pyproject_path   s    c         C@  s
  t  j j | ƒ } t  j j | ƒ } | ri t j | d d ƒ } t j | ƒ } Wd QX| j d ƒ } n d } | r§ | r§ |  d k	 rž |  rž t	 d ƒ ‚ n  t
 }  n_ | rñ d | k rñ |  d k	 rè |  rè t	 d j | d ƒ ƒ ‚ n  t
 }  n |  d k r| }  n  |  d k	 st ‚ |  s"d S| d k rKi d d	 g d
 6d d 6} n  | d k	 s]t ‚ d }	 d
 | k rt	 |	 j d | d d ƒ ƒ ‚ n  | d
 }
 t |
 ƒ sÇt	 |	 j d | d d ƒ ƒ ‚ n  | j d ƒ } g  } | d k rýd } d d	 g } n  |
 | | f S(   sÍ  Load the pyproject.toml file.

    Parameters:
        use_pep517 - Has the user requested PEP 517 processing? None
                     means the user hasn't explicitly specified.
        pyproject_toml - Location of the project's pyproject.toml file
        setup_py - Location of the project's setup.py file
        req_name - The name of the requirement we're processing (for
                   error reporting)

    Returns:
        None if we should use the legacy code path, otherwise a tuple
        (
            requirements from pyproject.toml,
            name of PEP 517 backend,
            requirements we should check are installed after setting
                up the build environment
        )
    t   encodings   utf-8Ns   build-systemsI   Disabling PEP 517 processing is invalid: project does not have a setup.pys   build-backendsb   Disabling PEP 517 processing is invalid: project specifies a build backend of {} in pyproject.tomls   setuptools>=40.8.0t   wheelt   requiress    setuptools.build_meta:__legacy__sO   {package} has a pyproject.toml file that does not comply with PEP 518: {reason}t   packaget   reasons]   it has a 'build-system' table but not 'build-system.requires' which is mandatory in the tables1   'build-system.requires' is not a list of strings.(   R   R   t   isfilet   iot   openR   t   loadt   gett   NoneR   t   Truet   formatt   AssertionErrorR   (   t
   use_pep517t   pyproject_tomlt   setup_pyt   req_namet   has_pyprojectt	   has_setupt   ft   pp_tomlt   build_systemt   error_templateR   t   backendt   check(    (    s6   lib/python2.7/site-packages/pip/_internal/pyproject.pyt   load_pyproject_toml#   sX    				
(   t
   __future__R    R!   R   R   t   pip._vendorR   R   t   pip._internal.exceptionsR   t   pip._internal.utils.typingR   t   typingR   R   R   R   R   R   R5   (    (    (    s6   lib/python2.7/site-packages/pip/_internal/pyproject.pyt   <module>   s   %		