File: callingtex.py

package info (click to toggle)
pyx 0.10-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,316 kB
  • ctags: 2,779
  • sloc: python: 16,243; ansic: 131; makefile: 87; sh: 9
file content (117 lines) | stat: -rwxr-xr-x 4,107 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/env python
# This file should help users tracking problems with their TeX installation
# It spits out a lot of information about the Python installation, the PyX
# installation and the environment in which PyX will try to use TeX/LaTeX.
#
import sys, os
import pyx

pyx.text.set(fontmaps="psfonts.map psfonts.cmz")

def test_installation():
    try:
        from pyx.pykpathsea import _pykpathsea
    except ImportError:
        compiled_pykpathsea = False
    else:
        compiled_pykpathsea = False

    print "Platform is %s" % sys.platform
    print "Python installation prefix is %s" % sys.prefix
    print "Python executable is %s" % sys.executable
    print "PyX comes from %s" % pyx.__file__
    print "PyX version %s" % pyx.__version__
    if compiled_pykpathsea:
        print "PyX pykpathsea compiled from C module"
    else:
        print "PyX pykpathsea python module used"
    print


def test_commands():
    for command in [r"echo $0 \"$*\"",
                    r"echo $SHELL",
                    r"echo $BASH_SUBSHELL",
                    r"echo $-",
                    r"echo $ENV",
                    r"echo $BASH_ENV",
                    r"echo $TEXMFCNF",
                    r"echo $_",
                    r"echo $PATH",
                    r"which kpsewhich",
                    r"which tex",
                    r"which latex",
                    r"file `which kpsewhich`",
                    r"file `which tex`",
                    r"file `which latex`",
                    ]:
        stdin, stdout, stderr = os.popen3(command)
        print "\"%22s\" -->" % (command),
        for line in stdout:
            print " %s" % line,
        for x in [stdin, stdout, stderr]:
            x.close()
    print

def test_fontmaps():
    allformats = [
        pyx.pykpathsea.kpse_gf_format,
        pyx.pykpathsea.kpse_pk_format,
        pyx.pykpathsea.kpse_any_glyph_format,
        pyx.pykpathsea.kpse_tfm_format,
        pyx.pykpathsea.kpse_afm_format,
        pyx.pykpathsea.kpse_base_format,
        pyx.pykpathsea.kpse_bib_format,
        pyx.pykpathsea.kpse_bst_format,
        pyx.pykpathsea.kpse_cnf_format,
        pyx.pykpathsea.kpse_db_format,
        pyx.pykpathsea.kpse_fmt_format,
        pyx.pykpathsea.kpse_fontmap_format,
        pyx.pykpathsea.kpse_mem_format,
        pyx.pykpathsea.kpse_mf_format,
        pyx.pykpathsea.kpse_mfpool_format,
        pyx.pykpathsea.kpse_mft_format,
        pyx.pykpathsea.kpse_mp_format,
        pyx.pykpathsea.kpse_mppool_format,
        pyx.pykpathsea.kpse_mpsupport_format,
        pyx.pykpathsea.kpse_ocp_format,
        pyx.pykpathsea.kpse_ofm_format,
        pyx.pykpathsea.kpse_opl_format,
        pyx.pykpathsea.kpse_otp_format,
        pyx.pykpathsea.kpse_ovf_format,
        pyx.pykpathsea.kpse_ovp_format,
        pyx.pykpathsea.kpse_pict_format,
        pyx.pykpathsea.kpse_tex_format,
        pyx.pykpathsea.kpse_texdoc_format,
        pyx.pykpathsea.kpse_texpool_format,
        pyx.pykpathsea.kpse_texsource_format,
        pyx.pykpathsea.kpse_tex_ps_header_format,
        pyx.pykpathsea.kpse_troff_font_format,
        pyx.pykpathsea.kpse_type1_format,
        pyx.pykpathsea.kpse_vf_format,
        pyx.pykpathsea.kpse_dvips_config_format,
        pyx.pykpathsea.kpse_ist_format,
        pyx.pykpathsea.kpse_truetype_format,
        pyx.pykpathsea.kpse_type42_format,
        pyx.pykpathsea.kpse_web2c_format,
        pyx.pykpathsea.kpse_program_text_format,
        pyx.pykpathsea.kpse_program_binary_format,
        pyx.pykpathsea.kpse_miscfonts_format,
        pyx.pykpathsea.kpse_web_format,
        pyx.pykpathsea.kpse_cweb_format]

    for fontmap in pyx.text.defaulttexrunner.fontmaps.split():
        found = 0
        for format in allformats:
            mappath = pyx.pykpathsea.find_file(fontmap, format)
            if mappath:
                found = 1
                print "\"%s\" found at \"%s\" as format \"%s\"" % (fontmap, mappath, format)
        if not found:
            print "\"%s\" not found" % fontmap
    print

test_installation()
test_commands()
test_fontmaps()