ó
ÚÂ]c           @  s˘  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z y d  d l m Z Wn! e	 k
 r d  d l
 m Z n Xy d  d l Z Wn e	 k
 rż d  d l Z n Xe Z e j d    Z e j d    Z e j d    Z d d d     YZ d	 d d
     YZ d e e f d     YZ d e f d     YZ d e e f d     YZ d e e f d     YZ e j   d  Z d   Z d S(   i˙˙˙˙(   t   unicode_literalsN(   t	   ExitStackc          c  s3   t  j   }  z t j |   VWd  t j |   Xd  S(   N(   t   tempfilet   mkdtempt   pathlibt   Patht   shutilt   rmtree(   t   tmpdir(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   tempdir   s    c          c  s*   t  j   }  z	 d  VWd  t  j |   Xd  S(   N(   t   ost   getcwdt   chdir(   t   orig(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   save_cwd!   s    	c          c  s>   t    / }  t    t j t |    |  VWd  QXWd  QXd  S(   N(   R	   R   R
   R   t   str(   t   tmp(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   tempdir_as_cwd*   s    
t   SiteDirc           B  s   e  Z d    Z RS(   c         C  s;   t    |  _ |  j |  j j  |  j j t    |  _ d  S(   N(   R   t   fixturest
   addCleanupt   closet   enter_contextR	   t   site_dir(   t   self(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   setUp3   s    (   t   __name__t
   __module__R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR   2   s   t	   OnSysPathc           B  s)   e  Z e e j d      Z d   Z RS(   c         c  s=   t  |   g t j d *z	 d  VWd  t j j t  |    Xd  S(   Ni    (   R   t   syst   patht   remove(   t   dir(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   add_sys_path:   s    	c         C  s3   t  t |   j   |  j j |  j |  j   d  S(   N(   t   superR   R   R   R   R!   R   (   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR   C   s    (   R   R   t   staticmethodt
   contextlibt   contextmanagerR!   R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR   9   s   t   DistInfoPkgc           B  s:   e  Z i i d  d 6d d 6d d 6d 6d d 6Z d	   Z RS(
   uĜ   
                Name: distinfo-pkg
                Author: Steven Ma
                Version: 1.0.0
                Requires-Dist: wheel >= 1.0
                Requires-Dist: pytest; extra == 'test'
                u   METADATAu   mod.py,sha256=abc,20
u   RECORDui   
                [entries]
                main = mod:main
                ns:sub = mod:main
            u   entry_points.txtu   distinfo_pkg-1.0.0.dist-infouJ   
            def main():
                print("hello world")
            u   mod.pyc         C  s*   t  t |   j   t t j |  j  d  S(   N(   R"   R&   R   t   build_filest   filesR   (   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR   _   s    (   R   R   R(   R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR&   H   s   
t   DistInfoPkgOffPathc           B  s   e  Z d    Z RS(   c         C  s*   t  t |   j   t t j |  j  d  S(   N(   R"   R)   R   R'   R&   R(   R   (   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR   e   s    (   R   R   R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR)   d   s   t
   EggInfoPkgc           B  sH   e  Z i i d  d 6d d 6d d 6d d 6d d	 6d
 6d d 6Z d   Z RS(   u  
                Name: egginfo-pkg
                Author: Steven Ma
                License: Unknown
                Version: 1.0.0
                Classifier: Intended Audience :: Developers
                Classifier: Topic :: Software Development :: Libraries
                u   PKG-INFOuW   
                mod.py
                egginfo_pkg.egg-info/top_level.txt
            u   SOURCES.txtuG   
                [entries]
                main = mod:main
            u   entry_points.txtuq   
                wheel >= 1.0; python_version >= "2.7"
                [test]
                pytest
            u   requires.txtu   mod
u   top_level.txtu   egginfo_pkg.egg-infouJ   
            def main():
                print("hello world")
            u   mod.pyc         C  s-   t  t |   j   t t j d |  j d  S(   Nt   prefix(   R"   R*   R   R'   R(   R   (   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR      s    (   R   R   R(   R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR*   j   s   
t   EggInfoFilec           B  s   e  Z i d  d 6Z d   Z RS(   ua  
            Metadata-Version: 1.0
            Name: egginfo_file
            Version: 0.1
            Summary: An example package
            Home-page: www.example.com
            Author: Eric Haffa-Vee
            Author-email: eric@example.coms
            License: UNKNOWN
            Description: UNKNOWN
            Platform: UNKNOWN
            u   egginfo_file.egg-infoc         C  s-   t  t |   j   t t j d |  j d  S(   NR+   (   R"   R,   R   R'   R(   R   (   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR      s    (   R   R   R(   R   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR,      s   
c         C  sı   x² |  j    D]¤ \ } } | | } t | t  rO | j   t | d | q t | t  r | j d   } | j |  Wd QXq | j d   } | j t |   Wd QXq Wd S(   u  Build a set of files/directories, as described by the

    file_defs dictionary.  Each key/value pair in the dictionary is
    interpreted as a filename/contents pair.  If the contents value is a
    dictionary, a directory is created, and the dictionary interpreted
    as the files within it, recursively.

    For example:

    {"README.txt": "A README file",
     "foo": {
        "__init__.py": "",
        "bar": {
            "__init__.py": "",
        },
        "baz.py": "# Some code",
     }
    }
    R+   u   wbNu   w(	   t   itemst
   isinstancet   dictt   mkdirR'   t   bytest   opent   writet   DALS(   t	   file_defsR+   t   namet   contentst	   full_namet   f(    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR'   ¤   s    

c         C  s   t  j |   j   S(   u   Dedent and left-strip(   t   textwrapt   dedentt   lstrip(   R   (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyR4   Ĉ   s    (    (    (   t
   __future__R    R
   R   R   R   R:   R$   R   t   ImportErrort   contextlib2R   t   pathlib2t   typet   __metaclass__R%   R	   R   R   R   R   R&   R)   R*   R,   R   R'   R4   (    (    (    s@   lib/python2.7/site-packages/importlib_metadata/tests/fixtures.pyt   <module>   s4   		%"