[Distutils] Function stubs for CCompiler class?

Lyle Johnson jlj@cfdrc.com
Thu, 11 May 2000 16:06:41 -0500


It appears that in addition to the "worker" functions like compile(),
link_shared_object(), etc. there are four functions which *must* be
implemented by subclasses of CCompiler:

    library_dir_option()
    runtime_library_dir_option()
    library_option()
    find_library_file()

I submit the following patch (against the current CVS version of
ccompiler.py) to make future compiler implementors aware of this
requirement.

Lyle

Index: distutils/ccompiler.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/ccompiler.py,v
retrieving revision 1.17
diff -a -u -r1.17 ccompiler.py
--- ccompiler.py	2000/03/26 21:37:09	1.17
+++ ccompiler.py	2000/05/11 20:59:16
@@ -566,7 +566,38 @@
         pass


+    # -- Miscellaneous methods -----------------------------------------
+    # These are all used by the 'gen_lib_options() function; there is
+    # no appropriate default implementation so subclasses should
+    # implement all of these.
+
+
+    def library_dir_option (self, dir):
+        """Return the compiler option to add 'dir' to the list of
directories
+           searched for libraries."""
+        raise NotImplementedError
+
+
+    def runtime_library_dir_option (self, dir):
+        """Return the compiler option to add 'dir' to the list of
directories
+           searched for runtime libraries."""
+        raise NotImplementedError
+
+
+    def library_option (self, lib):
+        """Return the compiler option to add 'dir' to the list of libraries
+           linked into the shared library or executable."""
+        raise NotImplementedError
+
+
+    def find_library_file (self, dirs, lib):
+        """Search the specified list of directories for a static or shared
+           library file 'lib' and return the full path to that file. Return
+           None if it wasn't found in any of the specified directories."""
+        raise NotImplementedError

+
+
     # -- Filename generation methods -----------------------------------

     # The default implementation of the filename generating methods are