fix internal name clash when generating a normpath from an empty path (reported by...
[PyX.git] / __init__.py
blob320dd7865f207582c09519e4acbf44bb062848a6
1 # -*- encoding: utf-8 -*-
4 # Copyright (C) 2002-2005 Jörg Lehmann <joergl@users.sourceforge.net>
5 # Copyright (C) 2002-2006 André Wobst <wobsta@users.sourceforge.net>
6 # Copyright (C) 2006 Michael Schindler <m-schindler@users.sourceforge.net>
8 # This file is part of PyX (http://pyx.sourceforge.net/).
10 # PyX is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # PyX is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with PyX; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 """Python graphics package
26 PyX is a Python package for the creation of PostScript and PDF files. It
27 combines an abstraction of the PostScript drawing model with a TeX/LaTeX
28 interface. Complex tasks like 2d and 3d plots in publication-ready quality are
29 built out of these primitives.
30 """
32 from . import version
33 __version__ = version.version
35 import sys
36 if sys.hexversion < 0x03020000:
37 sys.stderr.write("PyX {} requires Python 3.2 or higher.\n".format(__version__))
38 sys.exit()
39 del sys
41 __all__ = ["attr", "box", "bitmap", "canvas", "color", "connector", "deco", "deformer", "document",
42 "epsfile", "graph", "mesh", "metapost", "path", "pattern", "pdfextra", "style", "trafo", "text", "unit"]
44 import importlib
46 # automatically import main modules into pyx namespace
47 for module in __all__:
48 importlib.import_module('.' + module, package='pyx')
50 def pyxinfo():
51 import logging, os, sys
52 from . import config
53 logging.lastResort.setLevel(logging.INFO)
54 logger = logging.getLogger("pyx")
55 logger.setLevel(logging.INFO)
56 logger.info("Platform name is: {}".format(os.name))
57 logger.info("Python executable: {}".format(sys.executable))
58 logger.info("Python version: %s", sys.version)
59 logger.info("PyX comes from: %s", __file__)
60 logger.info("PyX version: %s", __version__)
61 logger.info("pyxrc %s %s %s", "is" if os.path.isfile(config.user_pyxrc) else "would be" ,"loaded from:", config.user_pyxrc)
62 logger.info("pykpathsea: %s", "available" if config.has_pykpathsea else "not available")
63 logger.info("file locators in use: %s", ", ".join(method.__class__.__name__ for method in config.methods))
65 __all__.append("__version__")
66 __all__.append("pyxinfo")