Kill off config.py
authorColin Walters <walters@verbum.org>
Wed, 27 Jul 2011 13:11:02 +0000 (09:11 -0400)
committerColin Walters <walters@verbum.org>
Wed, 27 Jul 2011 13:15:02 +0000 (09:15 -0400)
Generating Python source code is problematic for srcdir != builddir;
steal a the trick of putting global data in __builtins__ from jhbuild.

Makefile-giscanner.am
Makefile-tools.am
configure.ac
giscanner/config.py.in [deleted file]
giscanner/dumper.py
giscanner/transformer.py
tools/g-ir-annotation-tool.in
tools/g-ir-scanner.in

index 8a8c7ed..0ca98f6 100644 (file)
@@ -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          \
index 31e6e71..c0dd788 100644 (file)
@@ -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
index 0366aa1..6d29ff2 100644 (file)
@@ -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/config.py.in b/giscanner/config.py.in
deleted file mode 100644 (file)
index 9de1f48..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- Mode: Python -*-
-# GObject-Introspection - a framework for introspecting GObject libraries
-# Copyright (C) 2008  Johan Dahlin
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-
-DATADIR = "@datarootdir@"
-DATADIR = DATADIR.replace(
-    "${prefix}", "@prefix@")
-GIR_DIR = "@GIR_DIR@"
-GIR_SUFFIX = "@GIR_SUFFIX@"
index b844938..615b3fc 100644 (file)
@@ -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
index a651649..7db7982 100644 (file)
@@ -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:
index 4ad1976..49d0b99 100755 (executable)
@@ -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):
index ba2999c..6f2b83e 100755 (executable)
@@ -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):