[gobject-introspection] Kill off config.py
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Kill off config.py
- Date: Wed, 27 Jul 2011 14:37:56 +0000 (UTC)
commit 9fcd8fa140030a270507fba0915aafa4df0933e0
Author: Colin Walters <walters verbum org>
Date: Wed Jul 27 09:11:02 2011 -0400
Kill off config.py
Generating Python source code is problematic for srcdir != builddir;
steal a the trick of putting global data in __builtins__ from jhbuild.
Makefile-giscanner.am | 1 -
Makefile-tools.am | 6 ++++--
configure.ac | 1 -
giscanner/config.py.in | 25 -------------------------
giscanner/dumper.py | 1 -
giscanner/transformer.py | 5 ++---
tools/g-ir-annotation-tool.in | 3 +++
tools/g-ir-scanner.in | 3 +++
8 files changed, 12 insertions(+), 33 deletions(-)
---
diff --git a/Makefile-giscanner.am b/Makefile-giscanner.am
index 8a8c7ed..0ca98f6 100644
--- a/Makefile-giscanner.am
+++ b/Makefile-giscanner.am
@@ -33,7 +33,6 @@ pkgpyexec_PYTHON = \
giscanner/ast.py \
giscanner/cachestore.py \
giscanner/codegen.py \
- giscanner/config.py \
giscanner/dumper.py \
giscanner/introspectablepass.py \
giscanner/girparser.py \
diff --git a/Makefile-tools.am b/Makefile-tools.am
index 31e6e71..c0dd788 100644
--- a/Makefile-tools.am
+++ b/Makefile-tools.am
@@ -2,12 +2,14 @@ bin_PROGRAMS += g-ir-compiler g-ir-generate
bin_SCRIPTS += g-ir-scanner g-ir-annotation-tool
EXTRA_DIST += tools/g-ir-scanner.in tools/g-ir-annotation-tool.in
+TOOL_SUBSTITUTIONS = sed -e s,@libdir\@,$(libdir), -e s,@pkgdatadir\@,$(pkgdatadir), -e s,@PYTHON\@,$(PYTHON),
+
g-ir-scanner: tools/g-ir-scanner.in _giscanner.la Makefile
- $(AM_V_GEN) sed -e s,@libdir\@,$(libdir), -e s,@PYTHON\@,$(PYTHON), $< > $ tmp && mv $ tmp $@
+ $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $ tmp && mv $ tmp $@
@chmod a+x $@
g-ir-annotation-tool: tools/g-ir-annotation-tool.in _giscanner.la Makefile
- $(AM_V_GEN) sed -e s,@libdir\@,$(libdir), -e s,@PYTHON\@,$(PYTHON), $< > $ tmp && mv $ tmp $@
+ $(AM_V_GEN) $(TOOL_SUBSTITUTIONS) $< > $ tmp && mv $ tmp $@
@chmod a+x $@
g_ir_compiler_SOURCES = tools/compiler.c
diff --git a/configure.ac b/configure.ac
index 0366aa1..6d29ff2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,7 +270,6 @@ AC_MSG_RESULT([$GLIBSRC])
AC_CONFIG_FILES([
Makefile
-giscanner/config.py
m4/Makefile
tests/Makefile
tests/offsets/Makefile
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index b844938..615b3fc 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -27,7 +27,6 @@ import tempfile
from .gdumpparser import IntrospectionBinary
from . import utils
-from .config import DATADIR
# bugzilla.gnome.org/558436
# Compile a binary program which is then linked to a library
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index a651649..7db7982 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -24,7 +24,6 @@ import sys
from . import ast
from . import message
from .cachestore import CacheStore
-from .config import DATADIR, GIR_DIR, GIR_SUFFIX
from .girparser import GIRParser
from .sourcescanner import (
SourceSymbol, ctype_name, CTYPE_POINTER,
@@ -163,8 +162,8 @@ None."""
def _find_include(self, include):
searchdirs = self._includepaths[:]
for path in _xdg_data_dirs:
- searchdirs.append(os.path.join(path, GIR_SUFFIX))
- searchdirs.append(GIR_DIR)
+ searchdirs.append(os.path.join(path, 'gir-1.0'))
+ searchdirs.append(os.path.join(DATADIR, 'gir-1.0'))
girname = '%s-%s.gir' % (include.name, include.version)
for d in searchdirs:
diff --git a/tools/g-ir-annotation-tool.in b/tools/g-ir-annotation-tool.in
index 4ad1976..49d0b99 100755
--- a/tools/g-ir-annotation-tool.in
+++ b/tools/g-ir-annotation-tool.in
@@ -21,6 +21,9 @@
import os
import sys
+import __builtin__
+
+__builtin__.__dict__['DATADIR'] = "@pkgdatadir@"
if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
diff --git a/tools/g-ir-scanner.in b/tools/g-ir-scanner.in
index ba2999c..6f2b83e 100755
--- a/tools/g-ir-scanner.in
+++ b/tools/g-ir-scanner.in
@@ -21,6 +21,9 @@
import os
import sys
+import __builtin__
+
+__builtin__.__dict__['DATADIR'] = "@pkgdatadir@"
if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]