On Wed, Nov 11, 2009 at 3:47 PM, David Cournapeau <cournape@gmail.com> wrote:
On Wed, Nov 11, 2009 at 11:13 PM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
Or it is just that you want to get the "--prefix" value finalized and computed by the install command.
Yes.
Ok. What is obvious to me now is that the "install" command does to much. Knowing the paths is something useful for any command. So "sysconfig" will help I think.
If it's the later, I guess you will be able to use the upcoming "sysconfig" module, that gives you the install schemes, depending on sys.prefix/sys.exec_prefix.
Where is the sysconfig sources ? I don't see it in bitbucket.
that's in python's svn, in a tarek_sysconfig branch. It's a revamp of distutils/sysconfig.py with the schemes from distutils/command/install.py (work in progress) [..]
I don't know for the first part. I have to try it out. Can you provide me such an extension ?
Not for make, but I can try to port numpy.distutils.command.scons to distutils (or distribute). The current code is damn ugly (I did most of it when I started digging into distutils), but you can get an idea here:
http://github.com/cournape/numpy/blob/master/numpy/distutils/command/scons.p...
It calls scons, and you can thus build any C extension using scons. Now, both distutils and scons makes this difficult (in particular, there is no way to call scons from distutils, you need to launch scons executable).
I see. I'll take a look asap. Are you coming to Pycon btw ?
For me, one of the core idea of an improved distutils would be to make this much easier. All compilers options form distutils would be in simple data files with simple API, no objects, no class with countless methods and complex protocol. Distutils v2 would have a default "dumb" build tool, but you could use whatever tool instead if desired.
The default compiler class exists for that, it's CCompiler, and is mostly a placeholder for options. But it's C oriented. In my mind, implementing a new compiler for Distutils means overriding it, and implementing, mainly: - preprocess() - compile() - create_static_lib() - link() Now that's quite complex, and we could probably have a single method (compile) that would do the required work of compiling an extension the way it wants to. So, yes, being able to register an arbitrary compiler class, with arbitrary options passed through the Extension could make it simpler: setup( .. ext_modules=[Extension('Foo', files=['foo.d'], compiler='pyd')], ..) where "pyd" is the name of the compiler that knows how to compile D files; This compiler would do whatever it wants, as long as it is done in a .compile() method: .compile(name, files, *args, **kw) Tarek