callingtex.py :  » PDF » PyX » PyX-0.10 » contrib » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » PDF » PyX 
PyX » PyX 0.10 » contrib » callingtex.py
#!/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()

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.