From: <ds...@us...> - 2007-11-09 14:24:44
|
Revision: 4183 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4183&view=rev Author: dsdale Date: 2007-11-09 06:24:41 -0800 (Fri, 09 Nov 2007) Log Message: ----------- updated dependency report during build process Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/config/checkdep.py trunk/matplotlib/setup.py trunk/matplotlib/setupext.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-09 13:49:54 UTC (rev 4182) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2007-11-09 14:24:41 UTC (rev 4183) @@ -256,7 +256,7 @@ v = match.group(0) float(v) return v - except (IndexError, ValueError): + except (IndexError, ValueError, AttributeError): return None def checkdep_pdftops(): Modified: trunk/matplotlib/lib/matplotlib/config/checkdep.py =================================================================== --- trunk/matplotlib/lib/matplotlib/config/checkdep.py 2007-11-09 13:49:54 UTC (rev 4182) +++ trunk/matplotlib/lib/matplotlib/config/checkdep.py 2007-11-09 14:24:41 UTC (rev 4183) @@ -35,7 +35,7 @@ pattern = '3\.1\d+' match = re.search(pattern, line) return match.group(0) - except (IndexError, ValueError): + except (IndexError, ValueError, AttributeError): return None def pdftops(): Modified: trunk/matplotlib/setup.py =================================================================== --- trunk/matplotlib/setup.py 2007-11-09 13:49:54 UTC (rev 4182) +++ trunk/matplotlib/setup.py 2007-11-09 14:24:41 UTC (rev 4183) @@ -83,7 +83,8 @@ 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_configobj, check_for_dvipng, check_for_ghostscript, \ + check_for_latex, check_for_pdftops, check_for_datetime #import distutils.sysconfig # jdh @@ -184,55 +185,12 @@ build_contour(ext_modules, packages) build_nxutils(ext_modules, packages) -print_raw("") -print_raw("OPTIONAL DEPENDENCIES") - -try: import datetime -except ImportError: hasdatetime = False -else: hasdatetime = True - -if hasdatetime: # dates require python23 datetime - # only install pytz and dateutil if the user hasn't got them - def add_pytz(): - packages.append('pytz') - resources = ['zone.tab', 'locales/pytz.pot'] - # install pytz subdirs - for dirpath, dirname, filenames in os.walk(os.path.join('lib', 'pytz', - 'zoneinfo')): - if '.svn' not in dirpath: - # remove the 'lib/pytz' part of the path - basepath = dirpath.split(os.path.sep, 2)[2] - resources.extend([os.path.join(basepath, filename) - for filename in filenames]) - package_data['pytz'] = resources - assert len(resources) > 10, 'pytz zoneinfo files not found!' -# packages.append('/'.join(dirpath.split(os.sep)[1:])) - - def add_dateutil(): - packages.append('dateutil') - packages.append('dateutil/zoneinfo') - package_data['dateutil'] = ['zoneinfo/zoneinfo*.tar.*'] - - 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() - build_swigagg(ext_modules, packages) build_transforms(ext_modules, packages) -# for the traited config package: -if not check_for_configobj(): py_modules.append('configobj') +print_raw("") +print_raw("OPTIONAL BACKEND DEPENDENCIES") -if not check_for_traits(): build_traits(ext_modules, packages) - if check_for_gtk() and (BUILD_GTK or BUILD_GTKAGG): if BUILD_GTK: build_gdk(ext_modules, packages) @@ -279,6 +237,58 @@ mod.extra_compile_args.append('-DVERBOSE') print_raw("") +print_raw("OPTIONAL DATE/TIMEZONE DEPENDENCIES") + +hasdatetime = check_for_datetime() +hasdateutil = check_for_dateutil(hasdatetime) +haspytz = check_for_pytz(hasdatetime) + +if hasdatetime: # dates require python23 datetime + # only install pytz and dateutil if the user hasn't got them + + def add_pytz(): + packages.append('pytz') + resources = ['zone.tab', 'locales/pytz.pot'] + # install pytz subdirs + for dirpath, dirname, filenames in os.walk(os.path.join('lib', 'pytz', + 'zoneinfo')): + if '.svn' not in dirpath: + # remove the 'lib/pytz' part of the path + basepath = dirpath.split(os.path.sep, 2)[2] + resources.extend([os.path.join(basepath, filename) + for filename in filenames]) + package_data['pytz'] = resources + assert len(resources) > 10, 'pytz zoneinfo files not found!' +# packages.append('/'.join(dirpath.split(os.sep)[1:])) + + def add_dateutil(): + packages.append('dateutil') + packages.append('dateutil/zoneinfo') + package_data['dateutil'] = ['zoneinfo/zoneinfo*.tar.*'] + + 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() + +print_raw("") +print_raw("OPTIONAL USETEX DEPENDENCIES") +check_for_dvipng() +check_for_ghostscript() +check_for_latex() +check_for_pdftops() + +# 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) + +print_raw("") print_raw("[Edit setup.cfg to suppress the above messages]") print_line() Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2007-11-09 13:49:54 UTC (rev 4182) +++ trunk/matplotlib/setupext.py 2007-11-09 14:24:41 UTC (rev 4183) @@ -42,6 +42,7 @@ """ import os +import re basedir = { @@ -325,21 +326,33 @@ print_status("Cairo", cairo.version) return True -def check_for_pytz(): +def check_for_datetime(): try: + import datetime + except ImportError: + print_status("datetime", "no") + return False + else: + print_status("datetime", "present, version unknown") + return True + +def check_for_pytz(hasdatetime=True): + try: import pytz except ImportError: - print_status("pytz", "mpl-provided") + if hasdatetime: print_status("pytz", "mpl-provided") + else: print_status("pytz", "no") return False else: print_status("pytz", pytz.__version__) return True -def check_for_dateutil(): +def check_for_dateutil(hasdatetime=True): try: import dateutil except ImportError: - print_status("dateutil", "mpl-provided") + if hasdatetime: print_status("dateutil", "mpl-provided") + else: print_status("dateutil", "no") return False else: try: @@ -375,6 +388,51 @@ print_status("enthought.traits", "no") return gotit +def check_for_dvipng(): + try: + stdin, stdout = os.popen4('dvipng -version') + print_status("dvipng", stdout.readlines()[1].split()[-1]) + return True + except (IndexError, ValueError): + print_status("dvipng", "no") + return False + +def check_for_ghostscript(): + try: + if sys.platform == 'win32': + command = 'gswin32c --version' + else: + command = 'gs --version' + stdin, stdout = os.popen4(command) + print_status("ghostscript", stdout.read()[:-1]) + return True + except (IndexError, ValueError): + print_status("ghostscript", "no") + return False + +def check_for_latex(): + try: + stdin, stdout = os.popen4('latex -version') + line = stdout.readlines()[0] + pattern = '3\.1\d+' + match = re.search(pattern, line) + print_status("latex", match.group(0)) + return True + except (IndexError, ValueError, AttributeError): + print_status("latex", "no") + return False + +def check_for_pdftops(): + try: + stdin, stdout = os.popen4('pdftops -v') + for line in stdout.readlines(): + if 'version' in line: + print_status("pdftops", line.split()[-1]) + return True + except (IndexError, ValueError): + print_status("pdftops", "no") + return False + def check_for_numpy(): gotit = False try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |