|
From: <ef...@us...> - 2007-09-08 23:53:16
|
Revision: 3817
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3817&view=rev
Author: efiring
Date: 2007-09-08 16:53:06 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
Delete gd and paint backends.
Modified Paths:
--------------
trunk/matplotlib/API_CHANGES
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/__init__.py
trunk/matplotlib/setupext.py
Removed Paths:
-------------
trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
Modified: trunk/matplotlib/API_CHANGES
===================================================================
--- trunk/matplotlib/API_CHANGES 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/API_CHANGES 2007-09-08 23:53:06 UTC (rev 3817)
@@ -1,3 +1,5 @@
+ The gd and paint backends have been deleted.
+
The errorbar method and function now accept additional kwargs
so that upper and lower limits can be indicated by capping the
bar with a caret instead of a straight line segment.
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/CHANGELOG 2007-09-08 23:53:06 UTC (rev 3817)
@@ -1,3 +1,5 @@
+2007-09-08 Eliminated gd and paint backends - EF
+
2007-09-06 .bmp file format is now longer an alias for .raw
2007-09-07 Added clip path support to pdf backend. - JKS
@@ -7,7 +9,7 @@
2007-09-06 Refactored image saving code so that all GUI backends can
save most image types. See FILETYPES for a matrix of
- backends and their supported file types.
+ backends and their supported file types.
Backend canvases should no longer write their own print_figure()
method -- instead they should write a print_xxx method for
each filetype they can output and add an entry to their
@@ -16,7 +18,7 @@
2007-09-05 Fixed Qt version reporting in setupext.py - DSD
2007-09-04 Embedding Type 1 fonts in PDF, and thus usetex support
- via dviread, sort of works. To test, enable it by
+ via dviread, sort of works. To test, enable it by
renaming _draw_tex to draw_tex. - JKS
2007-09-03 Added ability of errorbar show limits via caret or
Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/__init__.py 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/__init__.py 2007-09-08 23:53:06 UTC (rev 3817)
@@ -7,7 +7,7 @@
interactive_bk = ['GTK', 'GTKAgg', 'GTKCairo', 'FltkAgg', 'QtAgg', 'Qt4Agg',
'TkAgg', 'WX', 'WXAgg', 'CocoaAgg', 'Aqt']
-non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GD', 'GDK', 'Paint',
+non_interactive_bk = ['Agg2', 'Agg', 'Cairo', 'EMF', 'GDK',
'Pdf', 'PS', 'SVG', 'Template']
all_backends = interactive_bk + non_interactive_bk
Deleted: trunk/matplotlib/lib/matplotlib/backends/backend_gd.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gd.py 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gd.py 2007-09-08 23:53:06 UTC (rev 3817)
@@ -1,374 +0,0 @@
-"""
-A gd backend http://newcenturycomputers.net/projects/gdmodule.html
-"""
-
-
-from __future__ import division
-import sys, os, math, warnings
-
-import numpy as npy
-
-try:
- import gd
-except ImportError:
- print >>sys.stderr, 'You must first install the gd module http://newcenturycomputers.net/projects/gdmodule.html'
- sys.exit()
-
-from matplotlib.backend_bases import RendererBase, \
- GraphicsContextBase, FigureManagerBase, FigureCanvasBase
-from matplotlib import verbose
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.cbook import enumerate, pieces, is_string_like
-from matplotlib.colors import colorConverter
-from matplotlib.figure import Figure
-from matplotlib.transforms import Bbox
-from matplotlib.font_manager import findfont
-# support old font names
-if (os.environ.has_key('GDFONTPATH') and not
- os.environ.has_key('TTFPATH')):
- os.environ['TTFPATH'] = os.environ['GDFONTPATH']
-
-
-
-
-PIXELS_PER_INCH = 96 # constant GD uses for screen DPI
-
-
-def round(x):
- return int(math.floor(x+0.5))
-
-
-class RendererGD(RendererBase):
- """
- The renderer handles all the drawing primitives using a graphics
- context instance that controls the colors/styles
- """
-
-
- # todo: can gd support cap and join styles?
- def __init__(self, im, dpi):
- "Initialize the renderer with a gd image instance"
- self.im = im
- self._cached = {} # a map from get_color args to colors
-
- self.width, self.height = im.size()
- self.dpi = dpi
-
-
- def get_canvas_width_height(self):
- 'return the canvas width and height in display coords'
- return self.width, self.height
-
- def get_text_width_height_descent(self, s, prop, ismath):
- """
- get the width and height in display coords of the string s
- with fontsize in points
- """
-
- size = prop.get_size_in_points()
- font = findfont(prop)
-
- scale = self.get_text_scale()
- try:
- llx, lly, lrx, lry, urx, ury, ulx, uly = \
- self.im.get_bounding_rect(
- font, scale*size, 0.0, (0,0), s)
- except ValueError:
- raise RuntimeError('Could not load font %s. Try setting TTFFONTPATH to include this font' % fontname)
-
- w = abs(lrx - llx)
- h = abs(lly - uly)
- return w, h, h
-
-
- def flipy(self):
- 'return true if y small numbers are top for renderer'
- return True
-
-
- def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation):
- """
- Draw an arc centered at x,y with width and height and angles
- from 0.0 to 360.0
- """
-
- center = int(x), self.height-int(y)
- wh = int(width), int(height)
- a1, a2 = int(angle1), int(angle2)
- if rgbFace is not None:
- color = self.get_gd_color( rgbFace )
- self.im.filledEllipse(
- center, wh, color)
- color = self.get_gd_color( gc.get_rgb() )
- self.im.arc(center, wh, a1, a2, color)
- self.flush_clip()
-
- def draw_line(self, gc, x1, y1, x2, y2):
- """
- Draw a single line from x1,y1 to x2,y2
- """
- self.draw_lines(gc, npy.array([x1, x2]), npy.array([y1, y2]))
-
- def draw_lines(self, gc, x, y):
- """
- x and y are equal length arrays, draw lines connecting each
- point in x, y
- """
-
- x = x.astype(npy.int16)
- y = self.height*npy.ones(y.shape, npy.int16) - y.astype(npy.int16)
- style = self._set_gd_style(gc)
- self.im.lines( zip(x,y), style)
- self.flush_clip()
-
- def draw_point(self, gc, x, y):
- """
- Draw a single point at x,y
- """
- self.im.setPixel((int(x),self.height-int(y)),
- self.get_gd_color( gc.get_rgb() ))
- self.flush_clip()
-
-
-
- def draw_polygon(self, gc, rgbFace, points):
- """
- Draw a polygon. points is a len vertices tuple, each element
- giving the x,y coords a vertex
- """
-
- edgecolor = self.get_gd_color( gc.get_rgb() )
-
- points = [(int(x), self.height-int(y)) for x,y in points]
-
-
- if rgbFace is not None:
- facecolor = self.get_gd_color( rgbFace )
- self.im.filledPolygon(points, facecolor)
- else: facecolor = None
- if edgecolor != facecolor:
- self.im.polygon(points, edgecolor)
- self.flush_clip()
-
- def draw_rectangle(self, gc, rgbFace, x, y, width, height):
- """
- Draw a rectangle at lower left x,y with width and height
- If filled=True, fill the rectangle with the gc foreground
- gc is a GraphicsContext instance
- """
-
- lb = int(x), self.height-int(y)
- ur = int(x+width), self.height-int((y+height))
- edgecolor = self.get_gd_color( gc.get_rgb() )
-
- if rgbFace is not None:
- facecolor = self.get_gd_color( rgbFace )
- self.im.filledRectangle(ur, lb, facecolor)
- else: facecolor = None
-
- if edgecolor != facecolor:
- self.im.rectangle(ur, lb, edgecolor)
- self.flush_clip()
-
- def draw_text(self, gc, x, y, s, prop, angle, ismath):
- """
- Render the text using the RendererGD instance
- """
-
- size = prop.get_size_in_points()
- font = findfont(prop)
-
- x = int(x)
- y = int(y)
-
- color = self.get_gd_color( gc.get_rgb() )
-
- angle *= math.pi/180.0
-
- scale = self.get_text_scale()
- self.im.string_ft(font, scale*size, angle,
- (x, y), s, color)
- self.flush_clip()
-
- def finish(self):
- pass
- #self.im.writePng( file('xx.png', 'w') )
-
-
- def flush_clip(self):
- imw, imh = self.im.size()
- lb = 0, 0
- ur = imw, imh
- self.im.setClip(ur, lb)
-
-
- def get_gd_color(self, rgb):
- """
- RGB is a unit RGB tuple, return a gd color
- """
-
- r,g,b = rgb
- rgbi = (int(r*255),int(g*255),int(b*255))
-
- try: return self._cached[rgbi]
- except KeyError: pass
-
- color = self.im.colorAllocate( rgbi )
-
- if color==-1:
- warnings.warn('Unable to allocate color %1.3f, %1.3f, %1.3f; using nearest neighbor' % rgb)
- color = self.im.colorClosest(rgbi)
-
- self._cached[rgbi] = color
- return color
-
-
-
-
- def get_text_scale(self):
- """
- Return the scale factor for fontsize taking screendpi and pixels per
- inch into account
- """
- return self.dpi.get()/PIXELS_PER_INCH
-
- def new_gc(self):
- """
- Return an instance of a GraphicsContextGD
- """
- return GraphicsContextGD( self.im, self )
-
- def _set_gd_style(self, gc):
- color = self.get_gd_color( gc.get_rgb() )
- offset, dashes = gc.get_dashes()
-
- if dashes is not None:
- pixels = self.points_to_pixels(dashes)
- style = []
- for on, off in pieces(pixels):
- if on<1: on = 1
- else: on = round(on)
- if off<1: off = 1
- else: off = round(off)
-
- style.extend([color]*on)
- style.extend([gd.gdTransparent]*off)
- self.im.setStyle(style)
- return gd.gdStyled
- else:
- if gc.get_antialiased():
- self.im.setAntiAliased(color)
- return gd.gdAntiAliased
- else:
- self.im.setStyle([color])
- return gd.gdStyled
-
-
- def points_to_pixels(self, points):
- """
- convert point measures to pixes using dpi and the pixels per
- inch of the display
- """
- return npy.asarray(points)*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
-
-
-class GraphicsContextGD(GraphicsContextBase):
- """
- The graphics context provides the color, line styles, etc... See
- the gtk and postscript backends for examples of mapping the
- graphics context attributes (cap styles, join styles, line widths,
- colors) to a particular backend. """
- def __init__(self, im, renderer):
- """
- Initialize with a gd image
- """
- GraphicsContextBase.__init__(self)
- self.im = im
- self.renderer = renderer
-
-
- def set_clip_rectangle(self, rectangle):
- GraphicsContextBase.set_clip_rectangle(self, rectangle)
- x,y,w,h = rectangle
- imw, imh = self.im.size()
- lb = int(x), imh-int(y)
- ur = int(x+w), imh-int(y+h)
- self.im.setClip(ur, lb)
-
- def set_linestyle(self, style):
- GraphicsContextBase.set_linestyle(self, style)
- offset, dashes = self.dashd[style]
- self.set_dashes(offset, dashes)
-
- def set_linewidth(self, lw):
- GraphicsContextBase.set_linewidth(self, lw)
- pixels = self.renderer.points_to_pixels(lw)
- if pixels<1: pixels = 1
- else: pixels = round(pixels)
- self.im.setThickness(pixels)
-
-########################################################################
-#
-# The following functions and classes are for matlab compatibility
-# mode (pylab) and implement figure managers, etc...
-#
-########################################################################
-
-
-def new_figure_manager(num, *args, **kwargs):
- """
- Add a new figure num (default autoincrement). For GUI
- backends, you'll need to instantiate a new window and embed
- the figure in it.
- """
- FigureClass = kwargs.pop('FigureClass', Figure)
- thisFig = FigureClass(*args, **kwargs)
- canvas = FigureCanvasGD(thisFig)
- manager = FigureManagerGD(canvas, num)
- return manager
-
-
-class FigureCanvasGD(FigureCanvasBase):
- filetypes = {'PNG': 'Portable Network Graphics'}
-
- def print_png(self, filename, *args, **kwargs):
- im = self.draw()
- im.writePng(filename)
-
- def get_default_filetype(self):
- return 'png'
-
- def draw(self):
- """
- Draw to a gd image and return the image instance
-
- """
-
- left, bottom, width, height = self.figure.bbox.get_bounds()
- im = gd.image((int(width), int(height)))
-
- if not hasattr(im, 'setAntiAliased'):
- raise RuntimeError('gd_requirements_failed')
- renderer = RendererGD(im, self.figure.dpi)
- self.figure.draw(renderer)
- renderer.finish()
-
- return im
-
-class FigureManagerGD(FigureManagerBase):
- """
- This class manages all the figures for matlab mode
- """
- pass
-
-
-
-########################################################################
-#
-# Now just provide the standard names that backend.__init__ is expecting
-#
-########################################################################
-
-FigureManager = FigureManagerGD
-
-
Deleted: trunk/matplotlib/lib/matplotlib/backends/backend_paint.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_paint.py 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_paint.py 2007-09-08 23:53:06 UTC (rev 3817)
@@ -1,281 +0,0 @@
-"""
-This ia a paint (libart) backend
-
-You can select it as a backend with
-
- import matplotlib
- matplotlib.use('Paint')
-
-REQUIREMENTS
-
- backend_paint requires pypaint-0.??, which in turn requires
- libart and freetype1
-"""
-
-from __future__ import division
-import sys
-import os
-import paint
-
-import numpy as npy
-
-from matplotlib import verbose
-
-from matplotlib._pylab_helpers import Gcf
-from matplotlib.backend_bases import RendererBase,\
- GraphicsContextBase, FigureCanvasBase, FigureManagerBase
-from matplotlib.cbook import enumerate
-from matplotlib.figure import Figure
-from matplotlib.text import Text, _process_text_args
-
-from matplotlib.font_manager import findfont
-
-"""
-
- * added dpi instance to renderer so drawing could scale with dpi
-
- * added dash path - JDH
-
- * reversed the order of fill and stroke for rectangle, arc and
- polygon so edge color would be visible
-
- * adjusted circle centers
-
-"""
-
-
-
-
-
-#paint/font.c defined dpi as 96
-PIXELS_PER_INCH = 96 # a constant used to scale text with dpi
-
-
-class RendererPaint(RendererBase):
- """
- The renderer handles all the drawing primitives using a graphics
- context instance that controls the colors/styles
- """
-
- fontd = {} # cache paint font instances
-
- def __init__(self, width, height, dpi):
- """creates a new image"""
- w, h = int(width), int(height)
- self.image = paint.image(w, h)
- self.width, self.height = w, h
- self.dpi = dpi # for scaling dashes, linewidths
-
- def get_canvas_width_height(self):
- 'return the canvas width and height in display coords'
- return self.width, self.height
-
- def get_text_width_height(self, s, prop, ismath):
- """
- get the width and height in display coords of the string s
- with fontsize in points
- """
- font = self._get_paint_font(s, prop, 0.0)
- return font.textsize(s)
-
- def flipy(self):
- 'return true if y small numbers are top for renderer'
- return True
-
-
- def get_text_scale(self):
- """
- Return the scale factor for fontsize taking screendpi and pixels per
- inch into account
- """
- return self.dpi.get()/PIXELS_PER_INCH
-
-
-
- def draw_text(self, gc, x, y, s, prop, angle, ismath):
- """
- Render the text using the RendererPaint instance
- """
- font = self._get_paint_font(s, prop, angle)
-
- text_color = self.get_paint_color(gc.get_rgb())
- self.image.text(font, x, y, text_color, s)
-
- def _get_paint_font(self, s, prop, angle):
- """
- Get the paint font for text instance t, cacheing for efficiency
- """
-
- fname = findfont(prop)
- size = self.get_text_scale() * prop.get_size_in_points()
-
- props = fname, size, angle
-
- font = self.fontd.get(props)
- if font is None:
- font = paint.font(*props)
- self.fontd[props] = font
- return font
-
- def get_paint_color(self, rgb):
- """returns a paint color object based on the given rgb tuple"""
- r,g,b = rgb
- return paint.rgb(int(r*255),int(g*255),int(b*255))
-
- def draw_arc(self, gcEdge, rgbFace, x, y, width, height, angle1, angle2, rotation):
- """
- Draw an arc centered at x,y with width and height and angles
- from 0.0 to 360.0.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- arc = paint.arc(x-0.5*width, self.height - (y-0.5*height),
- x+0.5*width, self.height - (y+0.5*height),
- angle1, angle2)
- if rgbFace:
- self.image.fill(arc, self.get_paint_color(rgbFace))
- self.image.stroke(arc, self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
-
-
- def draw_line(self, gc, x1, y1, x2, y2):
- """
- Draw a single line from x1,y1 to x2,y2
- """
- path = paint.line(x1, self.height - y1, x2, self.height - y2)
- path = self.dash_path(gc, path)
- self.image.stroke(path, \
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
-
- def dash_path(self, gc, path):
- """
- Add dashes to the path and return it if dashes are set
- """
- offset, dashes = gc.get_dashes()
- if dashes is not None:
-
- dashes = tuple(self.points_to_pixels(npy.asarray(dashes)))
- return path.dash(offset, dashes)
- else:
- return path
-
- def draw_lines(self, gc, x, y):
- """
- x and y are equal length arrays, draw lines connecting each
- point in x, y
- """
- assert(len(x)==len(y))
- # faster as a list comp
-
- path = [(paint.MOVETO, x[0], self.height-y[0])]
- path.extend( [ (paint.LINETO, x[i], self.height-y[i]) for i in range(1, len(x))])
-
- path = self.dash_path(gc, paint.make_path(path))
- self.image.stroke(path,
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
-
- def draw_polygon(self, gcEdge, rgbFace, points):
- """
- Draw a polygon. points is a len vertices tuple, each element
- giving the x,y coords a vertex.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- x = [p[0] for p in points]
- y = [p[1] for p in points]
- path = [(paint.MOVETO, x[0], self.height - y[0])]
- for i in range(len(x)-1):
- path.append((paint.LINETO, x[i+1], self.height - y[i+1]))
- path.append((paint.LINETO, x[0], self.height - y[0]))
- path = paint.make_path(path)
-
- if rgbFace:
- self.image.fill(path, self.get_paint_color(rgbFace))
- self.image.stroke(path,
- self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
- def draw_rectangle(self, gcEdge, rgbFace, x, y, width, height):
- """
- Draw a rectangle at lower left x,y with width and height.
-
- If rgbFace is not None, fill the rectangle with it. gcEdge
- is a GraphicsContext instance
- """
- path = paint.rect(x, self.height - y, x+width, self.height - (y+height))
-
- if rgbFace:
- self.image.fill(path, self.get_paint_color(rgbFace))
- self.image.stroke(path,
- self.get_paint_color(gcEdge.get_rgb()),
- self.points_to_pixels(gcEdge.get_linewidth()))
-
- def draw_point(self, gc, x, y):
- """
- Draw a single point at x,y
- """
- self.image.stroke(
- paint.line(x, self.height - y, x, self.height - y),
- self.get_paint_color(gc.get_rgb()),
- self.points_to_pixels(gc.get_linewidth()))
-
- def points_to_pixels(self, points):
- return points*(PIXELS_PER_INCH/72.0*self.dpi.get()/72.0)
-
-
-
-class FigureCanvasPaint(FigureCanvasBase):
-
- def draw(self):
- """
- Render the figure using RendererPaint instance renderer
- """
- t1,t2,width,height = self.figure.bbox.get_bounds()
- renderer = RendererPaint(width,height, self.figure.dpi)
- self.figure.draw(renderer)
- return renderer
-
- filetypes = {'png': 'Portable Network Graphics'}
-
- def print_png(self, filename, *args, **kwargs):
- renderer = self.draw()
- renderer.image.write_png(filename)
-
- def get_default_filetype(self):
- return 'png'
-
-########################################################################
-#
-# The following functions and classes are for matlab compatibility
-# mode (pylab) and implement window/figure managers,
-# etc...
-#
-########################################################################
-
-
-def new_figure_manager_paint(num, *args, **kwargs):
- """
- Add a new figure num (default autoincrement). For GUI
- backends, you'll need to instantiate a new window and embed
- the figure in it.
- """
- FigureClass = kwargs.pop('FigureClass', Figure)
- thisFig = FigureClass(*args, **kwargs)
- canvas = FigureCanvasPaint(thisFig)
- manager = FigureManagerBase(canvas, num)
- return manager
-
-
-########################################################################
-#
-# Now just provide the standard names that backend.__init__ is expecting
-#
-########################################################################
-new_figure_manager = new_figure_manager_paint
-
-
Modified: trunk/matplotlib/setupext.py
===================================================================
--- trunk/matplotlib/setupext.py 2007-09-07 20:43:20 UTC (rev 3816)
+++ trunk/matplotlib/setupext.py 2007-09-08 23:53:06 UTC (rev 3817)
@@ -130,7 +130,7 @@
def print_line(*args, **kwargs):
pass
print_status = print_message = print_raw = print_line
-
+
class CleanUpFile:
"""CleanUpFile deletes the specified filename when self is destroyed."""
def __init__(self, name):
@@ -174,7 +174,7 @@
has_pkgconfig.cache = (status == 0)
return has_pkgconfig.cache
has_pkgconfig.cache = None
-
+
def get_pkgconfig(module,
packages,
flags="--libs --cflags",
@@ -189,7 +189,7 @@
'-l': 'libraries',
'-D': 'define_macros',
'-U': 'undef_macros'}
-
+
status, output = commands.getstatusoutput(
"%s %s %s" % (pkg_config_exec, flags, packages))
if status == 0:
@@ -247,7 +247,7 @@
", ".join(["'%s'" % x for x in module.include_dirs]))
return True
-
+
def check_for_libpng():
module = Extension("test", [])
get_pkgconfig(module, 'libpng')
@@ -260,7 +260,7 @@
", ".join(["'%s'" % x for x in module.include_dirs]))
return True
-
+
def add_base_flags(module):
incdirs = filter(os.path.exists,
[os.path.join(p, 'include') for p in basedir[sys.platform] ])
@@ -318,7 +318,7 @@
return False
else:
print_status("Cairo", cairo.version)
-
+
def check_for_numpy():
gotit = False
try:
@@ -357,16 +357,12 @@
# put these later for correct link order
module.libraries.extend(std_libs)
-def add_gd_flags(module):
- 'Add the module flags to build extensions which use gd'
- module.libraries.append('gd')
-
def add_ft2font_flags(module):
'Add the module flags to ft2font extension'
if not get_pkgconfig(module, 'freetype2'):
module.libraries.extend(['freetype', 'z'])
add_base_flags(module)
-
+
basedirs = module.include_dirs[:] # copy the list to avoid inf loop!
for d in basedirs:
module.include_dirs.append(os.path.join(d, 'freetype2'))
@@ -381,7 +377,7 @@
if os.path.exists(p): module.library_dirs.append(p)
else:
add_base_flags(module)
-
+
if sys.platform == 'win32' and win32_compiler == 'mingw32':
module.libraries.append('gw32c')
@@ -417,7 +413,7 @@
def ver2str(tup):
return ".".join([str(x) for x in tup])
-
+
if gotit:
import gobject
if hasattr(gobject, 'pygobject_version'):
@@ -432,7 +428,7 @@
if explanation is not None:
print_message(explanation)
-
+
return gotit
def add_pygtk_flags(module):
@@ -459,26 +455,26 @@
])
add_base_flags(module)
-
+
if not os.environ.has_key('PKG_CONFIG_PATH'):
# If Gtk+ is installed, pkg-config is required to be installed
os.environ['PKG_CONFIG_PATH'] = 'C:\GTK\lib\pkgconfig'
-
- pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split()
- gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split()
- includes = pygtkIncludes + gtkIncludes
- module.include_dirs.extend([include[2:] for include in includes])
-
- pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split()
- gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split()
+
+ pygtkIncludes = getoutput('pkg-config --cflags-only-I pygtk-2.0').split()
+ gtkIncludes = getoutput('pkg-config --cflags-only-I gtk+-2.0').split()
+ includes = pygtkIncludes + gtkIncludes
+ module.include_dirs.extend([include[2:] for include in includes])
+
+ pygtkLinker = getoutput('pkg-config --libs pygtk-2.0').split()
+ gtkLinker = getoutput('pkg-config --libs gtk+-2.0').split()
linkerFlags = pygtkLinker + gtkLinker
-
+
module.libraries.extend(
[flag[2:] for flag in linkerFlags if flag.startswith('-l')])
-
+
module.library_dirs.extend(
[flag[2:] for flag in linkerFlags if flag.startswith('-L')])
-
+
module.extra_link_args.extend(
[flag for flag in linkerFlags if not
(flag.startswith('-l') or flag.startswith('-L'))])
@@ -544,7 +540,7 @@
if explanation is not None:
print_message(explanation)
return gotit
-
+
def find_wx_config():
"""If the WX_CONFIG environment variable has been set, returns it value.
Otherwise, search for `wx-config' in the PATH directories and return the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|