summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2001-11-28 10:22:36 +0000
committerJames Henstridge <jamesh@src.gnome.org>2001-11-28 10:22:36 +0000
commit7e8692ee82238ae179c7375077594a7bf4038f8d (patch)
tree9a4cdc723729139783be8fec75f00412fe90fde3
parent8a3a08cd4ce4a6541b4c9b352d48a98f71a67639 (diff)
downloadpygtk-7e8692ee82238ae179c7375077594a7bf4038f8d.tar.gz
special case GdkAtom return values from functions.
2001-11-28 James Henstridge <james@daa.com.au> * generate/generate.py (FunctionDefsParser.define_func): special case GdkAtom return values from functions. * gtkmodule.c (_wrap__disable_gdk_threading): add function for disabling GDK threading. (init_gtk): remove the environment variable check, in favour of the more convenient _disable_gdk_threading() function. * configure.in: update configure.in for 2.52. 2001-11-28 James Henstridge <james@daa.com.au> * configure.in: update configure.in for autoconf 2.52.
-rw-r--r--ChangeLog12
-rw-r--r--Makefile.am2
-rw-r--r--acinclude.m4134
-rw-r--r--configure.in18
-rw-r--r--generate/generate.py8
-rw-r--r--gtk.py1
-rw-r--r--gtkmodule.c27
7 files changed, 51 insertions, 151 deletions
diff --git a/ChangeLog b/ChangeLog
index 563ba0b8..5a4ade3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-11-28 James Henstridge <james@daa.com.au>
+
+ * generate/generate.py (FunctionDefsParser.define_func): special
+ case GdkAtom return values from functions.
+
+ * gtkmodule.c (_wrap__disable_gdk_threading): add function for
+ disabling GDK threading.
+ (init_gtk): remove the environment variable check, in favour of
+ the more convenient _disable_gdk_threading() function.
+
+ * configure.in: update configure.in for 2.52.
+
2001-10-10 Johan Dahlin <zilch.am@home.se>
Patch from Christian Reis <kiko@async.com.br>
diff --git a/Makefile.am b/Makefile.am
index 45cdafd2..7fbe10fd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-AUTOMAKE_OPTIONS = 1.4a
+AUTOMAKE_OPTIONS = 1.5
SUBDIRS = generate pyglade
diff --git a/acinclude.m4 b/acinclude.m4
index 6a32dabf..c1e31aae 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,137 +1,3 @@
-## ------------------------
-## Python file handling
-## From Andrew Dalke
-## Updated by James Henstridge
-## ------------------------
-
-# AM_PATH_PYTHON([MINIMUM-VERSION])
-
-# Adds support for distributing Python modules and packages. To
-# install modules, copy them to $(pythondir), using the python_PYTHON
-# automake variable. To install a package with the same name as the
-# automake package, install to $(pkgpythondir), or use the
-# pkgpython_PYTHON automake variable.
-
-# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
-# locations to install python extension modules (shared libraries).
-# Another macro is required to find the appropriate flags to compile
-# extension modules.
-
-# If your package is configured with a different prefix to python,
-# users will have to add the install directory to the PYTHONPATH
-# environment variable, or create a .pth file (see the python
-# documentation for details).
-
-# If the MINIUMUM-VERSION argument is passed, AM_PATH_PYTHON will
-# cause an error if the version of python installed on the system
-# doesn't meet the requirement. MINIMUM-VERSION should consist of
-# numbers and dots only.
-
-
-AC_DEFUN([AM_PATH_PYTHON_JH],
- [
- AC_PROVIDE([AM_PATH_PYTHON])
- dnl Find a version of Python. I could check for python versions 1.4
- dnl or earlier, but the default installation locations changed from
- dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
- dnl in 1.5, and I don't want to maintain that logic.
-
- AC_PATH_PROG(PYTHON, python python2.1 python2.0 python1.6 python1.5)
-
- dnl should we do the version check?
- ifelse([$1],[],,[
- AC_MSG_CHECKING(if Python version >= $1)
- changequote(<<, >>)dnl
- prog="
-import sys, string
-minver = '$1'
-pyver = string.split(sys.version)[0] # first word is version string
-# split strings by '.' and convert to numeric
-minver = map(string.atoi, string.split(minver, '.'))
-if hasattr(sys, 'version_info'):
- pyver = sys.version_info[:3]
-else:
- pyver = map(string.atoi, string.split(pyver, '.'))
-# we can now do comparisons on the two lists:
-if pyver >= minver:
- sys.exit(0)
-else:
- sys.exit(1)"
- changequote([, ])dnl
- if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
- then
- AC_MSG_RESULT(okay)
- else
- AC_MSG_ERROR(too old)
- fi
- ])
-
- AC_MSG_CHECKING([local Python configuration])
-
- dnl Query Python for its version number. Getting [:3] seems to be
- dnl the best way to do this; it's what "site.py" does in the standard
- dnl library. Need to change quote character because of [:3]
-
- AC_SUBST(PYTHON_VERSION)
- changequote(<<, >>)dnl
- PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
- changequote([, ])dnl
-
-
- dnl Use the values of $prefix and $exec_prefix for the corresponding
- dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
- dnl distinct variables so they can be overridden if need be. However,
- dnl general consensus is that you shouldn't need this ability.
-
- AC_SUBST(PYTHON_PREFIX)
- PYTHON_PREFIX='${prefix}'
-
- AC_SUBST(PYTHON_EXEC_PREFIX)
- PYTHON_EXEC_PREFIX='${exec_prefix}'
-
- dnl At times (like when building shared libraries) you may want
- dnl to know which OS platform Python thinks this is.
-
- AC_SUBST(PYTHON_PLATFORM)
- PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
-
-
- dnl Set up 4 directories:
-
- dnl pythondir -- where to install python scripts. This is the
- dnl site-packages directory, not the python standard library
- dnl directory like in previous automake betas. This behaviour
- dnl is more consistent with lispdir.m4 for example.
- dnl
- dnl Also, if the package prefix isn't the same as python's prefix,
- dnl then the old $(pythondir) was pretty useless.
-
- AC_SUBST(pythondir)
- pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
-
- dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
- dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
- dnl more consistent with the rest of automake.
- dnl Maybe this should be put in python.am?
-
- AC_SUBST(pkgpythondir)
- pkgpythondir=\${pythondir}/$PACKAGE
-
- dnl pyexecdir -- directory for installing python extension modules
- dnl (shared libraries) Was PYTHON_SITE_EXEC in previous betas.
-
- AC_SUBST(pyexecdir)
- pyexecdir=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
-
- dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
- dnl Maybe this should be put in python.am?
-
- AC_SUBST(pkgpyexecdir)
- pkgpyexecdir=\${pyexecdir}/$PACKAGE
-
- AC_MSG_RESULT([looks good])
-])
-
## this one is commonly used with AM_PATH_PYTHONDIR ...
dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
dnl Check if a module containing a given symbol is visible to python.
diff --git a/configure.in b/configure.in
index 67f2b03a..afcee32e 100644
--- a/configure.in
+++ b/configure.in
@@ -1,12 +1,16 @@
-AC_INIT(gtkmodule.c)
+-*- mode: m4 -*-
+AC_PREREQ(2.52)
+AC_INIT(pygtk, 0.6.8,
+ [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-python&component=pygtk])
+AC_CONFIG_SRCDIR([gtkmodule.c])
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(pygtk, 0.6.8)
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
-AM_PATH_PYTHON_JH(1.5.2)
+AM_PATH_PYTHON(1.5.2)
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
AC_ARG_ENABLE(thread,
@@ -54,15 +58,15 @@ if test "x$enable_numpy" != xno; then
AC_DEFINE(HAVE_EXTENSIONS_ARRAYOBJECT_H)],
[AC_CHECK_HEADER(Numeric/arrayobject.h,
[AC_DEFINE(HAVE_NUMPY)
- AC_DEFINE(HAVE_NUMERIC_ARRAYOBJECT_H)])])])
+ AC_DEFINE(HAVE_NUMERIC_ARRAYOBJECT_H)],[])])])
CPPFLAGS="$save_CPPFLAGS"
fi
-AC_OUTPUT(
-Makefile
+AC_CONFIG_FILES([Makefile
generate/Makefile
generate/pygtk-codegen-1.2
pyglade/Makefile
-)
+])
+AC_OUTPUT
diff --git a/generate/generate.py b/generate/generate.py
index 42374696..aec61eb4 100644
--- a/generate/generate.py
+++ b/generate/generate.py
@@ -245,11 +245,13 @@ class FunctionDefsParser(TypesParser):
# this is needed so we can free result string
varDefs.add('gchar', '*ret')
varDefs.add('PyObject', '*py_ret')
- if retType == 'static_string':
+ elif retType == 'static_string':
varDefs.add('gchar', '*ret')
- if retType in objects.keys():
+ elif retType in objects.keys():
varDefs.add('GtkObject', '*ret')
- if retType in boxed.keys():
+ elif retType == 'GdkAtom':
+ varDefs.add('GdkAtom', 'ret')
+ elif retType in boxed.keys():
varDefs.add(retType, '*ret')
for arg in args:
argType = arg[0]
diff --git a/gtk.py b/gtk.py
index 14f652ea..fa2668c3 100644
--- a/gtk.py
+++ b/gtk.py
@@ -2880,3 +2880,4 @@ def _window_new(parent, attribs):
return _gtk.gdk_window_new(parent, attribs)
+_disable_gdk_threading = _gtk._disable_gdk_threading
diff --git a/gtkmodule.c b/gtkmodule.c
index b2f17809..dc6b0d74 100644
--- a/gtkmodule.c
+++ b/gtkmodule.c
@@ -70,7 +70,7 @@
#ifdef ENABLE_PYGTK_THREADING
static GStaticPrivate pythreadstate_key = G_STATIC_PRIVATE_INIT;
static GStaticPrivate counter_key = G_STATIC_PRIVATE_INIT;
-static int disable_threads;
+static gboolean disable_threads = FALSE;
/* The global Python lock will be grabbed by Python when entering a
* Python/C function; thus, the initial lock count will always be one.
@@ -6840,7 +6840,21 @@ static PyObject *_wrap_gdk_window_new(PyObject *self, PyObject *args) {
return pygdk_win;
}
+static PyObject *
+_wrap__disable_gdk_threading(PyObject *self, PyObject *args)
+{
+ if (!PyArg_ParseTuple(args, ":_disable_gdk_threading"))
+ return NULL;
+#if ENABLE_PYGTK_THREADING
+ disable_threads = TRUE;
+ gdk_threads_mutex = NULL;
+#endif
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef _gtkmoduleMethods[] = {
+ { "_disable_gdk_threading", _wrap__disable_gdk_threading, 1 },
{ "gtk_signal_connect", _wrap_gtk_signal_connect, 1 },
{ "gtk_signal_connect_after", _wrap_gtk_signal_connect_after, 1 },
{ "gtk_signal_connect_object", _wrap_gtk_signal_connect_object, 1 },
@@ -7164,11 +7178,12 @@ void init_gtk() {
Py_DECREF(d);
}
-#ifdef WITH_THREAD
- /* it is required that this function be called to enable the thread
- * safety functions */
- disable_threads = getenv("PYGTK_NO_THREADS") != NULL ? 1 : 0;
- if ( !g_threads_got_initialized && !disable_threads )
+#ifdef ENABLE_PYGTK_THREADING
+ /* it is required that this function be called to enable the
+ * thread safety functions. The _gtk._disable_gdk_threading()
+ * function can be used to set the GDK thread lock mutex back to
+ * NULL, if threaded behaviour is not desired. */
+ if ( !g_threads_got_initialized)
g_thread_init(NULL);
#endif