implement style.fillrule
[PyX.git] / contrib / callingtex.py
blob3e9b08bccdd8d0802e0f2bfed003a8c0b7b1dca8
1 #!/usr/bin/env python
2 # This file should help users tracking problems with their TeX installation
3 # It spits out a lot of information about the Python installation, the PyX
4 # installation and the environment in which PyX will try to use TeX/LaTeX.
6 import sys, os
7 import pyx
9 pyx.text.set(fontmaps="psfonts.map psfonts.cmz")
11 def test_installation():
12 try:
13 from pyx.pykpathsea import _pykpathsea
14 except ImportError:
15 compiled_pykpathsea = False
16 else:
17 compiled_pykpathsea = False
19 print "Platform is %s" % sys.platform
20 print "Python installation prefix is %s" % sys.prefix
21 print "Python executable is %s" % sys.executable
22 print "PyX comes from %s" % pyx.__file__
23 print "PyX version %s" % pyx.__version__
24 if compiled_pykpathsea:
25 print "PyX pykpathsea compiled from C module"
26 else:
27 print "PyX pykpathsea python module used"
28 print
31 def test_commands():
32 for command in [r"echo $0 \"$*\"",
33 r"echo $SHELL",
34 r"echo $BASH_SUBSHELL",
35 r"echo $-",
36 r"echo $ENV",
37 r"echo $BASH_ENV",
38 r"echo $TEXMFCNF",
39 r"echo $_",
40 r"echo $PATH",
41 r"which kpsewhich",
42 r"which tex",
43 r"which latex",
44 r"file `which kpsewhich`",
45 r"file `which tex`",
46 r"file `which latex`",
48 stdin, stdout, stderr = os.popen3(command)
49 print "\"%22s\" -->" % (command),
50 for line in stdout:
51 print " %s" % line,
52 for x in [stdin, stdout, stderr]:
53 x.close()
54 print
56 def test_fontmaps():
57 allformats = [
58 pyx.pykpathsea.kpse_gf_format,
59 pyx.pykpathsea.kpse_pk_format,
60 pyx.pykpathsea.kpse_any_glyph_format,
61 pyx.pykpathsea.kpse_tfm_format,
62 pyx.pykpathsea.kpse_afm_format,
63 pyx.pykpathsea.kpse_base_format,
64 pyx.pykpathsea.kpse_bib_format,
65 pyx.pykpathsea.kpse_bst_format,
66 pyx.pykpathsea.kpse_cnf_format,
67 pyx.pykpathsea.kpse_db_format,
68 pyx.pykpathsea.kpse_fmt_format,
69 pyx.pykpathsea.kpse_fontmap_format,
70 pyx.pykpathsea.kpse_mem_format,
71 pyx.pykpathsea.kpse_mf_format,
72 pyx.pykpathsea.kpse_mfpool_format,
73 pyx.pykpathsea.kpse_mft_format,
74 pyx.pykpathsea.kpse_mp_format,
75 pyx.pykpathsea.kpse_mppool_format,
76 pyx.pykpathsea.kpse_mpsupport_format,
77 pyx.pykpathsea.kpse_ocp_format,
78 pyx.pykpathsea.kpse_ofm_format,
79 pyx.pykpathsea.kpse_opl_format,
80 pyx.pykpathsea.kpse_otp_format,
81 pyx.pykpathsea.kpse_ovf_format,
82 pyx.pykpathsea.kpse_ovp_format,
83 pyx.pykpathsea.kpse_pict_format,
84 pyx.pykpathsea.kpse_tex_format,
85 pyx.pykpathsea.kpse_texdoc_format,
86 pyx.pykpathsea.kpse_texpool_format,
87 pyx.pykpathsea.kpse_texsource_format,
88 pyx.pykpathsea.kpse_tex_ps_header_format,
89 pyx.pykpathsea.kpse_troff_font_format,
90 pyx.pykpathsea.kpse_type1_format,
91 pyx.pykpathsea.kpse_vf_format,
92 pyx.pykpathsea.kpse_dvips_config_format,
93 pyx.pykpathsea.kpse_ist_format,
94 pyx.pykpathsea.kpse_truetype_format,
95 pyx.pykpathsea.kpse_type42_format,
96 pyx.pykpathsea.kpse_web2c_format,
97 pyx.pykpathsea.kpse_program_text_format,
98 pyx.pykpathsea.kpse_program_binary_format,
99 pyx.pykpathsea.kpse_miscfonts_format,
100 pyx.pykpathsea.kpse_web_format,
101 pyx.pykpathsea.kpse_cweb_format]
103 for fontmap in pyx.text.defaulttexrunner.fontmaps.split():
104 found = 0
105 for format in allformats:
106 mappath = pyx.pykpathsea.find_file(fontmap, format)
107 if mappath:
108 found = 1
109 print "\"%s\" found at \"%s\" as format \"%s\"" % (fontmap, mappath, format)
110 if not found:
111 print "\"%s\" not found" % fontmap
112 print
114 test_installation()
115 test_commands()
116 test_fontmaps()