| 
									
										
										
										
											2024-03-25 15:17:59 -04:00
										 |  |  | #!@PYTHON@ | 
					
						
							| 
									
										
										
										
											2011-04-08 16:57:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-15 08:33:30 -04:00
										 |  |  | # GDBus - GLib D-Bus Library | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Copyright (C) 2008-2011 Red Hat, Inc. | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2024-04-17 15:31:50 +01:00
										 |  |  | # SPDX-License-Identifier: LGPL-2.1-or-later | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2011-04-15 08:33:30 -04:00
										 |  |  | # This library is free software; you can redistribute it and/or | 
					
						
							|  |  |  | # modify it under the terms of the GNU Lesser General Public | 
					
						
							|  |  |  | # License as published by the Free Software Foundation; either | 
					
						
							| 
									
										
										
										
											2017-01-05 14:44:41 +01:00
										 |  |  | # version 2.1 of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2011-04-15 08:33:30 -04:00
										 |  |  | # | 
					
						
							|  |  |  | # This library 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 | 
					
						
							|  |  |  | # Lesser General Public License for more details. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # You should have received a copy of the GNU Lesser General | 
					
						
							| 
									
										
										
										
											2014-01-23 12:58:29 +01:00
										 |  |  | # Public License along with this library; if not, see <http://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2011-04-15 08:33:30 -04:00
										 |  |  | # | 
					
						
							|  |  |  | # Author: David Zeuthen <davidz@redhat.com> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-08 16:57:31 -04:00
										 |  |  | import os | 
					
						
							|  |  |  | import sys | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 16:38:36 +01:00
										 |  |  | srcdir = os.getenv('UNINSTALLED_GLIB_SRCDIR', None) | 
					
						
							| 
									
										
										
										
											2016-12-21 04:07:24 +05:30
										 |  |  | filedir = os.path.dirname(__file__) | 
					
						
							| 
									
										
										
										
											2011-04-08 16:57:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-23 16:38:36 +01:00
										 |  |  | if srcdir is not None: | 
					
						
							|  |  |  |     path = os.path.join(srcdir, 'gio', 'gdbus-2.0') | 
					
						
							| 
									
										
										
										
											2016-12-21 04:07:24 +05:30
										 |  |  | elif os.path.basename(filedir) == 'bin': | 
					
						
							|  |  |  |     # Make the prefix containing gdbus-codegen 'relocatable' at runtime by | 
					
						
							|  |  |  |     # adding /some/prefix/bin/../share/glib-2.0 to the python path | 
					
						
							|  |  |  |     path = os.path.join(filedir, '..', 'share', 'glib-2.0') | 
					
						
							| 
									
										
										
										
											2011-08-23 16:38:36 +01:00
										 |  |  | else: | 
					
						
							| 
									
										
										
										
											2016-12-21 04:07:24 +05:30
										 |  |  |     # Assume that the modules we need are in the current directory and add the | 
					
						
							|  |  |  |     # parent directory to the python path. | 
					
						
							|  |  |  |     path = os.path.join(filedir, '..') | 
					
						
							| 
									
										
										
										
											2011-04-08 16:57:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 12:51:09 -04:00
										 |  |  | # Canonicalize, then do further testing | 
					
						
							|  |  |  | path = os.path.abspath(path) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-12 15:46:57 +05:30
										 |  |  | # If the above path detection failed, use the hard-coded datadir. This can | 
					
						
							|  |  |  | # happen when, for instance, bindir and datadir are not in the same prefix or | 
					
						
							|  |  |  | # on Windows where we cannot make any guarantees about the directory structure. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # In these cases our installation cannot be relocatable, but at least we should | 
					
						
							|  |  |  | # be able to find the codegen module. | 
					
						
							|  |  |  | if not os.path.isfile(os.path.join(path, 'codegen', 'codegen_main.py')): | 
					
						
							|  |  |  |     path = os.path.join('@DATADIR@', 'glib-2.0') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 12:51:09 -04:00
										 |  |  | sys.path.insert(0, path) | 
					
						
							| 
									
										
										
										
											2011-08-23 16:38:36 +01:00
										 |  |  | from codegen import codegen_main | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | sys.exit(codegen_main.codegen_main()) |