mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
Remove python2 support
We have notified application developers this would happen a long time ago and python2 is going to be deprecated very soon now, before 1.18 is going to be released.
This commit is contained in:
parent
acb2da66f5
commit
95b2f64394
3 changed files with 8 additions and 29 deletions
|
@ -34,14 +34,6 @@ from ..module import get_introspection_module
|
||||||
from gi.repository import GLib
|
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')
|
Gst = get_introspection_module('Gst')
|
||||||
|
|
||||||
__all__ = []
|
__all__ = []
|
||||||
|
@ -52,7 +44,7 @@ if Gst._version == '0.10':
|
||||||
was not designed for use with introspection some of the \
|
was not designed for use with introspection some of the \
|
||||||
interfaces and API will fail. As such this is not supported \
|
interfaces and API will fail. As such this is not supported \
|
||||||
by the GStreamer development team and we encourage you to \
|
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"
|
python module to use with Gst 0.10"
|
||||||
|
|
||||||
warnings.warn(warn_msg, RuntimeWarning)
|
warnings.warn(warn_msg, RuntimeWarning)
|
||||||
|
@ -481,10 +473,10 @@ class Int64Range(Gst.Int64Range):
|
||||||
|
|
||||||
class Bitmask(Gst.Bitmask):
|
class Bitmask(Gst.Bitmask):
|
||||||
def __init__(self, v):
|
def __init__(self, v):
|
||||||
if not isinstance(v, long) and not isinstance(v, int):
|
if not isinstance(v, int):
|
||||||
raise TypeError("%s is not an int or long." % (type(v)))
|
raise TypeError("%s is not an int." % (type(v)))
|
||||||
|
|
||||||
self.v = long(v)
|
self.v = int(v)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return hex(self.v)
|
return hex(self.v)
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION >= 3
|
|
||||||
#define PYGLIB_MODULE_START(symbol, modname) \
|
#define PYGLIB_MODULE_START(symbol, modname) \
|
||||||
static struct PyModuleDef _##symbol##module = { \
|
static struct PyModuleDef _##symbol##module = { \
|
||||||
PyModuleDef_HEAD_INIT, \
|
PyModuleDef_HEAD_INIT, \
|
||||||
|
@ -51,15 +50,6 @@ PyMODINIT_FUNC PyInit_##symbol(void) \
|
||||||
PyObject *module; \
|
PyObject *module; \
|
||||||
module = PyModule_Create(&_##symbol##module);
|
module = PyModule_Create(&_##symbol##module);
|
||||||
#define PYGLIB_MODULE_END return 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 (python_debug);
|
||||||
GST_DEBUG_CATEGORY_STATIC (pygst_debug);
|
GST_DEBUG_CATEGORY_STATIC (pygst_debug);
|
||||||
|
@ -81,7 +71,7 @@ gi_gst_get_type (gchar * type_name)
|
||||||
dict = PyModule_GetDict (module);
|
dict = PyModule_GetDict (module);
|
||||||
Py_DECREF (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");
|
module = PyMapping_GetItemString (dict, "_overrides_module");
|
||||||
if (module == NULL) {
|
if (module == NULL) {
|
||||||
PyErr_SetString (PyExc_KeyError,
|
PyErr_SetString (PyExc_KeyError,
|
||||||
|
@ -654,7 +644,6 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level,
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = PyEval_GetFrame ();
|
frame = PyEval_GetFrame ();
|
||||||
#if PY_MAJOR_VERSION >= 3
|
|
||||||
{
|
{
|
||||||
PyObject *utf8;
|
PyObject *utf8;
|
||||||
const gchar *utf8_str;
|
const gchar *utf8_str;
|
||||||
|
@ -671,11 +660,6 @@ pygst_debug_log (PyObject * pyobject, PyObject * string, GstDebugLevel level,
|
||||||
filename = g_strdup (utf8_str);
|
filename = g_strdup (utf8_str);
|
||||||
Py_DECREF (utf8);
|
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);
|
lineno = PyCode_Addr2Line (frame->f_code, frame->f_lasti);
|
||||||
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
|
/* gst_debug_log : category, level, file, function, line, object, format, va_list */
|
||||||
if (isgstobject)
|
if (isgstobject)
|
||||||
|
|
|
@ -24,6 +24,9 @@ pygobject_dep = dependency('pygobject-3.0', fallback: ['pygobject', 'pygobject_d
|
||||||
|
|
||||||
pymod = import('python')
|
pymod = import('python')
|
||||||
python = pymod.find_installation(get_option('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_dep = python.dependency(required : true)
|
||||||
|
|
||||||
python_abi_flags = python.get_variable('ABIFLAGS', '')
|
python_abi_flags = python.get_variable('ABIFLAGS', '')
|
||||||
|
|
Loading…
Reference in a new issue