summaryrefslogtreecommitdiff
path: root/gi/__init__.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:47:05 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:47:08 +0900
commite49df4afb1654f59a39d02e6ec0ecdf537ce9351 (patch)
tree000154f278704965f45c9ae9a7ed8475e4b10ca1 /gi/__init__.py
parent3a2fe8f548bb171295a989bf143f8c7a75715e6e (diff)
downloadpygobject2-e49df4afb1654f59a39d02e6ec0ecdf537ce9351.tar.gz
pygobject2-e49df4afb1654f59a39d02e6ec0ecdf537ce9351.tar.bz2
pygobject2-e49df4afb1654f59a39d02e6ec0ecdf537ce9351.zip
Imported Upstream version 3.3.5
Change-Id: Ib5961d5ca7c3b6c41650123a60433cb2ca0ebd58 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'gi/__init__.py')
-rw-r--r--gi/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/gi/__init__.py b/gi/__init__.py
index c1aba69..b816612 100644
--- a/gi/__init__.py
+++ b/gi/__init__.py
@@ -34,6 +34,22 @@ import os
_versions = {}
_overridesdir = os.path.join(os.path.dirname(__file__), 'overrides')
+version_info = gi._gobject.pygobject_version[:]
+__version__ = "{0}.{1}.{2}".format(*version_info)
+
+
+def check_version(version):
+ if isinstance(version, str):
+ version_list = tuple(map(int, version.split(".")))
+ else:
+ version_list = version
+
+ if version_list > version_info:
+ raise ValueError((
+ "pygobject's version %s required, and available version "
+ "%s is not recent enough") % (version, __version__)
+ )
+
def require_version(namespace, version):
repository = Repository.get_default()