
I want to use distutils to build an ordinary C library for subsequent use in other parts of my build. I have a setup file that contains this call to setup: setup (name = "libcmds", ... libraries = [ ('cdms', {'sources': sourcelist, 'macros': macros, 'include_dirs': include_dirs, 'library_dirs': library_dirs, } ), ] This works and I can build the library libcdms.a, but it is put in build/temp.linux-i686-2.2, hardly the kind of place I want to refer to in other parts of my build. Is there a way to install it somewhere? Or get back the name of the library file so that I can move it myself?

"Paul F Dubois" <paul@pfdubois.com> wrote:
Hi, I use the following shell command for one of my (unofficial) Debian packages: cp "build/lib`python -c \ 'import sys, distutils.util; \ print \".%s-%s\" % \ (distutils.util.get_platform(), sys.version[0:3])'`/_xmms.so" . Not very elegant nor readable, but works for me. The part just after "build/lib" yields the ".linux-i686-2.2" you seem to be looking for. -- Florent

It seems the directory is available as the 'build_clib' attribute of the 'build_clib' command. You can retrieve it, for example, in your own build_ext command (or maybe better in your install_lib command): from distutils.command import install_lib class my_install_lib(install_lib.install_lib): def run(self): install_lib.install_lib.run(self) build_lib = self.get_finalized_command("build_clib") # now install the clib somewhere else and later: setup(..., cmdclass = {'install_lib': my_install_lib}, ...) Does this help? Thomas

"Paul F Dubois" <paul@pfdubois.com> wrote:
Hi, I use the following shell command for one of my (unofficial) Debian packages: cp "build/lib`python -c \ 'import sys, distutils.util; \ print \".%s-%s\" % \ (distutils.util.get_platform(), sys.version[0:3])'`/_xmms.so" . Not very elegant nor readable, but works for me. The part just after "build/lib" yields the ".linux-i686-2.2" you seem to be looking for. -- Florent

It seems the directory is available as the 'build_clib' attribute of the 'build_clib' command. You can retrieve it, for example, in your own build_ext command (or maybe better in your install_lib command): from distutils.command import install_lib class my_install_lib(install_lib.install_lib): def run(self): install_lib.install_lib.run(self) build_lib = self.get_finalized_command("build_clib") # now install the clib somewhere else and later: setup(..., cmdclass = {'install_lib': my_install_lib}, ...) Does this help? Thomas
participants (3)
-
Florent Rougon
-
Paul F Dubois
-
Thomas Heller