prevent double call of _cleanup, which harms usefiles (and is a bad idea in general)
[PyX.git] / setup.py
blob8e47b5b145110cb13a59823cabca31f1f8391fc0
1 #!/usr/bin/env python3
2 # -*- encoding: utf-8 -*-
4 """Python package for the generation of PostScript, PDF, and SVG files
6 PyX is a Python package for the creation of PostScript, PDF, and SVG 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 sys
13 if sys.version_info[0] == 2:
14 print("""*** Sorry, this version of PyX runs on Python 3 only. ***
15 If you want to use PyX on Python 2, please use one of our
16 old releases up to PyX 0.12.x, i.e. execute something like:
18 pip install pyx==0.12.1
19 """)
20 exit()
23 import configparser
24 import pyx.version
26 cfg = configparser.ConfigParser()
27 cfg.read("setup.cfg")
29 # obtain information on which modules have to be built and whether to use setuptools
30 # instead of distutils from setup.cfg file
32 if cfg.has_section("PyX"):
33 if cfg.has_option("PyX", "use_setuptools") and cfg.getboolean("PyX", "use_setuptools"):
34 from setuptools import setup, Extension
35 setuptools_args={"zip_safe": True}
36 else:
37 from distutils.core import setup, Extension
38 setuptools_args={}
41 # build list of extension modules
43 ext_modules = []
44 pykpathsea_ext_module = Extension("pyx.pykpathsea",
45 sources=["pyx/pykpathsea.c"],
46 libraries=["kpathsea"])
47 t1code_ext_module = Extension("pyx.font._t1code",
48 sources=["pyx/font/_t1code.c"])
49 if cfg.has_option("PyX", "build_pykpathsea") and cfg.getboolean("PyX", "build_pykpathsea"):
50 ext_modules.append(pykpathsea_ext_module)
51 if cfg.has_option("PyX", "build_t1code") and cfg.getboolean("PyX", "build_t1code"):
52 ext_modules.append(t1code_ext_module)
55 description, long_description = __doc__.split("\n\n", 1)
57 setup(name="PyX",
58 version=pyx.version.version,
59 author="Jörg Lehmann, André Wobst",
60 author_email="pyx-devel@lists.sourceforge.net",
61 url="http://pyx.sourceforge.net/",
62 description=description,
63 long_description=long_description,
64 license="GPL",
65 packages=["pyx", "pyx/graph", "pyx/graph/axis", "pyx/font", "pyx/dvi", "pyx/metapost"],
66 package_data={"pyx": ["data/afm/*", "data/lfs/*", "data/def/*", "data/pyxrc"]},
67 ext_modules=ext_modules,
68 classifiers=["Development Status :: 3 - Alpha",
69 "Intended Audience :: Developers",
70 "Intended Audience :: End Users/Desktop",
71 "License :: OSI Approved :: GNU General Public License (GPL)",
72 "Operating System :: OS Independent",
73 "Programming Language :: Python :: 3",
74 "Topic :: Multimedia :: Graphics",
75 "Topic :: Scientific/Engineering :: Visualization",
76 "Topic :: Software Development :: Libraries :: Python Modules"],
77 platforms="OS independent",
78 **setuptools_args)