[gobject-introspection/wip/nonrecursive-make: 1/5] tools: Switch to checking UNINSTALLED_INTROSPECTION_SRCDIR



commit 8f5d725524acf1cd1631e36de4de52efbee04ffa
Author: Colin Walters <walters verbum org>
Date:   Thu Nov 4 14:42:18 2010 -0400

    tools: Switch to checking UNINSTALLED_INTROSPECTION_SRCDIR
    
    Rather than introspecting the current directory, use the environment
    variable we know is present if and only if we're running uninstalled.
    
    This will be less prone to failure when we switch to nonrecursive
    make, since the generated script will be in the top builddir, not
    tools/ anymore.

 tools/g-ir-annotation-tool.in |    8 +++-----
 tools/g-ir-scanner.in         |    8 +++-----
 2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/tools/g-ir-annotation-tool.in b/tools/g-ir-annotation-tool.in
index 4fbc449..4ad1976 100755
--- a/tools/g-ir-annotation-tool.in
+++ b/tools/g-ir-annotation-tool.in
@@ -29,11 +29,9 @@ if 'GI_SCANNER_DEBUG' in os.environ:
         pdb.pm()
     sys.excepthook = on_exception
 
-# This only works on unix systems
-currentdir = os.path.dirname(os.path.abspath(sys.argv[0]))
-current_name = os.path.basename(currentdir)
-if current_name == 'tools':
-    path = os.path.abspath(os.path.join(currentdir, '..'))
+srcdir=os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
+if srcdir is not None:
+    path = srcdir
 else:
     # This is a private directory, we don't want to pollute the global
     # namespace.
diff --git a/tools/g-ir-scanner.in b/tools/g-ir-scanner.in
index 943d9ba..86866c9 100755
--- a/tools/g-ir-scanner.in
+++ b/tools/g-ir-scanner.in
@@ -29,11 +29,9 @@ if 'GI_SCANNER_DEBUG' in os.environ:
         pdb.pm()
     sys.excepthook = on_exception
 
-# This only works on unix systems
-currentdir = os.path.dirname(os.path.abspath(sys.argv[0]))
-current_name = os.path.basename(currentdir)
-if current_name == 'tools':
-    path = os.path.abspath(os.path.join(currentdir, '..'))
+srcdir=os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
+if srcdir is not None:
+    path = srcdir
 else:
     # This is a private directory, we don't want to pollute the global
     # namespace.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]