create py3k branch
[PyX.git] / setup.py
blobf33166de2e9af6924c270d69f8d196c383912868
1 #!/usr/bin/env python
2 # -*- encoding: utf-8 -*-
4 """Python package for the generation of PostScript and PDF files
6 PyX is a Python package for the creation of PostScript and PDF files. It
7 combines an abstraction of the PostScript drawing model with a TeX/LaTeX
8 interface. Complex tasks like 2d and 3d plots in publication-ready quality are
9 built out of these primitives."""
11 import configparser
12 import pyx.version
14 cfg = configparser.ConfigParser()
15 cfg.read("setup.cfg")
17 # obtain information on which modules have to be built and whether to use setuptools
18 # instead of distutils from setup.cfg file
20 if cfg.has_section("PyX"):
21 if cfg.has_option("PyX", "use_setuptools") and cfg.getboolean("PyX", "use_setuptools"):
22 from setuptools import setup, Extension
23 import pkgutil
24 try:
25 pkgutil.get_data
26 except AttributeError:
27 setuptools_args={"zip_safe": False}
28 else:
29 setuptools_args={"zip_safe": True}
30 else:
31 from distutils.core import setup, Extension
32 setuptools_args={}
35 # build list of extension modules
37 ext_modules = []
38 pykpathsea_ext_module = Extension("pyx.pykpathsea",
39 sources=["pyx/pykpathsea.c"],
40 libraries=["kpathsea"])
41 t1code_ext_module = Extension("pyx.font._t1code",
42 sources=["pyx/font/_t1code.c"])
43 if cfg.has_option("PyX", "build_pykpathsea") and cfg.getboolean("PyX", "build_pykpathsea"):
44 ext_modules.append(pykpathsea_ext_module)
45 if cfg.has_option("PyX", "build_t1code") and cfg.getboolean("PyX", "build_t1code"):
46 ext_modules.append(t1code_ext_module)
49 description, long_description = __doc__.split("\n\n", 1)
51 setup(name="PyX",
52 version=pyx.version.version,
53 author="Jörg Lehmann, André Wobst",
54 author_email="pyx-devel@lists.sourceforge.net",
55 url="http://pyx.sourceforge.net/",
56 description=description,
57 long_description=long_description,
58 license="GPL",
59 packages=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/font", "pyx/dvi", "pyx/metapost"],
60 package_data={"pyx": ["data/afm/*", "data/lfs/*", "data/def/*", "data/pyxrc"]},
61 ext_modules=ext_modules,
62 classifiers=["Development Status :: 3 - Alpha",
63 "Intended Audience :: Developers",
64 "Intended Audience :: End Users/Desktop",
65 "License :: OSI Approved :: GNU General Public License (GPL)",
66 "Operating System :: OS Independent",
67 "Programming Language :: Python",
68 "Topic :: Multimedia :: Graphics",
69 "Topic :: Scientific/Engineering :: Visualization",
70 "Topic :: Software Development :: Libraries :: Python Modules"],
71 download_url="https://downloads.sourceforge.net/project/pyx/pyx/%(version)s/PyX-%(version)s.tar.gz" % {"version": pyx.version.version},
72 platforms="OS independent",
73 **setuptools_args)