diff -ur PyX-0.8.1/setup.py PyX-0.8.1-patched/setup.py
--- PyX-0.8.1/setup.py 2005-08-13 05:32:46.000000000 -0700
+++ PyX-0.8.1-patched/setup.py 2006-04-29 02:49:37.000000000 -0700
@@ -15,8 +15,6 @@
log = None
from distutils.core import setup, Extension
from distutils.util import change_root, convert_path
-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
@@ -81,79 +79,21 @@
# extend install commands to overwrite siteconfig.py during build and install
#
-
-class pyx_build_py(build_py):
-
- 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)
- outdir = os.path.dirname(outfile)
- self.mkpath(outdir)
-
- if log:
- log.info("creating proper %s" % outfile)
-
- # create the additional relative path parts to be inserted into the
- # os.path.join methods in the original siteconfig.py
- indir = os.path.dirname(module_file)
- addjoinstring = ", ".join(["'..'" for d in outdir.split(os.path.sep)] +
- ["'%s'" % d for d in indir.split(os.path.sep)])
-
- # write a modifed version of siteconfig.py
- fin = open(module_file, "r")
- fout = open(outfile, "w")
- for line in fin.readlines():
- fout.write(line.replace("os.path.join(os.path.dirname(__file__), ",
- "os.path.join(os.path.dirname(__file__), %s, " % addjoinstring))
- fin.close()
- fout.close()
- else:
- return build_py.build_module(self, module, module_file, package)
-
-
-class pyx_install_data(install_data):
-
- def run(self):
- self.siteconfiglines = []
- for dir, files in self.data_files:
- # append siteconfiglines by "<siteconfigname> = <dir>"
-
- # get the install directory
- # (the following four lines are copied from within the install_data.run loop)
- dir = convert_path(dir)
- if not os.path.isabs(dir):
- dir = os.path.join(self.install_dir, dir)
- elif self.root:
- dir = change_root(self.root, dir)
-
- self.siteconfiglines.append("%s = '%s'\n" % (siteconfignames[files], dir))
-
- install_data.run(self)
-
-
class pyx_install_lib(install_lib):
- def run(self):
- # siteconfig.py depends on install_data:
- self.run_command('install_data')
- install_lib.run(self)
-
def install(self):
- # first we perform the tree_copy
result = install_lib.install(self)
-
- # siteconfiglines have been created by install_data
- siteconfiglines = self.distribution.command_obj["install_data"].siteconfiglines
-
- # such that we can easily overwrite siteconfig.py
+ root = self.get_finalized_command('install').root
+ if root == None:
+ root = ''
+ pyx_lfsdir = pyx_sharedir = os.path.join(sys.prefix, "share", "pyx")
+ pyx_pyxrc = os.path.join("/", "etc", "pyxrc")
outfile = os.path.join(self.install_dir, "pyx", "siteconfig.py")
- if log:
- log.info("creating proper %s" % outfile)
f = open(outfile, "w")
- f.writelines(siteconfiglines)
+ f.write("lfsdir = %r\n" % pyx_lfsdir)
+ f.write("sharedir = %r\n" % pyx_sharedir)
+ f.write("pyxrcdir = %r\n" % pyx_pyxrc)
f.close()
-
return result
################################################################################
@@ -193,7 +133,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,
- "install_lib": pyx_install_lib},
+ cmdclass = {"install_lib": pyx_install_lib},
**addargs)