Commit c2aa6f0d authored by Martin Pitt's avatar Martin Pitt
Browse files

Move G_MIN/MAX constants into GObject overrides

These really ought to come from GLib's typelib, but are not right now so we
need to keep the static bindings for those. But drop them from gi/_gobject/ and
move them into the overrides where they belong.
parent 12b84727
......@@ -65,23 +65,6 @@ TYPE_GTYPE = constants.TYPE_GTYPE
TYPE_UNICHAR = constants.TYPE_UNICHAR
TYPE_STRV = constants.TYPE_STRV
TYPE_VARIANT = constants.TYPE_VARIANT
G_MINFLOAT = constants.G_MINFLOAT
G_MAXFLOAT = constants.G_MAXFLOAT
G_MINDOUBLE = constants.G_MINDOUBLE
G_MAXDOUBLE = constants.G_MAXDOUBLE
G_MINSHORT = constants.G_MINSHORT
G_MAXSHORT = constants.G_MAXSHORT
G_MAXUSHORT = constants.G_MAXUSHORT
G_MININT = constants.G_MININT
G_MAXINT = constants.G_MAXINT
G_MAXUINT = constants.G_MAXUINT
G_MINLONG = constants.G_MINLONG
G_MAXLONG = constants.G_MAXLONG
G_MAXULONG = constants.G_MAXULONG
G_MAXSIZE = constants.G_MAXSIZE
G_MAXSSIZE = constants.G_MAXSSIZE
G_MINOFFSET = constants.G_MINOFFSET
G_MAXOFFSET = constants.G_MAXOFFSET
class GObjectMeta(type):
......
......@@ -47,24 +47,3 @@ TYPE_GTYPE = _gobject.type_from_name('GType')
TYPE_STRV = _gobject.type_from_name('GStrv')
TYPE_VARIANT = _gobject.type_from_name('GVariant')
TYPE_UNICHAR = TYPE_UINT
# do a little dance to maintain API compatibility
# as these were origianally defined here, and are
# now defined in gobjectmodule.c
G_MINFLOAT = _gobject.G_MINFLOAT
G_MAXFLOAT = _gobject.G_MAXFLOAT
G_MINDOUBLE = _gobject.G_MINDOUBLE
G_MAXDOUBLE = _gobject.G_MAXDOUBLE
G_MINSHORT = _gobject.G_MINSHORT
G_MAXSHORT = _gobject.G_MAXSHORT
G_MAXUSHORT = _gobject.G_MAXUSHORT
G_MININT = _gobject.G_MININT
G_MAXINT = _gobject.G_MAXINT
G_MAXUINT = _gobject.G_MAXUINT
G_MINLONG = _gobject.G_MINLONG
G_MAXLONG = _gobject.G_MAXLONG
G_MAXULONG = _gobject.G_MAXULONG
G_MAXSIZE = _gobject.G_MAXSIZE
G_MAXSSIZE = _gobject.G_MAXSSIZE
G_MINOFFSET = _gobject.G_MINOFFSET
G_MAXOFFSET = _gobject.G_MAXOFFSET
......@@ -30,7 +30,7 @@ from .constants import \
TYPE_FLOAT, TYPE_DOUBLE, TYPE_STRING, \
TYPE_POINTER, TYPE_BOXED, TYPE_PARAM, TYPE_OBJECT, \
TYPE_PYOBJECT, TYPE_GTYPE, TYPE_STRV
from .constants import \
from ._gobject import \
G_MAXFLOAT, G_MAXDOUBLE, \
G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
G_MAXULONG
......
......@@ -90,6 +90,15 @@ __all__ += ['G_MININT8', 'G_MAXINT8', 'G_MAXUINT8', 'G_MININT16',
'G_MAXINT16', 'G_MAXUINT16', 'G_MININT32', 'G_MAXINT32',
'G_MAXUINT32', 'G_MININT64', 'G_MAXINT64', 'G_MAXUINT64']
# these are not currently exported in GLib gir, presumably because they are
# platform dependent; so get them from our static bindings
for name in ['G_MINFLOAT', 'G_MAXFLOAT', 'G_MINDOUBLE', 'G_MAXDOUBLE',
'G_MINSHORT', 'G_MAXSHORT', 'G_MAXUSHORT', 'G_MININT', 'G_MAXINT',
'G_MAXUINT', 'G_MINLONG', 'G_MAXLONG', 'G_MAXULONG', 'G_MAXSIZE',
'G_MAXSSIZE', 'G_MINOFFSET', 'G_MAXOFFSET']:
globals()[name] = getattr(_gobject, name)
__all__.append(name)
TYPE_INVALID = GObjectModule.type_from_name('invalid')
TYPE_NONE = GObjectModule.type_from_name('void')
......
......@@ -334,8 +334,8 @@ class TestUInt64(unittest.TestCase):
class TestShort(unittest.TestCase):
MAX = GObject.constants.G_MAXSHORT
MIN = GObject.constants.G_MINSHORT
MAX = GObject.G_MAXSHORT
MIN = GObject.G_MINSHORT
def test_short_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.short_return_max())
......@@ -367,7 +367,7 @@ class TestShort(unittest.TestCase):
class TestUShort(unittest.TestCase):
MAX = GObject.constants.G_MAXUSHORT
MAX = GObject.G_MAXUSHORT
def test_ushort_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.ushort_return())
......@@ -393,8 +393,8 @@ class TestUShort(unittest.TestCase):
class TestInt(unittest.TestCase):
MAX = GObject.constants.G_MAXINT
MIN = GObject.constants.G_MININT
MAX = GObject.G_MAXINT
MIN = GObject.G_MININT
def test_int_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.int_return_max())
......@@ -427,7 +427,7 @@ class TestInt(unittest.TestCase):
class TestUInt(unittest.TestCase):
MAX = GObject.constants.G_MAXUINT
MAX = GObject.G_MAXUINT
def test_uint_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.uint_return())
......@@ -453,8 +453,8 @@ class TestUInt(unittest.TestCase):
class TestLong(unittest.TestCase):
MAX = GObject.constants.G_MAXLONG
MIN = GObject.constants.G_MINLONG
MAX = GObject.G_MAXLONG
MIN = GObject.G_MINLONG
def test_long_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.long_return_max())
......@@ -486,7 +486,7 @@ class TestLong(unittest.TestCase):
class TestULong(unittest.TestCase):
MAX = GObject.constants.G_MAXULONG
MAX = GObject.G_MAXULONG
def test_ulong_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.ulong_return())
......@@ -512,8 +512,8 @@ class TestULong(unittest.TestCase):
class TestSSize(unittest.TestCase):
MAX = GObject.constants.G_MAXLONG
MIN = GObject.constants.G_MINLONG
MAX = GObject.G_MAXLONG
MIN = GObject.G_MINLONG
def test_ssize_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.ssize_return_max())
......@@ -545,7 +545,7 @@ class TestSSize(unittest.TestCase):
class TestSize(unittest.TestCase):
MAX = GObject.constants.G_MAXULONG
MAX = GObject.G_MAXULONG
def test_size_return(self):
self.assertEqual(self.MAX, GIMarshallingTests.size_return())
......@@ -571,8 +571,8 @@ class TestSize(unittest.TestCase):
class TestFloat(unittest.TestCase):
MAX = GObject.constants.G_MAXFLOAT
MIN = GObject.constants.G_MINFLOAT
MAX = GObject.G_MAXFLOAT
MIN = GObject.G_MINFLOAT
def test_float_return(self):
self.assertAlmostEqual(self.MAX, GIMarshallingTests.float_return())
......@@ -591,8 +591,8 @@ class TestFloat(unittest.TestCase):
class TestDouble(unittest.TestCase):
MAX = GObject.constants.G_MAXDOUBLE
MIN = GObject.constants.G_MINDOUBLE
MAX = GObject.G_MAXDOUBLE
MIN = GObject.G_MINDOUBLE
def test_double_return(self):
self.assertAlmostEqual(self.MAX, GIMarshallingTests.double_return())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment