[pygobject: 15/23] setup.py: install pygobject-codegen script
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject: 15/23] setup.py: install pygobject-codegen script
- Date: Thu, 4 Nov 2010 22:43:50 +0000 (UTC)
commit 78533d851ee1314686f18cfa793613a9cf7d6686
Author: Dieter Verfaillie <dieterv optionexplicit be>
Date: Wed Nov 3 09:25:56 2010 +0100
setup.py: install pygobject-codegen script
Signed-off-by: Dieter Verfaillie <dieterv optionexplicit be>
setup.py | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/setup.py b/setup.py
index ce5278d..bb5982f 100755
--- a/setup.py
+++ b/setup.py
@@ -127,6 +127,30 @@ class PyGObjectBuild(build):
PyGObjectBuild.user_options.append(('enable-threading', None,
'enable threading support'))
+
+class PyGObjectBuildScripts(build_scripts):
+ '''
+ Overrides distutils' build_script command so we can generate
+ a valid pygobject-codegen script that works on windows.
+ '''
+
+ def run(self):
+ self.mkpath(self.build_dir)
+ self.install_codegen_script()
+ build_scripts.run(self)
+
+ def install_codegen_script(self):
+ '''Create pygobject-codegen'''
+ script = ('#!/bin/sh\n\n'
+ 'codegendir=`pkg-config pygobject-%s --variable=codegendir`\n\n'
+ 'PYTHONPATH=$codegendir\n'
+ 'export PYTHONPATH\n\n'
+ 'exec pythonw.exe "$codegendir/codegen.py" "$@"\n' % PYGTK_SUFFIX)
+
+ outfile = os.path.join(self.build_dir, 'pygobject-codegen-%s' % PYGTK_SUFFIX)
+ open(outfile, 'w').write(script)
+
+
# glib
glib = PkgConfigExtension(name='glib._glib',
pkc_name='glib-%s' % PYGTK_SUFFIX,
@@ -277,6 +301,7 @@ setup(name="pygobject",
options=options,
cmdclass={'install_lib': PyGObjectInstallLib,
'install_data': PyGObjectInstallData,
+ 'build_scripts': PyGObjectBuildScripts,
'build_clib' : build_clib,
'build_ext': BuildExt,
'build': PyGObjectBuild})
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]