Imported Upstream version 2.53.4
[platform/upstream/glib.git] / gio / gdbus-2.0 / codegen / gdbus-codegen.in
1 #!/usr/bin/env @PYTHON@
2
3 # GDBus - GLib D-Bus Library
4 #
5 # Copyright (C) 2008-2011 Red Hat, Inc.
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General
18 # Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #
20 # Author: David Zeuthen <davidz@redhat.com>
21
22
23 import os
24 import sys
25
26 srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None)
27 filedir = os.path.dirname(__file__)
28
29 if srcdir is not None:
30     path = os.path.join(srcdir, 'gio', 'gdbus-2.0')
31 elif os.path.basename(filedir) == 'bin':
32     # Make the prefix containing gdbus-codegen 'relocatable' at runtime by
33     # adding /some/prefix/bin/../share/glib-2.0 to the python path
34     path = os.path.join(filedir, '..', 'share', 'glib-2.0')
35 else:
36     # Assume that the modules we need are in the current directory and add the
37     # parent directory to the python path.
38     path = os.path.join(filedir, '..')
39
40 sys.path.insert(0, os.path.abspath(path))
41 from codegen import codegen_main
42
43 sys.exit(codegen_main.codegen_main())