�
��f$ � � � d dl Z d dlZd dlZd dlmZ d dlZddlmZmZ ddlm Z ddl
mZ ddlm
Z
ej � Zi Zed� � Zd � Z G d
� de� Zy)� N)�contextmanager� )�
Repository�RepositoryError)�PyGIWarning)�get_introspection_module)�load_overridesc # �� K � t j | � }d�� |ry| dv ryt j | � �yt j | � }t j d| |d�z t |�� y�w)aO 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 * sz � �� � �)�)�)�4�J� �� ��.�.�� ���y�)�5���$�$�Y�/�G��M�M� ?� "�g�
6� 7� �
�,�s �A0A2c �v � t j dd }|dk r| rdS dS |dk( r| rdS dS |dk( r| rdS dS | rdS dS ) a2 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& |