Revision: 6376 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6376&view=rev Author: efiring Date: 2008年11月08日 18:33:01 +0000 (2008年11月08日) Log Message: ----------- Improve error reporting when pygtk or gtk+ headers are missing. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008年11月08日 17:08:25 UTC (rev 6375) +++ trunk/matplotlib/setupext.py 2008年11月08日 18:33:01 UTC (rev 6376) @@ -235,7 +235,8 @@ def get_pkgconfig(module, packages, flags="--libs --cflags", - pkg_config_exec='pkg-config'): + pkg_config_exec='pkg-config', + report_error=False): """Loosely based on an article in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261""" if not has_pkgconfig(): @@ -247,8 +248,8 @@ '-D': 'define_macros', '-U': 'undef_macros'} - status, output = commands.getstatusoutput( - "%s %s %s" % (pkg_config_exec, flags, packages)) + cmd = "%s %s %s" % (pkg_config_exec, flags, packages) + status, output = commands.getstatusoutput(cmd) if status == 0: for token in output.split(): attr = _flags.get(token[:2], None) @@ -266,6 +267,9 @@ if token not in module.extra_link_args: module.extra_link_args.append(token) return True + if report_error: + print_status("pkg-config", "looking for %s" % packages) + print_message(output) return False def get_pkgconfig_version(package): @@ -642,6 +646,7 @@ explanation = ( "Could not find Gtk+ headers in any of %s" % ", ".join(["'%s'" % x for x in module.include_dirs])) + gotit = False def ver2str(tup): return ".".join([str(x) for x in tup]) @@ -718,8 +723,10 @@ if sys.platform != 'win32': # If Gtk+ is installed, pkg-config is required to be installed add_base_flags(module) - get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0') - + ok = get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0', report_error=True) + if not ok: + print_message( + "You may need to install 'dev' package(s) to provide header files.") # visual studio doesn't need the math library if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in module.libraries: module.libraries.remove('m') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6869 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6869&view=rev Author: mdboom Date: 2009年02月03日 13:59:00 +0000 (2009年2月03日) Log Message: ----------- Fix TkAgg backend. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009年02月02日 19:35:43 UTC (rev 6868) +++ trunk/matplotlib/setupext.py 2009年02月03日 13:59:00 UTC (rev 6869) @@ -1124,12 +1124,13 @@ def build_tkagg(ext_modules, packages): global BUILT_TKAGG if BUILT_TKAGG: return # only build it if you you haven't already - deps = ['src/_tkagg.cpp'] + deps = ['src/agg_py_transforms.cpp', 'src/_tkagg.cpp'] deps.extend(glob.glob('CXX/*.cxx')) deps.extend(glob.glob('CXX/*.c')) module = Extension('matplotlib.backends._tkagg', deps, + define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] ) add_tk_flags(module) # do this first This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6983 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6983&view=rev Author: mdboom Date: 2009年03月17日 11:49:57 +0000 (2009年3月17日) Log Message: ----------- Bugfix for Mac OS-X backend build. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009年03月16日 19:32:22 UTC (rev 6982) +++ trunk/matplotlib/setupext.py 2009年03月17日 11:49:57 UTC (rev 6983) @@ -1160,12 +1160,16 @@ global BUILT_MACOSX if BUILT_MACOSX: return # only build it if you you haven't already deps = ['src/_macosx.m', + 'CXX/cxx_extensions.cxx', + 'CXX/cxxextensions.c', + 'CXX/cxxsupport.cxx', + 'CXX/IndirectPythonInterface.cxx', 'src/agg_py_transforms.cpp', - 'src/path_cleanup.cpp', - 'src/_path.cpp'] + 'src/path_cleanup.cpp'] module = Extension('matplotlib.backends._macosx', deps, extra_link_args = ['-framework','Cocoa'], + define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] ) add_numpy_flags(module) add_agg_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7146 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7146&view=rev Author: cmoad Date: 2009年05月28日 03:24:27 +0000 (2009年5月28日) Log Message: ----------- removed gw32 link flag that's not needed for mingw anymore Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009年05月27日 16:25:33 UTC (rev 7145) +++ trunk/matplotlib/setupext.py 2009年05月28日 03:24:27 UTC (rev 7146) @@ -542,10 +542,7 @@ else: add_base_flags(module) module.libraries.append('z') - - if sys.platform == 'win32' and win32_compiler == 'mingw32': - module.libraries.append('gw32c') - + # put this last for library link order module.libraries.extend(std_libs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7985 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7985&view=rev Author: mdboom Date: 2009年11月24日 18:45:18 +0000 (2009年11月24日) Log Message: ----------- Reduce compiler warnings with Sun Studio Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009年11月24日 18:15:49 UTC (rev 7984) +++ trunk/matplotlib/setupext.py 2009年11月24日 18:45:18 UTC (rev 7985) @@ -121,6 +121,10 @@ 'build_windowing': True, 'backend': None} +defines = [ + ('PY_ARRAYAUNIQUE_SYMBOL', 'MPL_ARRAY_API'), + ('PYCXX_ISO_CPP_LIB', '1')] + # Based on the contents of setup.cfg, determine the build options if os.path.exists("setup.cfg"): config = ConfigParser.SafeConfigParser() @@ -1105,7 +1109,7 @@ deps.extend(glob.glob('CXX/*.c')) module = Extension('matplotlib.ft2font', deps, - define_macros=[('PY_ARRAYAUNIQUE_SYMBOL', 'MPL_ARRAY_API')]) + define_macros=defines) add_ft2font_flags(module) ext_modules.append(module) BUILT_FT2FONT = True @@ -1118,7 +1122,8 @@ 'ttconv/pprdrv_tt2.cpp', 'ttconv/ttutil.cpp'] - module = Extension('matplotlib.ttconv', deps) + module = Extension('matplotlib.ttconv', deps, + define_macros=defines) add_base_flags(module) ext_modules.append(module) BUILT_TTCONV = True @@ -1132,7 +1137,7 @@ module = Extension('matplotlib.backends._gtkagg', deps, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) # add agg flags before pygtk because agg only supports freetype1 @@ -1155,7 +1160,7 @@ module = Extension('matplotlib.backends._tkagg', deps, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_tk_flags(module) # do this first @@ -1198,7 +1203,7 @@ module = Extension('matplotlib.backends._macosx', deps, extra_link_args = ['-framework','Cocoa'], - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) add_agg_flags(module) @@ -1217,7 +1222,7 @@ 'matplotlib._png', deps, include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_png_flags(module) @@ -1249,7 +1254,7 @@ 'matplotlib.backends._backend_agg', deps, include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) @@ -1282,7 +1287,7 @@ 'matplotlib._path', deps, include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) @@ -1311,7 +1316,7 @@ 'matplotlib._image', deps, include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) @@ -1332,7 +1337,7 @@ sourcefiles = [os.path.join('lib/matplotlib/delaunay',s) for s in sourcefiles] delaunay = Extension('matplotlib._delaunay',sourcefiles, include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(delaunay) add_base_flags(delaunay) @@ -1349,7 +1354,7 @@ 'matplotlib._cntr', [ 'src/cntr.c'], include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) add_base_flags(module) @@ -1365,7 +1370,7 @@ 'matplotlib.nxutils', [ 'src/nxutils.c'], include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) add_base_flags(module) @@ -1384,7 +1389,7 @@ ['src/backend_gdk.c'], libraries = [], include_dirs=numpy_inc_dirs, - define_macros=[('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API')] + define_macros=defines ) add_numpy_flags(module) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7988 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7988&view=rev Author: astraw Date: 2009年11月30日 17:18:27 +0000 (2009年11月30日) Log Message: ----------- fix typo in r7985. closes SF-2903596. Thanks C. Gohlke. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009年11月30日 09:06:48 UTC (rev 7987) +++ trunk/matplotlib/setupext.py 2009年11月30日 17:18:27 UTC (rev 7988) @@ -122,7 +122,7 @@ 'backend': None} defines = [ - ('PY_ARRAYAUNIQUE_SYMBOL', 'MPL_ARRAY_API'), + ('PY_ARRAY_UNIQUE_SYMBOL', 'MPL_ARRAY_API'), ('PYCXX_ISO_CPP_LIB', '1')] # Based on the contents of setup.cfg, determine the build options This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8346 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8346&view=rev Author: efiring Date: 2010年05月30日 21:15:47 +0000 (2010年5月30日) Log Message: ----------- close 3009264; allow windows build on python 2.7; thanks to Christoph Gohlke Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2010年05月30日 20:30:47 UTC (rev 8345) +++ trunk/matplotlib/setupext.py 2010年05月30日 21:15:47 UTC (rev 8346) @@ -997,7 +997,7 @@ message = None if sys.platform == 'win32': major, minor1, minor2, s, tmp = sys.version_info - if major == 2 and minor1 == 6: + if major == 2 and minor1 in [6, 7]: module.include_dirs.extend(['win32_static/include/tcl85']) module.libraries.extend(['tk85', 'tcl85']) elif major == 2 and minor1 in [3, 4, 5]: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8540 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8540&view=rev Author: ryanmay Date: 2010年07月11日 02:29:08 +0000 (2010年7月11日) Log Message: ----------- Make setupext.py compatible with both Python 2 and 3. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2010年07月09日 18:30:07 UTC (rev 8539) +++ trunk/matplotlib/setupext.py 2010年07月11日 02:29:08 UTC (rev 8540) @@ -78,14 +78,22 @@ } import sys, os, stat -if sys.platform != 'win32': - import commands + from textwrap import fill from distutils.core import Extension import glob -import ConfigParser -import cStringIO +if sys.version_info[0] < 3: + import ConfigParser as configparser + from cStringIO import StringIO + if sys.platform != 'win32': + from commands import getstatusoutput +else: + import configparser + from io import StringIO + if sys.platform != 'win32': + from subprocess import getstatusoutput + BUILT_PNG = False BUILT_AGG = False BUILT_FT2FONT = False @@ -132,7 +140,7 @@ # Based on the contents of setup.cfg, determine the build options if os.path.exists("setup.cfg"): - config = ConfigParser.SafeConfigParser() + config = configparser.SafeConfigParser() config.read("setup.cfg") try: options['display_status'] = not config.getboolean("status", "suppress") @@ -174,27 +182,27 @@ basedirlist = options['basedirlist'].split() else: basedirlist = basedir[sys.platform] -print "basedirlist is:", basedirlist +print("basedirlist is: %s" % basedirlist) if options['display_status']: def print_line(char='='): - print char * 76 + print(char * 76) def print_status(package, status): initial_indent = "%22s: " % package indent = ' ' * 24 - print fill(str(status), width=76, + print(fill(str(status), width=76, initial_indent=initial_indent, - subsequent_indent=indent) + subsequent_indent=indent)) def print_message(message): indent = ' ' * 24 + "* " - print fill(str(message), width=76, + print(fill(str(message), width=76, initial_indent=indent, - subsequent_indent=indent) + subsequent_indent=indent)) def print_raw(section): - print section + print(section) else: def print_line(*args, **kwargs): pass @@ -248,7 +256,7 @@ has_pkgconfig.cache = False else: #print 'environ', os.environ['PKG_CONFIG_PATH'] - status, output = commands.getstatusoutput("pkg-config --help") + status, output = getstatusoutput("pkg-config --help") has_pkgconfig.cache = (status == 0) return has_pkgconfig.cache has_pkgconfig.cache = None @@ -270,7 +278,7 @@ '-U': 'undef_macros'} cmd = "%s %s %s" % (pkg_config_exec, flags, packages) - status, output = commands.getstatusoutput(cmd) + status, output = getstatusoutput(cmd) if status == 0: for token in output.split(): attr = _flags.get(token[:2], None) @@ -298,7 +306,7 @@ if not has_pkgconfig(): return default - status, output = commands.getstatusoutput( + status, output = getstatusoutput( "pkg-config %s --modversion" % (package)) if status == 0: return output @@ -466,7 +474,7 @@ def check_for_dvipng(): try: stdin, stdout = run_child_process('dvipng -version') - print_status("dvipng", stdout.readlines()[1].split()[-1]) + print_status("dvipng", stdout.readlines()[1].decode().split()[-1]) return True except (IndexError, ValueError): print_status("dvipng", "no") @@ -479,7 +487,7 @@ else: command = 'gs --version' stdin, stdout = run_child_process(command) - print_status("ghostscript", stdout.read()[:-1]) + print_status("ghostscript", stdout.read().decode()[:-1]) return True except (IndexError, ValueError): print_status("ghostscript", "no") @@ -488,7 +496,7 @@ def check_for_latex(): try: stdin, stdout = run_child_process('latex -version') - line = stdout.readlines()[0] + line = stdout.readlines()[0].decode() pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)' match = re.search(pattern, line) print_status("latex", match.group(0)) @@ -501,6 +509,7 @@ try: stdin, stdout = run_child_process('pdftops -v') for line in stdout.readlines(): + line = line.decode() if 'version' in line: print_status("pdftops", line.split()[-1]) return True @@ -794,7 +803,6 @@ # Make sure you use the Tk version given by Tkinter.TkVersion # or else you'll build for a wrong version of the Tcl # interpreter (leading to nasty segfaults). - def check_for_tk(): gotit = False explanation = None @@ -814,9 +822,15 @@ module = Extension('test', []) try: explanation = add_tk_flags(module) - except RuntimeError, e: - explanation = str(e) + except RuntimeError: + # This deals with the change in exception handling syntax in + # python 3. If we only need to support >= 2.6, we can just use the + # commented out lines below. + exc_type,exc,tb = sys.exc_info() + explanation = str(exc) gotit = False +# except RuntimeError, e: +# explanation = str(e) else: if not find_include_file(module.include_dirs, "tk.h"): message = 'Tkinter present, but header files are not found. ' + \ @@ -910,23 +924,21 @@ # So, we push a "[default]" section to a copy of the # file in a StringIO object. try: - tcl_vars_str = cStringIO.StringIO( - "[default]\n" + open(tcl_config, "r").read()) - tk_vars_str = cStringIO.StringIO( - "[default]\n" + open(tk_config, "r").read()) + tcl_vars_str = StringIO("[default]\n" + open(tcl_config, "r").read()) + tk_vars_str = StringIO("[default]\n" + open(tk_config, "r").read()) except IOError: # if we can't read the file, that's ok, we'll try # to guess instead return None tcl_vars_str.seek(0) - tcl_vars = ConfigParser.RawConfigParser() + tcl_vars = configparser.RawConfigParser() tk_vars_str.seek(0) - tk_vars = ConfigParser.RawConfigParser() + tk_vars = configparser.RawConfigParser() try: tcl_vars.readfp(tcl_vars_str) tk_vars.readfp(tk_vars_str) - except ConfigParser.ParsingError: + except configparser.ParsingError: # if we can't read the file, that's ok, we'll try # to guess instead return None @@ -942,7 +954,7 @@ else: # On RHEL4 tk_inc = tcl_inc - except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): + except (configparser.NoSectionError, configparser.NoOptionError): return None if not os.path.exists(os.path.join(tk_inc, 'tk.h')): @@ -1043,8 +1055,8 @@ # tk_include_dirs = [ join(F, fw + '.framework', H) - for fw in 'Tcl', 'Tk' - for H in 'Headers', 'Versions/Current/PrivateHeaders' + for fw in ('Tcl', 'Tk') + for H in ('Headers', 'Versions/Current/PrivateHeaders') ] # For 8.4a2, the X11 headers are not included. Rather than include a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.