summaryrefslogtreecommitdiff
path: root/giscanner
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-11-04 13:12:12 -0400
committerColin Walters <walters@verbum.org>2010-11-09 13:56:43 -0500
commitf43f3a722323448dfce514a2b435390fd837ddee (patch)
treeebc3b6ebf329848a92d467b050ca8abf5e2e2daf /giscanner
parent2681a9dcb1182d8b0fc34fbb341d77a0a13c65f2 (diff)
downloadgobject-introspection-f43f3a722323448dfce514a2b435390fd837ddee.tar.gz
Switch to nonrecursive make for core (i.e. not tests/)
This is cleaner and faster, and prepares us better for an incoming import of CMPH.
Diffstat (limited to 'giscanner')
-rw-r--r--giscanner/Makefile.am87
-rw-r--r--giscanner/giscannermodule.c10
-rw-r--r--giscanner/sourcescanner.py10
-rwxr-xr-xgiscanner/xmlwriter.py7
4 files changed, 21 insertions, 93 deletions
diff --git a/giscanner/Makefile.am b/giscanner/Makefile.am
deleted file mode 100644
index 2779b70c..00000000
--- a/giscanner/Makefile.am
+++ /dev/null
@@ -1,87 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-INCLUDES = -I$(top_srcdir)/girepository
-BUILT_SOURCES = \
- scannerparser.c \
- scannerparser.h \
- scannerlexer.c \
- scannerlexer.h
-
-CLEANFILES = \
- scannerparser.c \
- scannerparser.h \
- scannerlexer.c \
- scannerlexer.h
-AM_YFLAGS = -d -t
-
-# Why do I have to do this automake?
-scannerlexer.h: scannerlexer.c
-
-noinst_LTLIBRARIES = libgiscanner.la
-
-libgiscanner_la_SOURCES = \
- sourcescanner.c \
- sourcescanner.h \
- scannerlexer.l \
- scannerparser.y \
- grealpath.h
-libgiscanner_la_LIBADD = $(GOBJECT_LIBS)
-libgiscanner_la_CFLAGS = $(GOBJECT_CFLAGS)
-
-# Python module
-pkgpyexecdir = $(pkglibdir)/giscanner
-pkgpyexec_LTLIBRARIES = _giscanner.la
-pkgpyexec_PYTHON = \
- __init__.py \
- annotationmain.py \
- annotationparser.py \
- ast.py \
- cachestore.py \
- codegen.py \
- config.py \
- dumper.py \
- introspectablepass.py \
- girparser.py \
- girwriter.py \
- gdumpparser.py \
- libtoolimporter.py \
- odict.py \
- maintransformer.py \
- message.py \
- shlibs.py \
- scannermain.py \
- sourcescanner.py \
- testcodegen.py \
- transformer.py \
- utils.py \
- xmlwriter.py
-
-_giscanner_la_CFLAGS = \
- $(PYTHON_INCLUDES) \
- $(GOBJECT_CFLAGS) \
- -I$(top_srcdir)/giscanner
-_giscanner_la_LIBADD = libgiscanner.la $(GOBJECT_LIBS)
-
-_giscanner_la_LDFLAGS = \
- -module -avoid-version -export-symbols-regex init_giscanner
-
-if OS_WIN32
-# Yuck. Probably there is a way to get this from Python, but I don't
-# know how. Use -Wl to avoid libtool crack.
-_giscanner_la_LDFLAGS += -Wl,$(pyexecdir)/../../libs/libpython25.a -no-undefined
-endif
-
-_giscanner_la_SOURCES = giscannermodule.c
-
-if OS_WIN32
-BUILT_SOURCES += _giscanner.pyd
-CLEANFILES += _giscanner.pyd
-
-_giscanner.pyd: _giscanner.la
- cp .libs/_giscanner.dll $@
-
-install-exec-hook:
- mv $(pkgpyexecdir)/_giscanner.dll $(pkgpyexecdir)/_giscanner.pyd
- rm $(pkgpyexecdir)/_giscanner.dll.a
- rm $(pkgpyexecdir)/_giscanner.la
-endif
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index abea9858..a8061dbc 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -678,8 +678,14 @@ DL_EXPORT(void)
init_giscanner(void)
{
PyObject *m, *d;
-
- m = Py_InitModule ("giscanner._giscanner",
+ gboolean is_uninstalled;
+
+ /* Hack to avoid having to create a fake directory structure; when
+ * running uninstalled, the module will be in the top builddir,
+ * with no _giscanner prefix.
+ */
+ is_uninstalled = g_getenv ("UNINSTALLED_INTROSPECTION_SRCDIR") != NULL;
+ m = Py_InitModule (is_uninstalled ? "_giscanner" : "giscanner._giscanner",
(PyMethodDef*)pyscanner_functions);
d = PyModule_GetDict (m);
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index 20339e47..e3968e32 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -26,6 +26,12 @@ import tempfile
from .libtoolimporter import LibtoolImporter
from .message import Position
+with LibtoolImporter(None, None):
+ if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
+ from _giscanner import SourceScanner as CSourceScanner
+ else:
+ from giscanner._giscanner import SourceScanner as CSourceScanner
+
(CSYMBOL_TYPE_INVALID,
CSYMBOL_TYPE_ELLIPSIS,
CSYMBOL_TYPE_CONST,
@@ -211,9 +217,7 @@ class SourceSymbol(object):
class SourceScanner(object):
def __init__(self):
- with LibtoolImporter(None, None):
- from giscanner._giscanner import SourceScanner
- self._scanner = SourceScanner()
+ self._scanner = CSourceScanner()
self._filenames = []
self._cpp_options = []
diff --git a/giscanner/xmlwriter.py b/giscanner/xmlwriter.py
index 6ba1e6ad..a418cc40 100755
--- a/giscanner/xmlwriter.py
+++ b/giscanner/xmlwriter.py
@@ -20,6 +20,8 @@
from __future__ import with_statement
+import os
+
from contextlib import contextmanager
from cStringIO import StringIO
from xml.sax.saxutils import escape, quoteattr
@@ -68,7 +70,10 @@ def collect_attributes(tag_name, attributes, self_indent,
with LibtoolImporter(None, None):
- from giscanner._giscanner import collect_attributes
+ if 'UNINSTALLED_INTROSPECTION_SRCDIR' in os.environ:
+ from _giscanner import collect_attributes
+ else:
+ from giscanner._giscanner import collect_attributes
class XMLWriter(object):