Permalink
Browse files

Windows port: Make g-ir-annotiotion-tool, g-ir-doc-tool and g-ir-scan…

…ner 'relocatable' at runtime.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
  • Loading branch information...
dieterv committed Sep 8, 2011
1 parent ac9955d commit 852f17cd4b60161145e71f02f14fb526d722b958
Showing with 34 additions and 28 deletions.
  1. +12 −10 tools/g-ir-annotation-tool.in
  2. +11 −9 tools/g-ir-doc-tool.in
  3. +11 −9 tools/g-ir-scanner.in
@@ -23,24 +23,26 @@ import os
import sys
import __builtin__
-__builtin__.__dict__['DATADIR'] = "@datarootdir@"
-
if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
print "Caught exception: %r %r" % (exctype, value)
import pdb
pdb.pm()
sys.excepthook = on_exception
-srcdir=os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
-if srcdir is not None:
- path = srcdir
+if os.name == 'nt':
+ datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
+ pylibdir = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
else:
- # This is a private directory, we don't want to pollute the global
- # namespace.
- path = os.path.join('@libdir@', 'gobject-introspection')
-sys.path.insert(0, path)
+ datadir = "@datarootdir@"
+ pylibdir = os.path.join('@libdir@', 'gobject-introspection')
-from giscanner.annotationmain import annotation_main
+srcdir = os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
+if srcdir is not None:
+ pylibdir = srcdir
+
+__builtin__.__dict__['DATADIR'] = datadir
+sys.path.insert(0, pylibdir)
+from giscanner.annotationmain import annotation_main
sys.exit(annotation_main(sys.argv))
View
@@ -23,24 +23,26 @@ import os
import sys
import __builtin__
-__builtin__.__dict__['DATADIR'] = "@datarootdir@"
-
if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
print "Caught exception: %r %r" % (exctype, value)
import pdb
pdb.pm()
sys.excepthook = on_exception
+if os.name == 'nt':
+ datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
+ pylibdir = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
+else:
+ datadir = "@datarootdir@"
+ pylibdir = os.path.join('@libdir@', 'gobject-introspection')
+
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.
- path = os.path.join('@libdir@', 'gobject-introspection')
-sys.path.insert(0, path)
+ pylibdir = srcdir
-from giscanner.docmain import doc_main
+__builtin__.__dict__['DATADIR'] = datadir
+sys.path.insert(0, pylibdir)
+from giscanner.docmain import doc_main
sys.exit(doc_main(sys.argv))
View
@@ -23,24 +23,26 @@ import os
import sys
import __builtin__
-__builtin__.__dict__['DATADIR'] = "@datarootdir@"
-
if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
print "Caught exception: %r %r" % (exctype, value)
import pdb
pdb.pm()
sys.excepthook = on_exception
+if os.name == 'nt':
+ datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
+ pylibdir = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
+else:
+ datadir = "@datarootdir@"
+ pylibdir = os.path.join('@libdir@', 'gobject-introspection')
+
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.
- path = os.path.join('@libdir@', 'gobject-introspection')
-sys.path.insert(0, path)
+ pylibdir = srcdir
-from giscanner.scannermain import scanner_main
+__builtin__.__dict__['DATADIR'] = datadir
+sys.path.insert(0, pylibdir)
+from giscanner.scannermain import scanner_main
sys.exit(scanner_main(sys.argv))

0 comments on commit 852f17c

Please sign in to comment.