Revision: 4170
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4170&view=rev
Author:   dsdale
Date:     2007-11-08 16:22:03 -0800 (Thu, 08 Nov 2007)

Log Message:
-----------
added checks that also print version numbers for 
pyparsing, pytz, dateutil, configobj

Modified Paths:
--------------
    trunk/matplotlib/setup.py
    trunk/matplotlib/setupext.py

Modified: trunk/matplotlib/setup.py
===================================================================
--- trunk/matplotlib/setup.py   2007-11-09 00:19:45 UTC (rev 4169)
+++ trunk/matplotlib/setup.py   2007-11-09 00:22:03 UTC (rev 4170)
@@ -80,9 +80,10 @@
      build_ft2font, build_image, build_windowing, build_transforms, \
      build_contour, build_nxutils, build_traits, build_swigagg, build_gdk, \
      build_subprocess, build_ttconv, print_line, print_status, print_message, \
-     print_raw, check_for_freetype, check_for_libpng, check_for_gtk, 
check_for_tk, \
-     check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, 
check_for_cairo, \
-     check_for_traits
+     print_raw, check_for_freetype, check_for_libpng, check_for_gtk, \
+     check_for_tk, check_for_wx, check_for_numpy, check_for_qt, check_for_qt4, 
\
+     check_for_cairo, check_for_traits, check_for_pytz, check_for_dateutil, \
+     check_for_pyparsing, check_for_configobj
 #import distutils.sysconfig
 
 # jdh
@@ -183,14 +184,16 @@
     build_contour(ext_modules, packages)
     build_nxutils(ext_modules, packages)
 
+if not check_for_pyparsing(): py_modules.append('pyparsing')
+
 print_raw("")
 print_raw("OPTIONAL DEPENDENCIES")
     
 try: import datetime
-except ImportError: havedate = False
-else: havedate = True
+except ImportError: hasdatetime = False
+else: hasdatetime = True
 
-if havedate: # dates require python23 datetime
+if hasdatetime: # dates require python23 datetime
     # only install pytz and dateutil if the user hasn't got them
     def add_pytz():
         packages.append('pytz')
@@ -202,32 +205,23 @@
     def add_dateutil():
         packages.append('dateutil')
 
+    haspytz = check_for_pytz()
+    hasdateutil = check_for_dateutil()
+
     if sys.platform=='win32':
         # always add these to the win32 installer
         add_pytz()
         add_dateutil()
     else:
         # only add them if we need them
+        if not haspytz: add_pytz()
+        if not hasdateutil: add_dateutil()
 
-        try:
-            import pytz
-        except ImportError:
-            add_pytz()
-
-        try:
-            import dateutil
-        except ImportError:
-            add_dateutil()
-
 build_swigagg(ext_modules, packages)
 build_transforms(ext_modules, packages)
 
-try: import pyparsing
-except ImportError: py_modules.append('pyparsing')
-
 # for the traited config package:
-try: import configobj
-except ImportError: py_modules.append('configobj')
+if not check_for_configobj(): py_modules.append('configobj')
 
 if not check_for_traits(): build_traits(ext_modules, packages)
 

Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py        2007-11-09 00:19:45 UTC (rev 4169)
+++ trunk/matplotlib/setupext.py        2007-11-09 00:22:03 UTC (rev 4170)
@@ -323,7 +323,51 @@
         return False
     else:
         print_status("Cairo", cairo.version)
+        return True
 
+def check_for_pyparsing():
+    try:
+        import pyparsing
+    except ImportError:
+        print_status("pyparsing", "mpl-provided")
+        return False
+    else:
+        print_status("pyparsing", pyparsing.__version__)
+        return True
+
+def check_for_pytz():
+    try:
+        import pytz
+    except ImportError:
+        print_status("pytz", "mpl-provided")
+        return False
+    else:
+        print_status("pytz", pytz.__version__)
+        return True
+
+def check_for_dateutil():
+    try:
+        import dateutil
+    except ImportError:
+        print_status("dateutil", "mpl-provided")
+        return False
+    else:
+        try:
+            print_status("dateutil", dateutil.__version)
+        except AttributeError:
+            print_status("dateutil", "present, version unknown")
+        return True
+
+def check_for_configobj():
+    try:
+        import configobj
+    except ImportError:
+        print_status("configobj", "mpl-provided")
+        return False
+    else:
+        print_status("configobj", configobj.__version__)
+        return True
+
 def check_for_traits():
     gotit = False
     try:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to