
]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 y d  d l m Z e Wn e	 k
 r} d Z n Xd d d e f Z
 d Z d	 j d
   e
 D  Z d e Z d Z d Z d Z e Z e Z e Z e Z e Z e Z d e j k Z d  d l Z d   Z e j   d r/e   Z nv d e j k rGe Z n^ e j   d r`e Z nE d e j k rxe Z n- e j d k sd e j k re Z n e Z e pe pe Z  e Z! e Z" e Z# i  Z$ d d d d d d d d d d d d  d! d" d# d$ d% d& d' h Z% e j& f Z' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 h Z( d9 dC d:     YZ) d a+ d;   Z, d<   a- d=   Z. d>   Z/ d?   Z0 d@   Z1 dA   Z2 dB   Z3 e rd  d l4 j5 Z6 n  d S(D   i(   t   print_functionN(   t
   vc_versioni    i   i   i   s#   The world (wide web) is not enough.t   .c         c  s   |  ] } t  |  Vq d  S(   N(   t   str(   t   .0t   i(    (    s   renpy/__init__.pys	   <genexpr>2   s    s   Ren'Py iVL s	   -LT1.savei   t   RENPY_EXPERIMENTALc            s   d d l    d   j f   f d     Y}  y] |    }   j |  | _   j j j   j |   } | d k rw d S| j | j	 f SWn d SXd S(	   s>   
    When called on windows, returns the windows version.
    iNt   OSVERSIONINFOEXWc             s   e  Z d    j f d   j f d   j f d   j f d   j f d   j d f d   j f d   j f d	   j f d
   j f d   j f g Z RS(   t   dwOSVersionInfoSizet   dwMajorVersiont   dwMinorVersiont   dwBuildNumbert   dwPlatformIdt   szCSDVersioni   t   wServicePackMajort   wServicePackMinort
   wSuiteMaskt   wProductTypet	   wReserved(   t   __name__t
   __module__t   c_ulongt   c_wchart   c_ushortt   c_bytet   _fields_(    (   t   ctypes(    s   renpy/__init__.pyR   X   s   i    i
   (   i
   i    (   i
   i    (
   R   t	   Structuret   sizeofR   t   windllt   Ntdllt   RtlGetVersiont   byrefR	   R
   (   R   t
   os_versiont   retcode(    (   R   s   renpy/__init__.pyt   get_windows_versionQ   s    	t	   RENPY_IOSt   ANDROID_PRIVATEt
   emscriptent   RENPY_EMSCRIPTENt   renpys   renpy.objects	   renpy.logs   renpy.bootstraps   renpy.debugs   renpy.displays   renpy.display.pgrenders   renpy.display.scales   renpy.display.presplashs   renpy.display.tests	   renpy.sixs   renpy.text.ftfonts
   renpy.tests   renpy.test.testasts   renpy.test.testexecutions   renpy.test.testkeys   renpy.test.testmouses   renpy.test.testparsert   renpycoverages#   renpy.loadsave.autosave_not_runnings   renpy.python.unicode_res   renpy.python.string_res   renpy.python.store_dictss   renpy.python.store_moduless   renpy.text.text.VERT_FORWARDs   renpy.text.text.VERT_REVERSEs(   renpy.savelocation.scan_thread_conditions   renpy.savelocation.disk_locks   renpy.character.TAG_REs   renpy.display.im.caches   renpy.display.render.blit_locks   renpy.display.render.IDENTITYs   renpy.loader.auto_locks   renpy.display.screen.cprofs   renpy.audio.audio.locks$   renpy.audio.audio.periodic_conditiont   Backupc           B  s)   e  Z d  Z d   Z d   Z d   Z RS(   sg  
    This represents a backup of all of the fields in the python modules
    comprising Ren'Py, shortly after they were imported.

    This attempts to preserve object aliasing, but not object identity. If
    renpy.mod.a is renpy.mod.b before the restore, the same will be true
    after the restore - even though renpy.mod.a will have changed identity.
    c         C  s   i  |  _  i  |  _ i  |  _ t r% d  Sx6 t j j   D]% } | d  k rM q5 n  |  j |  q5 Wt	 j
 |  j t	 j  |  _ d  |  _ d  S(   N(   t	   variablest   objectst   namest   mobilet   syst   modulest   valuest   Nonet   backup_modulet   cPicklet   dumpst   HIGHEST_PROTOCOLt   objects_pickle(   t   selft   m(    (    s   renpy/__init__.pyt   __init__   s    			c         C  st  y | j  } Wn d SX| j d  s+ d S| t k r; d S| j d  rN d St t |  j    |  j | <x t |  j   D] \ } } | j d  r | j d  r q n  t	 | t
  r q n  | d | t k r q n  t |  } | |  j | | f <| |  j | <y t j | t j  Wq t d | d | d t |   t d t | j t j    q Xq Wd S(	   sI   
        Makes a backup of `mod`, which must be a Python module.
        NR(   s   renpy.styledatat   __R   s   Cannot picklet   =s   Reduce Ex is:(   R   t
   startswitht   backup_blacklistt   sett   varst   keysR-   t	   iteritemst   endswitht
   isinstancet   type_blacklistt   name_blacklistt   idR+   R,   R4   R5   R6   t   printt   reprt   __reduce_ex__(   R8   t   modt   namet   kt   vt   idv(    (    s   renpy/__init__.pyR3      s4    !c   	      C  s   |  j  s d SxQ |  j  j   D]@ \ } } t |  } x% t | j    | D] } | | =qL Wq Wt j |  j  } x= |  j j   D], \ } } | \ } } t	 | | | |  q Wd S(   sz   
        Restores the modules to a state similar to the state of the modules
        when the backup was created.
        N(
   R-   RB   R@   R?   RA   R4   t   loadsR7   R+   t   setattr(	   R8   RK   R-   t   modvarsRL   R,   RM   RN   t   field(    (    s   renpy/__init__.pyt   restore  s    	(   R   R   t   __doc__R:   R3   RT   (    (    (    s   renpy/__init__.pyR*      s   		-c         C  s   |  j  j d  } d d l } t | d  rd t j j | j  } |  j j	 t j j
 | |   n  d d l } t j j | j d  } |  j j	 t j j
 | |   d S(   s`   
    Update the __path__ of package, to import binary modules from a libexec
    directory.
    R   iNt   __file__i    (   R   t   splitt   _renpyt   hasattrt   ost   patht   dirnameRV   t   __path__t   appendt   joint	   encodings(   t   packageRL   RX   t   libexecR`   (    (    s   renpy/__init__.pyt   update_path9  s    "c         G  s   d  S(   N(    (   t   levelt   event   args(    (    s   renpy/__init__.pyt   plogN  s    c          C  s  d d  l  }  t |   d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l	 }  d d  l
 }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  d d  l }  |  j j a d d  l }  t |  j   d d  l! }  |  j  j"   |  j# t$ j% d <d d  l& }  d d  l' }  d d  l( }  d d  l) }  d d  l* }  d d  l+ }  d d  l, }  d d  l }  t |  j-  d d  l. }  d d  l/ }  d d  l0 }  d d  l1 }  d d  l2 }  d d  l3 }  d d  l4 }  t |  j5  d d  l6 }  d d  l7 }  d d  l8 }  d d  l9 }  d d  l: }  d d  l; }  |  j5 j5 t$ j% d <d d  l< }  t |  j=  d d  l> }  t |  j?  d d  l@ }  t |  jA  d d  lB }  d d  lC }  d d  lD }  d d  lE }  d d  lF }  d d  lG }  d d  lH }  d d  lI }  d d  lJ }  d d  lK }  d d  lL }  d d  lM }  d d  lN }  d d  lO }  d d  lP }  d d  lQ }  d d  lR }  d d  lS }  d d  lT }  d d  lU }  d d  lV }  d d  lW }  d d  lX }  d d  lY }  d d  lZ }  d d  l[ }  t |  j\  d d  l] }  d d  l^ }  d d  l_ }  d d  l` }  d d  la }  d d  lb }  t |  jc  d d  ld }  d d  le }  d d  lf }  d d  lg }  d d  lh }  d d  li }  d d  lj }  d d  lk }  d d  ll }  d d  lm }  d d  ln }  d d  lo }  d d  lp }  d d  lq }  d d  lr }  d d  ls }  d d  lt }  d d  lu }  d d  lv }  d d  lw }  d d  lx }  d d  ly }  tz st{   a| n  t}   d  S(   Nis   renpy.styleclasss   renpy.display.text(~   R(   Rc   t   renpy.argumentst   renpy.configt	   renpy.logt   renpy.displayt   renpy.debugt   renpy.objectt
   renpy.gamet   renpy.preferencest   renpy.loadert   renpy.pyanalysist	   renpy.astt	   renpy.atlt   renpy.curryt   renpy.colort
   renpy.easyt   renpy.executiont   renpy.loadsavet   renpy.savelocationt   renpy.persistentt   renpy.scripteditt   renpy.parsert   renpy.performancet   renpy.pydictt   renpy.pythont   renpy.scriptt   renpy.statementst   performancet   logRg   t   renpy.styledatat	   styledatat   renpy.stylet   import_style_functionst   styleR/   R0   t   renpy.substitutionst   renpy.translationt   renpy.translation.scanstringst   renpy.translation.generationt   renpy.translation.dialoguet   renpy.translation.extractt   renpy.translation.merget   displayt   renpy.display.presplasht   renpy.display.pgrendert   renpy.display.scalet   renpy.display.modulet   renpy.display.rendert   renpy.display.coret
   renpy.textt   textt   renpy.text.ftfontt   renpy.text.fontt   renpy.text.textsupportt   renpy.text.texwrapt   renpy.text.textt   renpy.text.extrast   renpy.glt   glt	   renpy.gl2t   gl2t   renpy.anglet   anglet   renpy.display.layoutt   renpy.display.viewportt   renpy.display.transformt   renpy.display.motiont   renpy.display.behaviort   renpy.display.transitiont   renpy.display.movetransitiont   renpy.display.imt   renpy.display.imageliket   renpy.display.imaget   renpy.display.videot   renpy.display.focust   renpy.display.animt   renpy.display.particlet   renpy.display.joystickt   renpy.display.controllert   renpy.display.minigamet   renpy.display.screent   renpy.display.dragdropt   renpy.display.imagemapt   renpy.display.predictt   renpy.display.emulatort   renpy.display.ttst   renpy.display.gesturet   renpy.display.errort   renpy.audiot   audiot   renpy.audio.audiot   renpy.audio.musict   renpy.audio.soundt   renpy.uit   renpy.screenlangt	   renpy.sl2t   sl2t   renpy.sl2.slastt   renpy.sl2.slparsert   renpy.sl2.slpropertiest   renpy.sl2.sldisplayablest
   renpy.lintt
   renpy.warpt   renpy.editort   renpy.memoryt   renpy.exportst   renpy.charactert   renpy.add_fromt
   renpy.dumpt   renpy.minstoret   renpy.defaultstoret
   renpy.testt   renpy.test.testmouset   renpy.test.testfocust   renpy.test.testkeyt   renpy.test.testastt   renpy.test.testparsert   renpy.test.testexecutiont
   renpy.mainR.   R*   t   backupt   post_import(   R(   (    (    s   renpy/__init__.pyt
   import_allR  s    
c          C  s   d d l  }  |  j j d  t j d |  _ |  j |  j _ t j d t j d <d d l } | t j d <x6 |  j j	 j
   D]" \ } } |  j j	 j | |  q{ W|  j j |  j _ x6 t   j
   D]% \ } } t |  j  j | |  q Wd S(   se   
    This is called after import or reload, to do further initialization
    of various modules.
    iNt   stores   renpy.stores   renpy.subprocess(   R(   t   pythont   create_storeR/   R0   R   t   exportst
   subprocesst   defaultstoret   __dict__RB   t
   setdefaultt   evalt   globalsR@   (   R(   R   RM   RN   (    (    s   renpy/__init__.pyR   
  s    c         C  s   |  | k p |  j  | d  S(   NR   (   R=   (   t   subt   module(    (    s   renpy/__init__.pyt   issubmodule)  s    c            s  t  r t d   n  d d l }  d d l }  t j   |  j j   |  j j	 j
 j   |  j j   |  j j   d |  j j _ |  j j j   |  j j j   d |  j _ d |  j _ |  j j } |  j j } x t j j   D]   t   d  s  d k r7t j   } | d k	 r*| j j   n  t j   =q t   f d   | D  r t j   } | d k	 r|| j j    n  t j   =q q Wt! j"   | |  j _# |  j j	 j$   t%   |  j j&   d S(   s[   
    Resets all modules to the state they were in right after import_all
    returned.
    s/   Reloading is not supported on mobile platforms.iNR   s   renpy.storec         3  s   |  ] } t    |  Vq d  S(   N(   R   (   R   R9   (   R   (    s   renpy/__init__.pys	   <genexpr>^  s    ('   R.   t	   ExceptionR   Rk   R/   t	   exc_clearR   t   resetR   t   imt   cachet   quitt   loadert   quit_importerR   t   free_memoryR2   t   rendert   screen_rendert
   mark_sweept   drawt   deinitt	   interfaceR   t   py_compile_cachet   configt   reload_modulesR0   RA   R   R   t   anyt   clearR   RT   t   old_py_compile_cachet   reset_moduleR   t   init_importer(   R(   R   R   R9   (    (   R   s   renpy/__init__.pyt
   reload_all-  s@    

c         C  s   d d l  } t j j | j  } x^ d d d d d g D]G } t j j | d |  } t j j |  r7 |  j d	 | |  q7 q7 Wd S(
   sS   
    Informs modulefinder about the location of modules in nonstandard places.
    iNR   R   R   R   R   R(   s   renpy.(   RX   RZ   R[   R\   RV   R_   t   existst   AddPackagePath(   t   modulefinderRX   Rb   R   t   displaypath(    (    s   renpy/__init__.pyt   setup_modulefinderw  s    c          C  s   d d l  }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l	 }  d d l
 }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l }  d d l }  d S(   st   
    Never called, but necessary to ensure that modulefinder will properly
    grab the various cython modules.
    iN(   Rh   t   renpy.display.acceleratorR   t   renpy.gl.glt   renpy.gl.gl1t   renpy.gl.gldrawt   renpy.gl.glenviron_fixedt   renpy.gl.glenviron_limitedt   renpy.gl.glenviron_shadert   renpy.gl.glrtt_copyt   renpy.gl.glrtt_fbot   renpy.gl.gltexturet   renpy.angle.glt   renpy.angle.gldrawt   renpy.angle.glenviron_shadert   renpy.angle.glrtt_copyt   renpy.angle.glrtt_fbot   renpy.angle.gltexture(   R(   (    (    s   renpy/__init__.pyt   import_cython  s$    (    (7   t
   __future__R    R/   RZ   t   copyt   typesR4   t   renpy.vc_versionR   t   ImportErrort   version_tuplet   version_nameR_   t   version_onlyt   versiont   script_versiont   savegame_suffixt   bytecode_versiont   Falset   windowst	   macintosht   linuxt   androidt   iosR&   t   environt   experimentalt   platformR#   t	   win32_vert   Truet   mac_verR.   t   macappt   safe_mode_checkedt
   autoreloadt   sessionR>   t
   ModuleTypeRE   RF   R*   R2   R   Rc   Rg   R   R   R   R  R	  R  R   R   R   (    (    (    s   renpy/__init__.pyt   <module>   s    


	$						h						J		