Skip to content

Commit

Permalink
Reviewed by: Johan Dahlin <johan@gnome.org>
Browse files Browse the repository at this point in the history
	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.
  • Loading branch information
Johan Dahlin committed Dec 23, 2004
1 parent 80cbc2b commit b680bf2
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions dsextras.py
Expand Up @@ -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]
Expand Down Expand Up @@ -122,27 +134,44 @@ def build_extension(self, 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)
self.add_template_option('includedir', self.includedir)
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
Expand Down

0 comments on commit b680bf2

Please sign in to comment.