diff --git a/gi/overrides/Gst.py b/gi/overrides/Gst.py index 0f5f2be8b0..3afc9c26c6 100644 --- a/gi/overrides/Gst.py +++ b/gi/overrides/Gst.py @@ -34,14 +34,6 @@ from ..module import get_introspection_module from gi.repository import GLib -if sys.version_info >= (3, 0): - _basestring = str - _callable = lambda c: hasattr(c, '__call__') - long = int -else: - _basestring = basestring - _callable = callable - Gst = get_introspection_module('Gst') __all__ = [] @@ -52,7 +44,7 @@ if Gst._version == '0.10': was not designed for use with introspection some of the \ interfaces and API will fail. As such this is not supported \ by the GStreamer development team and we encourage you to \ -port your app to Gst 1 or greater. gst-python is the recomended \ +port your app to Gst 1 or greater. gst-python is the recommended \ python module to use with Gst 0.10" warnings.warn(warn_msg, RuntimeWarning) @@ -481,10 +473,10 @@ class Int64Range(Gst.Int64Range): class Bitmask(Gst.Bitmask): def __init__(self, v): - if not isinstance(v, long) and not isinstance(v, int): - raise TypeError("%s is not an int or long." % (type(v))) + if not isinstance(v, int): + raise TypeError("%s is not an int." % (type(v))) - self.v = long(v) + self.v = int(v) def __str__(self): return hex(self.v) diff --git a/gi/overrides/gstmodule.c b/gi/overrides/gstmodule.c index a28959fd53..4e26fdbebb 100644 --- a/gi/overrides/gstmodule.c +++ b/gi/overrides/gstmodule.c @@ -32,7 +32,6 @@ #include -#if PY_MAJOR_VERSION >= 3 #define PYGLIB_MODULE_START(symbol, modname) \ static struct PyModuleDef _##symbol##module = { \ PyModuleDef_HEAD_INIT, \ @@ -51,15 +50,6 @@ PyMODINIT_FUNC PyInit_##symbol(void) \ PyObject *module; \ module = PyModule_Create(&_##symbol##module); #define PYGLIB_MODULE_END return module; } -#else -#define PYGLIB_MODULE_START(symbol, modname) \ -DL_EXPORT(void) init##symbol(void); \ -DL_EXPORT(void) init##symbol(void) \ -{ \ - PyObject *module; \ - module = Py_InitModule(modname, symbol##_functions); -#define PYGLIB_MODULE_END } -#endif GST_DEBUG_CATEGORY_STATIC (python_debug); GST_DEBUG_CATEGORY_STATIC (pygst_debug); @@ -81,7 +71,7 @@ gi_gst_get_type (gchar * type_name) dict = PyModule_GetDict (module); Py_DECREF (module); - /* For some reson we need this intermediary step */ + /* For some reason we need this intermediary step */ module = PyMapping_GetItemString (dict, "_overrides_module"); if (module == NULL) { PyErr_SetString (PyExc_KeyError, @@ -654,7 +644,6 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level, } frame = PyEval_GetFrame (); -#if PY_MAJOR_VERSION >= 3 { PyObject *utf8; const gchar *utf8_str; @@ -671,11 +660,6 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level, filename = g_strdup (utf8_str); Py_DECREF (utf8); } -#else - function = g_strdup (PyString_AsString (frame->f_code->co_name)); - filename = - g_path_get_basename (PyString_AsString (frame->f_code->co_filename)); -#endif lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti); /* gst_debug_log : category, level, file, function, line, object, format, va_list */ if (isgstobject) diff --git a/meson.build b/meson.build index 0c0a5ae997..5f13b482ab 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,9 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d pymod = import('python') python = pymod.find_installation(get_option('python')) +if python.language_version().version_compare('<3.0') + error('Python2 is not supported anymore, please port your code to python3 (@0@ specified)'.format(python.language_version())) +endif python_dep = python.dependency(required : true) python_abi_flags = python.get_variable('ABIFLAGS', '')