[Python-checkins] CVS: distutils/examples pil_setup.py,1.11,1.12

Greg Ward python-dev@python.org
Mon, 26 Jun 2000 19:11:05 -0700


Update of /cvsroot/python/distutils/examples
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9891

Modified Files:
	pil_setup.py 
Log Message:
Added a config command to determine if Tcl/Tk, libjpeg, and/or zlib are present.
Doesn't actually do anything with that knowledge, since the base config command
doesn't have any infrastructure for doing that.  Still, it's a start.

Index: pil_setup.py
===================================================================
RCS file: /cvsroot/python/distutils/examples/pil_setup.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** pil_setup.py	2000/03/31 04:47:05	1.11
--- pil_setup.py	2000/06/27 02:11:03	1.12
***************
*** 11,14 ****
--- 11,15 ----
  from distutils.core import setup
  from distutils.ccompiler import new_compiler
+ from distutils.command.config import config
  from glob import glob
  
***************
*** 57,60 ****
--- 58,109 ----
  
  
+ class config_Imaging (config):
+ 
+     user_options = config.user_options + [
+         ('tcltk-include-dirs=', None,
+          "directories to search for Tcl/Tk header files"),
+         ('tcltk-library-dirs=', None,
+          "directories to search for Tcl/Tk library files"),
+         ('tcl-version', None,
+          "version of Tcl library to look for"),
+         ('tk-version', None,
+          "version of Tk library to look for"),
+         ('zlib-include-dirs=', None,
+          "directories to search for zlib header file"),
+         ('zlib-library-dirs=', None,
+          "directories to search for zlib library file"),
+         ]
+ 
+     def initialize_options (self):
+         config.initialize_options(self)
+         self.tcltk_include_dirs = None
+         self.tcltk_library_dirs = None
+         self.tcl_version = None
+         self.tk_version = None
+ 
+         self.zlib_include_dirs = None
+         self.zlib_library_dirs = None
+ 
+     # No 'finalize_options()' method -- none of our options have default
+     # values (other than None, that is).
+ 
+     def run (self):
+         
+         have_tcl = self.check_lib("tcl" + (self.tcl_version or ""),
+                                   self.tcltk_library_dirs,
+                                   ["tcl.h"], self.tcltk_include_dirs)
+                                   
+         have_tk = self.check_lib("tk" + (self.tk_version or ""),
+                                  self.tcltk_library_dirs,
+                                  ["tk.h"], self.tcltk_include_dirs)
+ 
+         have_zlib = self.check_lib("z", self.zlib_library_dirs,
+                                    ["zlib.h"], self.zlib_include_dirs)
+ 
+ 
+         print "have tcl? %d  have tk? %d  have zlib? %d" % \
+               (have_tcl, have_tk, have_zlib)
+ 
+ 
  # ------------------------------------------------------------------------
  # You should't have to change anything below this point!
***************
*** 94,97 ****
--- 143,148 ----
         # top-level module in the distribution), but Distutils as yet has no
         # facilities for installing scripts.
+ 
+        cmdclass = {'config': config_Imaging},
  
         libraries = [(lib_name,