From b680bf2e2078b6173be059dbe982c6618fa06871 Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Thu, 23 Dec 2004 13:00:14 +0000 Subject: Reviewed by: Johan Dahlin Fixes #150616 * dsextras.py: Added InstallData class. Changed template options to ${prefix}/include|lib|bin|share. Added get_m4_define function to parse pygtk version strings in configure.in. * setup.py: Added pygtk_postinstall bdist_wininst option. distutils now uses InstallData as install_data class. pygtk-2.0.pc and pygtk-codegen-2.0 are installed as data instead of lib/extensions. This fixes a bdist_wininst installer on win32. * pygtk_postinstall.py: Initial release. --- dsextras.py | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/dsextras.py b/dsextras.py index c547ece..c3f6da4 100644 --- a/dsextras.py +++ b/dsextras.py @@ -7,15 +7,27 @@ from distutils.command.build_ext import build_ext from distutils.command.install_lib import install_lib +from distutils.command.install_data import install_data from distutils.extension import Extension import fnmatch import os +import re import string import sys GLOBAL_INC = [] GLOBAL_MACROS = [] +def get_m4_define(varname): + """Return the value of a m4_define variable as set in configure.in.""" + pattern=re.compile("m4_define\("+varname+"\,\s*(.+)\)") + for line in open("configure.in").readlines(): + match_obj=pattern.match(line) + if match_obj: + return match_obj.group(1) + + return None + def getoutput(cmd): """Return output (stdout or stderr) of executing cmd in a shell.""" return getstatusoutput(cmd)[1] @@ -122,20 +134,36 @@ class BuildExt(build_ext): build_ext.build_extension(self, ext) class InstallLib(install_lib): + + local_outputs = [] + local_inputs = [] + + def set_install_dir(self, install_dir): + self.install_dir = install_dir + + def get_outputs(self): + return install_lib.get_outputs(self) + self.local_outputs + + def get_inputs(self): + return install_lib.get_inputs(self) + self.local_inputs + +class InstallData(install_data): + local_outputs = [] local_inputs = [] template_options = {} + def prepare(self): if os.name == "nt": self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-3]) else: # default: os.name == "posix" self.prefix = os.sep.join(self.install_dir.split(os.sep)[:-4]) - - self.exec_prefix = os.path.join(self.prefix, 'bin') - self.includedir = os.path.join(self.prefix, 'include') - self.libdir = os.path.join(self.prefix, 'lib') - self.datadir = os.path.join(self.prefix, 'share') + + self.exec_prefix = '${prefix}/bin' + self.includedir = '${prefix}/include' + self.libdir = '${prefix}/lib' + self.datadir = '${prefix}/share' self.add_template_option('prefix', self.prefix) self.add_template_option('exec_prefix', self.exec_prefix) @@ -143,6 +171,7 @@ class InstallLib(install_lib): self.add_template_option('libdir', self.libdir) self.add_template_option('datadir', self.datadir) self.add_template_option('PYTHON', sys.executable) + self.add_template_option('THREADING_CFLAGS', '') def set_install_dir(self, install_dir): self.install_dir = install_dir -- cgit