
    f$                         S SK r S SKrS SKrS SKJr  S SKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  \R                  " 5       r0 r\S 5       rS	 r " S
 S\5      rg)    N)contextmanager   )
RepositoryRepositoryError)PyGIWarning)get_introspection_module)load_overridesc              #      #    [         R                  U 5      nSv   U(       a  gU S;   a  g[        R                  " U 5      b  g[         R	                  U 5      n[
        R                  " SXS.-  [        US9  g7f)a3  A context manager which tries to give helpful warnings
about missing gi.require_version() which could potentially
break code if only an older version than expected is installed
or a new version gets introduced.

::

    with _check_require_version("Gtk", stacklevel):
        load_namespace_and_overrides()
N)GLibGObjectGioz%(namespace)s was imported without specifying a version first. Use gi.require_version('%(namespace)s', '%(version)s') before import to ensure that the right version gets loaded.)	namespaceversion
stacklevel)
repositoryis_registeredgiget_required_versionget_versionwarningswarnr   )r   r   
was_loadedr   s       -/usr/lib/python3/dist-packages/gi/importer.py_check_require_versionr   *   sw      )))4J	 	..	y)5$$Y/GMM	? "
6	7 	
,s   A6A8c                     [         R                  SS nUS::  a  U (       a  S$ S$ US:X  a  U (       a  S$ S$ US:X  a  U (       a  S$ S$ U (       a  S$ S$ )	a  Returns the stacklevel value for warnings.warn() for when the warning
gets emitted by an imported module, but the warning should point at the
code doing the import.

Pass import_hook=True if the warning gets generated by an import hook
(warn() gets called in load_module(), see PEP302)
N   )   r      )r   r      
   )r   r   )sysversion_info)import_hook
py_versions     r   get_import_stacklevelr&   Q   sd     !!"1%JVq&Q&	v	q'R'	v	 r'a'  q&Q&    c                   @    \ rS rSrS rS rS
S jrSS jrS rS r	S	r
g)DynamicImporterg   c                     Xl         g Npath)selfr.   s     r   __init__DynamicImporter.__init__k   s    	r'   c                     UR                  U R                  5      (       d  gUR                  SS5      u  p#X R                  :H  $ )NF.r   )
startswithr.   rsplit)r/   fullnamer.   r   s       r   _find_module_check"DynamicImporter._find_module_checkn   s9    ""499--"//#q1yy  r'   Nc                 n    U R                  U5      (       a  [        R                  R                  X5      $ g r,   )r7   	importlibutilspec_from_loader)r/   r6   r.   targets       r   	find_specDynamicImporter.find_specu   s-    ""8,,>>228BB -r'   c                 4    U R                  U5      (       a  U $ g r,   )r7   )r/   r6   r.   s      r   find_moduleDynamicImporter.find_moduley   s    ""8,,K -r'   c                    UR                   R                  SS5      u  p#[        R                  U5      (       d(  [        R	                  U5      (       d  [        SU-  5      e[        SS9n[        X4S9    [        U5      n[        R                  U5       H.  n[        R                  " SUR                  S5      S	   -   5        M0     [        U5      nS S S 5        U$ ! [         a  n[        U5      eS nAff = f! , (       d  f       W$ = f)
Nr3   r   z6cannot import name %s, introspection typelib not foundT)r$   r   zgi.repository.-r   )namer5   r   r   enumerate_versionsImportErrorr&   r   r   r   get_immediate_dependenciesr:   import_modulesplitr	   )	r/   specr.   r   r   introspection_moduleedepdynamic_modules	            r   create_moduleDynamicImporter.create_module}   s    ))**32
 ''	22--i88 @BKL M M +t<
#IE%'?	'J$ "<<YG''(8399S>!;L(LM H+,@AN F  # %!!n$% FE s1   3C95C AC9
C6&C11C66C99
Dc                     g r,    )r/   r6   s     r   exec_moduleDynamicImporter.exec_module   s    r'   r-   )NNr,   )__name__
__module____qualname____firstlineno__r0   r7   r>   rA   rP   rT   __static_attributes__rS   r'   r   r)   r)   g   s!    !C4r'   r)   )r"   r   r:   
contextlibr   r   _gir   r   r   moduler   	overridesr	   get_defaultr   modulesr   r&   objectr)   rS   r'   r   <module>rb      s_   0    % 	 ,  , % ##%
  #, #,L',2f 2r'   