From: <ds...@us...> - 2007-11-10 23:08:40
|
Revision: 4214 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4214&view=rev Author: dsdale Date: 2007-11-10 15:08:19 -0800 (Sat, 10 Nov 2007) Log Message: ----------- added flags in setup.cfg to disable providing external packages like pytz and datetime Modified Paths: -------------- trunk/matplotlib/setup.cfg trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setup.cfg =================================================================== --- trunk/matplotlib/setup.cfg 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.cfg 2007-11-10 23:08:19 UTC (rev 4214) @@ -4,4 +4,18 @@ [status] # To suppress display of the dependencies and their versions # at the top of the build log, uncomment the following line: -# suppress = 1 \ No newline at end of file +# +#suppress = True + +[provide packages] +# by default, matplotlib checks for a few dependencies and +# installs them if missing. This feature can be turned off +# by uncommenting the following lines: +# +## date/timezone support: +#pytz = False +#dateutil = False +# +## experimental config package support: +#enthought.traits = False +#configobj = False Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setup.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -13,10 +13,8 @@ rc = {'backend':'PS', 'numerix':'numpy'} -# build the image support module - requires agg and Numeric or -# numarray. You can build the image module with either Numeric or -# numarray or both. By default, matplotlib will build support for -# whatever array packages you have installed. +# build the image support module - requires agg. By default, matplotlib will +# build support for whatever array packages you have installed. BUILD_IMAGE = 1 # Build the antigrain geometry toolkit. Agg makes heavy use of @@ -82,9 +80,10 @@ 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, check_for_pytz, check_for_dateutil, \ - check_for_configobj, check_for_dvipng, check_for_ghostscript, \ - check_for_latex, check_for_pdftops, check_for_datetime + check_for_cairo, check_provide_traits, check_provide_pytz, \ + check_provide_dateutil, check_provide_configobj, check_for_dvipng, \ + check_for_ghostscript, check_for_latex, check_for_pdftops, \ + check_for_datetime #import distutils.sysconfig # jdh @@ -240,8 +239,8 @@ print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") hasdatetime = check_for_datetime() -hasdateutil = check_for_dateutil(hasdatetime) -haspytz = check_for_pytz(hasdatetime) +provide_dateutil = check_provide_dateutil(hasdatetime) +provide_pytz = check_provide_pytz(hasdatetime) if hasdatetime: # dates require python23 datetime # only install pytz and dateutil if the user hasn't got them @@ -272,8 +271,8 @@ add_dateutil() else: # only add them if we need them - if not haspytz: add_pytz() - if not hasdateutil: add_dateutil() + if provide_pytz: add_pytz() + if provide_dateutil: add_dateutil() print_raw("") print_raw("OPTIONAL USETEX DEPENDENCIES") @@ -285,8 +284,10 @@ # TODO: comment out for mpl release: print_raw("") print_raw("EXPERIMENTAL CONFIG PACKAGE DEPENDENCIES") -if not check_for_configobj(): py_modules.append('configobj') -if not check_for_traits(): build_traits(ext_modules, packages) +if check_provide_configobj(): + py_modules.append('configobj') +if check_provide_traits(): + build_traits(ext_modules, packages) print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-10 22:41:51 UTC (rev 4213) +++ trunk/matplotlib/setupext.py 2007-11-10 23:08:19 UTC (rev 4214) @@ -98,16 +98,35 @@ numpy_inc_dirs = [] # Based on the contents of setup.cfg, determine if the status block -# should be displayed +# should be displayed, if missing external packages should be provided display_status = True +provide_pytz = True +provide_dateutil = True +provide_configobj = True +provide_traits = True if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() config.read("setup.cfg") try: - if config.get("status", "suppress"): - display_status = False + display_status = not config.getboolean("status", "suppress") except: pass + try: + provide_pytz = config.getboolean("provide packages", "pytz") + except: + pass + try: + provide_dateutil = config.getboolean("provide packages", "dateutil") + except: + pass + try: + provide_configobj = config.getboolean("provide packages", "configobj") + except: + pass + try: + provide_traits = config.getboolean("provide packages", "enthought.traits") + except: + pass if display_status: def print_line(char='='): @@ -336,57 +355,73 @@ print_status("datetime", "present, version unknown") return True -def check_for_pytz(hasdatetime=True): +def check_provide_pytz(hasdatetime=True): try: import pytz except ImportError: - if hasdatetime: print_status("pytz", "mpl-provided") - else: print_status("pytz", "no") - return False + if hasdatetime and provide_pytz: + print_status("pytz", "mpl-provided") + return True + else: + print_status("pytz", "no") + return False else: print_status("pytz", pytz.__version__) - return True + return False -def check_for_dateutil(hasdatetime=True): +def check_provide_dateutil(hasdatetime=True): try: import dateutil except ImportError: - if hasdatetime: print_status("dateutil", "mpl-provided") - else: print_status("dateutil", "no") - return False + if hasdatetime and provide_dateutil: + print_status("dateutil", "mpl-provided") + return True + else: + print_status("dateutil", "no") + return False else: try: print_status("dateutil", dateutil.__version__) except AttributeError: print_status("dateutil", "present, version unknown") - return True + return False -def check_for_configobj(): +def check_provide_configobj(): try: import configobj except ImportError: - print_status("configobj", "mpl-provided") - return False + if provide_configobj: + print_status("configobj", "mpl-provided") + return True + else: + print_status("configobj", "no") + return False else: print_status("configobj", configobj.__version__) - return True + return False -def check_for_traits(): - gotit = False +def check_provide_traits(): try: from enthought import traits - gotit = True try: from enthought.traits import version except: print_status("enthought.traits", "unknown and incompatible version: < 2.0") - return gotit + return False else: - if version.version.endswith('mpl'): gotit = False - print_status("enthought.traits", version.version) + if version.version.endswith('mpl'): + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", version.version) + return False except ImportError: - print_status("enthought.traits", "no") - return gotit + if provide_traits: + print_status("enthought.traits", "mpl-provided") + return True + else: + print_status("enthought.traits", "no") + return False def check_for_dvipng(): try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |