--- setup.py.orig 2004-05-12 10:13:55.000000000 +0200 +++ setup.py 2005-02-10 16:19:05.306419365 +0100 @@ -10,8 +10,7 @@ """ from distutils.core import setup, Extension -from distutils.command.build_py import build_py -from distutils.command.install_data import install_data +from distutils.command.install_lib import install_lib import ConfigParser import sys, os import pyx @@ -56,47 +55,25 @@ ("/etc", ["pyxrc"])] # -# pyx_build_py -# -# pyx/siteconfig.py is not copied from the source directory, -# but generated from the directory data obtained from install_data -# - -class pyx_build_py(build_py): - - def run(self): - # siteconfig depends on install_data: - self.run_command('install_data') - build_py.run(self) - - def build_module(self, module, module_file, package): - if package == "pyx" and module == "siteconfig": - # generate path information as the original build_module does it - outfile = self.get_module_outfile(self.build_lib, [package], module) - dir = os.path.dirname(outfile) - self.mkpath(dir) - - # we do not copy pyx/siteconfig.py, but generate it - # using the pyx_install_data instance - install_data = self.distribution.command_obj["install_data"] - f = open(outfile, "w") - f.write("lfsdir = %r\n" % install_data.pyx_lfsdir) - f.write("sharedir = %r\n" % install_data.pyx_sharedir) - f.write("pyxrc = %r\n" % install_data.pyx_pyxrc) - f.close() - else: - return build_py.build_module(self, module, module_file, package) - -# # install_data # -class pyx_install_data(install_data): +class pyx_install_lib(install_lib): - def run(self): - install_data.run(self) - self.pyx_lfsdir = self.pyx_sharedir = os.path.join(self.install_dir, "share", "pyx") - self.pyx_pyxrc = os.path.join(self.root or "/", "etc", "pyxrc") + def install(self): + result = install_lib.install(self) + root = self.get_finalized_command('install').root + if root == None: + root = '' + pyx_lfsdir = pyx_sharedir = os.path.join(self.install_dir[len(root):], "share", "pyx") + pyx_pyxrc = os.path.join("/", "etc", "pyxrc") + outfile = os.path.join(self.install_dir, "pyx", "siteconfig.py") + f = open(outfile, "w") + f.write("lfsdir = %r\n" % pyx_lfsdir) + f.write("sharedir = %r\n" % pyx_sharedir) + f.write("pyxrc = %r\n" % pyx_pyxrc) + f.close() + return result # # additional package metadata (only available in Python 2.3 and above) @@ -135,6 +112,5 @@ packages=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/t1strip", "pyx/pykpathsea"], ext_modules=ext_modules, data_files=data_files, - cmdclass = {"build_py": pyx_build_py, - "install_data": pyx_install_data}, + cmdclass = {"install_lib": pyx_install_lib}, **addargs)