distutils lib path

Michael Hudson mwh at python.net
Mon Dec 24 11:11:33 CET 2001


"Daniel Wexler" <wex at flarg.com> writes:

> Is there a way to get the name of the platform-specific
> subdirectory name of the build/lib*** directory in my
> setup.py file?

Erm, probably, but if what you want to do what you describe below,
there's a better way.

[snip]
> Also, is there a way to have distutils perform some arbitrary
> commands after building each extension module?  Or perhaps to
> callback to a python function that I can define (which then can do
> arbitrary things)?  In my case I want to move or create links to the
> resulting .lib or .so files that are built by distutils.

Probably the best thing to do is derive your own subclass from
distutils.command.build_ext and override build_extension() to do what
you want, eg:

from distutils.core import setup
from distutils.command.build_ext import build_ext

class MyBuildExt(build_ext):
    def build_extension(self, ext):
        build_ext.build_extension(self, ext)
        # your stuff goes here

setup(....

      cmd_class = {'build_ext': MyBuildExt})

You'll probably want to read the source of build_ext.build_extension
to find out how to get the information you need.

HTH,
M.



More information about the Python-list mailing list