On 26 May 2000, M.-A. Lemburg said:
Hmm, the pre/post-install hooks are definitely an install thing.
Again, there are two meanings to install: install from source and install from a built distribution. Hooks at install-from-source time should be doable with the Distutils' existing extension mechanism (if a bit cumbersome -- you have to know how to write a Distutils command class, which is a tad idiosyncratic).
We'd also need a pre-build, though, for the things I mentioned below, e.g. finding header files and libs, checking the compiler, etc.
In principle, that should all be doable with the Distutils' existing
facilities. I'd be willing to grease the wheels by adding a standard
"prebuild" or "configure" command that runs before "build", but I'd
leave it empty and open to subclassing -- there's just too many things
that you might want to do there!
So eg. you might do this in your setup script:
class configure (Command):
user_options = [('foo-inc', None,
("where to search for foo headers"),
('foo-lib', None,
"where to search for foo library"),
]
def initialize_options (self):
self.foo_inc = None
self.foo_lib = None
def finalize_options (self):
# if user doesn't define foo_inc and foo_lib, leave them
# alone (we will search for foo.h and libfoo)
pass
def run (self):
if self.foo_inc is None:
for dir in (...): # list would vary by platform
# try to compile "#include
Why not add some keywords to the constructor ?!
import mx.ODBC.Misc.DistSupport setup( preinstall = mx.ODBC.Misc.DistSupport.preinstall, postinstall = ...postinstall, prebuild = ...prebuild, postbuild = ...postbuild )
I realize that the OO write-your-own-class alternative is a little more clunky, but I don't think it's clunky enough to mandate a function-passing interface. Can you buy that?
Naa... no need to rewrite Autoconf in Python: the simple tests can easily be done using a few lines of Python provided that the compiler classes allow these trial-and-error approaches.
You may be right, based on the above hypothetical configure command. Abstracting some of these common functions away shouldn't be too hard. Greg -- Greg Ward - geek-on-the-loose gward@python.net http://starship.python.net/~gward/ Hold the MAYO & pass the COSMIC AWARENESS ...