2 # -*- coding: ISO-8859-1 -*-
4 """Python package for the generation of encapsulated PostScript figures
6 PyX is a Python package for the creation of encapsulated PostScript figures.
7 It provides both an abstraction of PostScript and a TeX/LaTeX interface.
8 Complex tasks like 2d and 3d plots in publication-ready quality are built out
12 from distutils
.core
import setup
, Extension
13 from distutils
.command
.install
import install
19 # build list of extension modules
23 pykpathsea_ext_module
= Extension("pyx.pykpathsea._pykpathsea",
24 sources
=["pyx/pykpathsea/pykpathsea.c"],
25 libraries
=["kpathsea"])
26 t1strip_ext_module
= Extension("pyx.t1strip._t1strip",
27 sources
=["pyx/t1strip/t1strip.c", "pyx/t1strip/writet1.c"])
29 # obtain information on which modules have to be built from setup.cfg file
30 cfg
= ConfigParser
.ConfigParser()
32 if cfg
.has_section("PyX"):
33 if cfg
.has_option("PyX", "build_pykpathsea") and cfg
.getboolean("PyX", "build_pykpathsea"):
34 ext_modules
.append(pykpathsea_ext_module
)
35 if cfg
.has_option("PyX", "build_t1strip") and cfg
.getboolean("PyX", "build_t1strip"):
36 ext_modules
.append(t1strip_ext_module
)
42 data_files
= [("share/pyx", ["pyx/lfs/10pt.lfs",
48 "pyx/lfs/foils17pt.lfs",
49 "pyx/lfs/foils20pt.lfs",
50 "pyx/lfs/foils25pt.lfs",
51 "pyx/lfs/foils30pt.lfs",
55 # install enhanced by siteconfig
58 class pyxinstall(install
):
61 # name of the siteconfig file
62 siteconfigname
= os
.path
.join("pyx", "siteconfig.py")
64 # read existing siteconfig
66 f
= open(siteconfigname
, "rb")
67 oldsiteconfig
= f
.read()
73 # fill siteconfig data
74 sharedir
= os
.path
.join(self
.install_data
, "share", "pyx")
75 f
= open(siteconfigname
, "w")
76 f
.write("lfsdir = %r\n" % sharedir
)
77 f
.write("sharedir = %r\n" % sharedir
)
83 # restore existing siteconfig
84 if oldsiteconfig
is not None:
85 f
= open(siteconfigname
, "wb")
86 f
.write(oldsiteconfig
)
89 os
.unlink(siteconfigname
)
92 # additional package metadata (only available in Python 2.3 and above)
95 if sys
.version_info
>= (2, 3):
96 addargs
= { "classifiers":
97 [ "Development Status :: 3 - Alpha",
98 "Intended Audience :: Developers",
99 "Intended Audience :: End Users/Desktop",
100 "License :: OSI Approved :: GNU General Public License (GPL)",
101 "Operating System :: OS Independent",
102 "Programming Language :: Python",
103 "Topic :: Multimedia :: Graphics",
104 "Topic :: Scientific/Engineering :: Visualization",
105 "Topic :: Software Development :: Libraries :: Python Modules" ],
107 "http://sourceforge.net/project/showfiles.php?group_id=45430",
114 # We're using the module docstring as the distutils descriptions. (seen in Zope3 setup.py)
115 doclines
= __doc__
.split("\n")
118 version
=pyx
.__version
__,
119 author
="Jörg Lehmann, André Wobst",
120 author_email
="pyx-devel@lists.sourceforge.net",
121 url
="http://pyx.sourceforge.net/",
122 description
=doclines
[0],
123 long_description
="\n".join(doclines
[2:]),
125 packages
=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/t1strip", "pyx/pykpathsea"],
126 ext_modules
=ext_modules
,
127 data_files
=data_files
,
128 cmdclass
= {"install": pyxinstall
},