Commit 54a1c9d3 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

if we don't find the python headers (even if we found python), disable

* configure.in: if we don't find the python headers (even if we found python),
	disable compilation of python bindings (bug #116756).  Make the checks
	for python support sequential for easier maintenance.
* python/vte.defs: add def for vte_terminal_match_set_cursor_type.  Make the
	color argument to vte_terminal_set_background_tint_color const.
* python/vte.override(_wrap_vte_terminal_forkpty): add.
* python/vte.override(_wrap_vte_terminal_fork_command): don't leak envv.
parent 23eec875
2003-08-13 nalin
* configure.in: if we don't find the python headers (even if we found
python), disable compilation of python bindings (bug #116756). Make the
checks for python support sequential for easier maintenance.
* python/vte.defs: add def for vte_terminal_match_set_cursor_type. Make
the color argument to vte_terminal_set_background_tint_color const.
* python/vte.override(_wrap_vte_terminal_forkpty): add.
* python/vte.override(_wrap_vte_terminal_fork_command): don't leak envv.
2003-08-13 nalin
* src/vte.c(vte_terminal_fork_command,vte_terminal_forkpty): doc update
to note that directory and envv can be NULL for both.
......
......@@ -306,46 +306,57 @@ AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is
BUILD_PYTHON=true
AC_ARG_ENABLE(python, [ --enable-python Build python bindings [default=yes]],[
if test x"$enableval" != xno ; then
BUILD_PYTHON=true
BUILD_PYTHON=true
else
BUILD_PYTHON=false
fi],BUILD_PYTHON=true)
AM_CHECK_PYTHON_HEADERS
if test -z "$PYTHON" ; then
AC_MSG_RESULT([python not found, disabling bindings])
BUILD_PYTHON=false
fi],BUILD_PYTHON=true)
if $BUILD_PYTHON ; then
AM_PATH_PYTHON
if test -z "$PYTHON" ; then
BUILD_PYTHON=false
fi
fi
if $BUILD_PYTHON ; then
AC_MSG_CHECKING([for pygtk-2.0])
if pkg-config --exists pygtk-2.0 ; then
AC_MSG_RESULT([found])
PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])
PYGTK_DATADIR=`pkg-config --variable=datadir pygtk-2.0`
AC_SUBST(PYGTK_DATADIR)
AC_MSG_CHECKING(for python >= 2.2)
prog="
AC_MSG_CHECKING(for python >= 2.2)
prog="
import sys, string
minver = (2,2,0,'final',0)
if sys.version_info < minver:
sys.exit(1)
sys.exit(0)
"
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
then
AC_MSG_RESULT([okay])
AM_CHECK_PYTHON_HEADERS([BUILD_PYTHON=true],
[AC_MSG_RESULT(could not find Python headers)])
else
BUILD_PYTHON=false
AC_MSG_RESULT([too old])
fi
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
then
AC_MSG_RESULT([okay])
else
BUILD_PYTHON=false
AC_MSG_RESULT([too old])
fi
fi
if $BUILD_PYTHON ; then
AM_CHECK_PYTHON_HEADERS(,BUILD_PYTHON=false)
fi
if $BUILD_PYTHON ; then
AC_MSG_CHECKING([for pygtk-2.0])
if pkg-config --exists pygtk-2.0 ; then
AC_MSG_RESULT([found])
PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])
PYGTK_DATADIR=`pkg-config --variable=datadir pygtk-2.0`
AC_SUBST(PYGTK_DATADIR)
else
AC_MSG_RESULT([not found])
BUILD_PYTHON=false
fi
else
fi
if ! $BUILD_PYTHON ; then
AC_MSG_RESULT([Python bindings disabled.])
fi
AC_SUBST(PYTHONREV)
AC_SUBST(PYTHONMODULES)
AM_CONDITIONAL(BUILD_PYTHON_MODULES, $BUILD_PYTHON)
......
......@@ -55,6 +55,19 @@
)
)
(define-method forkpty
(of-object "VteTerminal")
(c-name "vte_terminal_forkpty")
(return-type "pid_t")
(parameters
'("char**" "envv")
'("const-char*" "directory")
'("gboolean" "lastlog")
'("gboolean" "utmp")
'("gboolean" "wtmp")
)
)
(define-method feed
(of-object "VteTerminal")
(c-name "vte_terminal_feed")
......@@ -243,7 +256,7 @@
(c-name "vte_terminal_set_background_tint_color")
(return-type "none")
(parameters
'("GdkColor*" "color")
'("const-GdkColor*" "color")
)
)
......@@ -459,6 +472,16 @@
)
)
(define-method match_set_cursor_type
(of-object "VteTerminal")
(c-name "vte_terminal_match_set_cursor_type")
(return-type "none")
(parameters
'("int" "tag")
'("GdkCursorType" "cursor_type")
)
)
(define-method match_remove
(of-object "VteTerminal")
(c-name "vte_terminal_match_remove")
......
......@@ -136,6 +136,10 @@ _wrap_vte_terminal_fork_command(PyGObject * self, PyObject * args,
(logwtmp != NULL) &&
PyObject_IsTrue(logwtmp));
if (envv) {
g_free(envv);
}
if (argv) {
g_free(argv);
}
......@@ -143,6 +147,57 @@ _wrap_vte_terminal_fork_command(PyGObject * self, PyObject * args,
return PyInt_FromLong(pid);
}
%%
static PyObject *
_wrap_vte_terminal_forkpty(PyGObject * self, PyObject * args, PyObject * kwargs)
{
gchar **envv = NULL, *directory = NULL;
static char *kwlist[] = { "envv", "directory",
"loglastlog", "logutmp", "logwtmp",
NULL };
PyObject *py_envv = NULL,
*loglastlog = NULL, *logutmp = NULL, *logwtmp = NULL;
int i, n_args, n_envs;
pid_t pid;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OsOOO:forkpty",
kwlist, &py_envv, &directory,
&loglastlog, &logutmp, &logwtmp)) {
return NULL;
}
if (py_envv != NULL && py_envv != Py_None) {
if (!PySequence_Check(py_envv)) {
PyErr_SetString(PyExc_TypeError,
"envv must be a sequence");
return NULL;
}
n_envs = PySequence_Length(py_envv);
envv = g_new(gchar *, n_envs + 1);
for (i = 0; i < n_envs; i++) {
PyObject *item = PySequence_GetItem(py_envv, i);
Py_DECREF(item); /* PySequence_GetItem INCREF's */
envv[i] = PyString_AsString(item);
}
envv[n_envs] = NULL;
}
pid = vte_terminal_forkpty(VTE_TERMINAL(self->obj),
envv, directory,
(loglastlog != NULL) &&
PyObject_IsTrue(loglastlog),
(logutmp != NULL) &&
PyObject_IsTrue(logutmp),
(logwtmp != NULL) &&
PyObject_IsTrue(logwtmp));
if (envv) {
g_free(envv);
}
return PyInt_FromLong(pid);
}
%%
override vte_terminal_get_cursor_position noargs
static PyObject *
......
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