3 from distutils
.core
import setup
, Extension
4 from distutils
.command
.build_ext
import build_ext
11 "_viewer": ">>> SVG(\"circle\", 30, 50, 10).view() (pop up a window and look at an SVG fragment)",
14 class my_build_ext(build_ext
):
15 def build_extension(self
, extension
):
17 build_ext
.build_extension(self
, extension
)
19 for ext
, feat
in extension_features
.items():
20 if ext
in extension
.name
and feat
is None:
21 raise Exception, "Failed to compile %s" % ext
23 print "************************************************************************************************"
25 print "Note: couldn't compile \"%s\", so you will be unable to use this feature:" % extension
.name
27 for ext
, feat
in extension_features
.items():
28 if ext
in extension
.name
:
32 print "************************************************************************************************"
34 curve_extension
= Extension(os
.path
.join("svgfig", "_curve"), [os
.path
.join("svgfig", "_curve.c")], {})
36 def viewer_pkgconfig():
37 def drop_whitespace(word
): return word
!= "\n" and word
!= ""
38 return filter(drop_whitespace
, os
.popen("pkg-config --cflags --libs gtk+-2.0 gthread-2.0").read().split(" "))
40 viewer_extension
= Extension(os
.path
.join("svgfig", "_viewer"),
41 [os
.path
.join("svgfig", "_viewer.c")], {},
42 libraries
=["cairo", "rsvg-2"],
43 extra_compile_args
=viewer_pkgconfig(),
44 extra_link_args
=viewer_pkgconfig())
47 version
=svgfig
.defaults
.version
,
48 description
="SVGFig: Quantitative drawing in Python and SVG",
49 author
="Jim Pivarski",
50 author_email
="jpivarski@gmail.com",
51 url
="http://code.google.com/p/svgfig/",
52 py_modules
=[os
.path
.join("svgfig", "__init__"),
53 os
.path
.join("svgfig", "interactive"),
54 os
.path
.join("svgfig", "svg"),
55 os
.path
.join("svgfig", "defaults"),
56 os
.path
.join("svgfig", "glyphs"),
57 os
.path
.join("svgfig", "trans"),
58 os
.path
.join("svgfig", "pathdata"),
59 os
.path
.join("svgfig", "curve"),
60 os
.path
.join("svgfig", "plot"),
62 cmdclass
={"build_ext": my_build_ext
},
63 ext_modules
=[curve_extension
, viewer_extension
],