Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
Windows port: Make g-ir-annotiotion-tool, g-ir-doc-tool and g-ir-scan…
Browse files Browse the repository at this point in the history
…ner 'relocatable' at runtime.

https://bugzilla.gnome.org/show_bug.cgi?id=620566
  • Loading branch information
dieterv committed Sep 7, 2011
1 parent 390c8b4 commit 0102c51
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
15 changes: 12 additions & 3 deletions tools/g-ir-annotation-tool.in
Expand Up @@ -23,7 +23,12 @@ import os
import sys
import __builtin__

__builtin__.__dict__['DATADIR'] = "@datarootdir@"
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
else:
datadir = "@datarootdir@"

__builtin__.__dict__['DATADIR'] = datadir

if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
Expand All @@ -32,13 +37,17 @@ if 'GI_SCANNER_DEBUG' in os.environ:
pdb.pm()
sys.excepthook = on_exception

srcdir=os.getenv('UNINSTALLED_INTROSPECTION_SRCDIR', None)
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')
if os.name == 'nt':
# Makes g-ir-annotation-tool 'relocatable' at runtime on Windows.
path = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
else:
path = os.path.join('@libdir@', 'gobject-introspection')
sys.path.insert(0, path)

from giscanner.annotationmain import annotation_main
Expand Down
13 changes: 11 additions & 2 deletions tools/g-ir-doc-tool.in
Expand Up @@ -23,7 +23,12 @@ import os
import sys
import __builtin__

__builtin__.__dict__['DATADIR'] = "@datarootdir@"
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
else:
datadir = "@datarootdir@"

__builtin__.__dict__['DATADIR'] = datadir

if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
Expand All @@ -38,7 +43,11 @@ if srcdir is not None:
else:
# This is a private directory, we don't want to pollute the global
# namespace.
path = os.path.join('@libdir@', 'gobject-introspection')
if os.name == 'nt':
# Makes g-ir-doc-tool 'relocatable' at runtime on Windows.
path = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
else:
path = os.path.join('@libdir@', 'gobject-introspection')
sys.path.insert(0, path)

from giscanner.docmain import doc_main
Expand Down
13 changes: 11 additions & 2 deletions tools/g-ir-scanner.in
Expand Up @@ -23,7 +23,12 @@ import os
import sys
import __builtin__

__builtin__.__dict__['DATADIR'] = "@datarootdir@"
if os.name == 'nt':
datadir = os.path.join(os.path.dirname(__file__), '..', 'share')
else:
datadir = "@datarootdir@"

__builtin__.__dict__['DATADIR'] = datadir

if 'GI_SCANNER_DEBUG' in os.environ:
def on_exception(exctype, value, tb):
Expand All @@ -38,7 +43,11 @@ if srcdir is not None:
else:
# This is a private directory, we don't want to pollute the global
# namespace.
path = os.path.join('@libdir@', 'gobject-introspection')
if os.name == 'nt':
# Makes g-ir-scanner 'relocatable' at runtime on Windows.
path = os.path.join(os.path.dirname(__file__), '..', 'lib', 'gobject-introspection')
else:
path = os.path.join('@libdir@', 'gobject-introspection')
sys.path.insert(0, path)

from giscanner.scannermain import scanner_main
Expand Down

0 comments on commit 0102c51

Please sign in to comment.