summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/pyglib-constants.xml50
-rw-r--r--docs/reference/pygobject-constants.xml19
-rw-r--r--gi/_glib/__init__.py2
-rw-r--r--gi/_glib/glibmodule.c21
-rw-r--r--gi/_gobject/__init__.py1
-rw-r--r--gi/overrides/GLib.py8
-rw-r--r--gi/overrides/GObject.py3
-rw-r--r--tests/test_glib.py12
8 files changed, 21 insertions, 95 deletions
diff --git a/docs/reference/pyglib-constants.xml b/docs/reference/pyglib-constants.xml
deleted file mode 100644
index 6f24308c..00000000
--- a/docs/reference/pyglib-constants.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
-
-<refentry id="glib-constants">
- <refnamediv>
- <refname>glib Constants</refname>
- <refpurpose>the built-in constants of the glib module</refpurpose>
- </refnamediv>
-
- <refsect1>
- <title>Synopsis</title>
-
- <programlisting>
-<xref linkend="glib-version-constants" endterm="glib-version-constants-title"></xref>
-</programlisting>
-
- </refsect1>
-
- <refsect1 id="glib-constants-description">
- <title>Description</title>
-
- <refsect2 id="glib-version-constants">
- <title id="glib-version-constants-title">Glib Version Constants</title>
- <para>The Version constants specify the version of
-<literal>Glib</literal> used by PyGObject as a 3-tuple containing the major,
-minor and patch release numbers.</para>
-
- <variablelist>
- <varlistentry>
- <term><literal>glib.glib_version</literal></term>
- <listitem>
- <simpara>A 3-tuple containing (major, minor, patch) release
- numbers of glib.</simpara>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term><literal>glib.pyglib_version</literal></term>
- <listitem>
- <simpara>A 3-tuple containing (major, minor, patch) release
- numbers of the python bindings.</simpara>
- </listitem>
- </varlistentry>
- </variablelist>
-
- </refsect2>
-
- </refsect1>
-
-</refentry>
diff --git a/docs/reference/pygobject-constants.xml b/docs/reference/pygobject-constants.xml
index 07c3fddb..ed217f7b 100644
--- a/docs/reference/pygobject-constants.xml
+++ b/docs/reference/pygobject-constants.xml
@@ -299,25 +299,6 @@ by gobject.</para>
</refsect2>
- <refsect2 id="gobject-version-constants">
- <title id="gobject-version-constants-title">GObject Version Constants</title>
-
- <para>The Version constants specify the version of
-<literal>GLIB</literal> used by PyGTK as a 3-tuple containing the major,
-minor and patch release numbers.</para>
-
- <variablelist>
- <varlistentry>
- <term><literal>gobject.glib_version</literal></term>
- <listitem>
- <simpara>A 3-tuple containing (major, minor, patch) release
- numbers.</simpara>
- </listitem>
- </varlistentry>
- </variablelist>
-
- </refsect2>
-
</refsect1>
</refentry>
diff --git a/gi/_glib/__init__.py b/gi/_glib/__init__.py
index 236aaafa..9faefb64 100644
--- a/gi/_glib/__init__.py
+++ b/gi/_glib/__init__.py
@@ -46,7 +46,5 @@ OPTION_REMAINING = _glib.OPTION_REMAINING
# Functions
filename_from_utf8 = _glib.filename_from_utf8
-glib_version = _glib.glib_version
-pyglib_version = _glib.pyglib_version
spawn_async = _glib.spawn_async
threads_init = _glib.threads_init
diff --git a/gi/_glib/glibmodule.c b/gi/_glib/glibmodule.c
index b360ec1b..765fd5bf 100644
--- a/gi/_glib/glibmodule.c
+++ b/gi/_glib/glibmodule.c
@@ -139,26 +139,6 @@ pyglib_register_error(PyObject *d)
}
static void
-pyglib_register_version_tuples(PyObject *d)
-{
- PyObject *o;
-
- /* glib version */
- o = Py_BuildValue("(iii)", glib_major_version, glib_minor_version,
- glib_micro_version);
- PyDict_SetItemString(d, "glib_version", o);
- Py_DECREF(o);
-
- /* pyglib version */
- o = Py_BuildValue("(iii)",
- PYGLIB_MAJOR_VERSION,
- PYGLIB_MINOR_VERSION,
- PYGLIB_MICRO_VERSION);
- PyDict_SetItemString(d, "pyglib_version", o);
- Py_DECREF(o);
-}
-
-static void
pyglib_register_constants(PyObject *m)
{
PyModule_AddIntConstant(m, "OPTION_FLAG_HIDDEN",
@@ -196,7 +176,6 @@ PYGLIB_MODULE_START(_glib, "_glib")
pyglib_register_constants(module);
pyglib_register_api(d);
pyglib_register_error(d);
- pyglib_register_version_tuples(d);
pyglib_source_register_types(d);
pyglib_spawn_register_types(d);
pyglib_option_context_register_types(d);
diff --git a/gi/_gobject/__init__.py b/gi/_gobject/__init__.py
index e0c08d83..2493cff1 100644
--- a/gi/_gobject/__init__.py
+++ b/gi/_gobject/__init__.py
@@ -85,7 +85,6 @@ spawn_async = _glib.spawn_async
filename_from_utf8 = _glib.filename_from_utf8
Pid = _glib.Pid
GError = _glib.GError
-glib_version = _glib.glib_version
OptionGroup = _glib.OptionGroup
OptionContext = _glib.OptionContext
diff --git a/gi/overrides/GLib.py b/gi/overrides/GLib.py
index 2c03b6a0..cb4a26b3 100644
--- a/gi/overrides/GLib.py
+++ b/gi/overrides/GLib.py
@@ -26,7 +26,7 @@ from ..module import get_introspection_module
from .._gi import (variant_new_tuple, variant_type_from_string, source_new,
source_set_callback, io_channel_read)
from ..overrides import override, deprecated
-from gi import PyGIDeprecationWarning
+from gi import PyGIDeprecationWarning, version_info
GLib = get_introspection_module('GLib')
@@ -802,6 +802,12 @@ get_current_time = deprecated(get_current_time, 'GLib.get_real_time()')
__all__.append('get_current_time')
+# obsolete constants for backwards compatibility
+glib_version = (GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)
+__all__.append('glib_version')
+pyglib_version = version_info
+__all__.append('pyglib_version')
+
# work around wrong constants in GLib GIR, see
# https://bugzilla.gnome.org/show_bug.cgi?id=685022
MININT64 = -9223372036854775808
diff --git a/gi/overrides/GObject.py b/gi/overrides/GObject.py
index 0f2159b3..704aa01f 100644
--- a/gi/overrides/GObject.py
+++ b/gi/overrides/GObject.py
@@ -48,7 +48,8 @@ for name in ['PRIORITY_DEFAULT', 'PRIORITY_DEFAULT_IDLE', 'PRIORITY_HIGH',
'SPAWN_LEAVE_DESCRIPTORS_OPEN', 'SPAWN_DO_NOT_REAP_CHILD',
'SPAWN_SEARCH_PATH', 'SPAWN_STDOUT_TO_DEV_NULL',
'SPAWN_STDERR_TO_DEV_NULL', 'SPAWN_CHILD_INHERITS_STDIN',
- 'SPAWN_FILE_AND_ARGV_ZERO']:
+ 'SPAWN_FILE_AND_ARGV_ZERO',
+ 'glib_version']:
globals()[name] = getattr(GLib, name)
__all__.append(name)
diff --git a/tests/test_glib.py b/tests/test_glib.py
index 59004ae0..336cc8e7 100644
--- a/tests/test_glib.py
+++ b/tests/test_glib.py
@@ -179,3 +179,15 @@ https://my.org/q?x=1&y=2
self.assertEqual(call_data, [(cmd.stdout, GLib.IOCondition.IN, b'hello\n'),
(cmd.stdout, GLib.IOCondition.IN, b'world\n')])
+
+ def test_glib_version(self):
+ (major, minor, micro) = GLib.glib_version
+ self.assertGreaterEqual(major, 2)
+ self.assertGreaterEqual(minor, 0)
+ self.assertGreaterEqual(micro, 0)
+
+ def test_pyglib_version(self):
+ (major, minor, micro) = GLib.pyglib_version
+ self.assertGreaterEqual(major, 3)
+ self.assertGreaterEqual(minor, 7)
+ self.assertGreaterEqual(micro, 2)