1 # -*- coding: ISO-8859-1 -*-
4 # Copyright (C) 2003-2004 Jörg Lehmann <joergl@users.sourceforge.net>
5 # Copyright (C) 2003-2004 André Wobst <wobsta@users.sourceforge.net>
6 # Copyright (C) 2010 Michael Schinler <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
26 from _pykpathsea
import *
31 def find_file(filename
, kpse_file_format
):
32 command
= ("kpsewhich", "--format=%s"%kpse_file_format
, filename
)
33 if not find_file_cache
.has_key(command
):
34 find_file_cache
[command
] = subprocess
.Popen(command
, stdout
=subprocess
.PIPE
).communicate(input=None)[0].strip()
35 return find_file_cache
[command
]
38 def find_file(filename
, kpse_file_format
):
39 command
= 'kpsewhich --format="%s" %s' % (kpse_file_format
, filename
)
40 if not find_file_cache
.has_key(command
):
41 find_file_cache
[command
] = os
.popen(command
, "r").readline().strip()
42 return find_file_cache
[command
]
45 kpse_any_glyph_format
= "bitmap font"
46 kpse_tfm_format
= "tfm"
47 kpse_afm_format
= "afm"
48 kpse_base_format
= "base"
49 kpse_bib_format
= "bib"
50 kpse_bst_format
= "bst"
51 kpse_cnf_format
= "cnf"
52 kpse_db_format
= "ls-R"
53 kpse_fmt_format
= "fmt"
54 kpse_fontmap_format
= "map"
55 kpse_mem_format
= "mem"
57 kpse_mfpool_format
= "mfpool"
58 kpse_mft_format
= "mft"
60 kpse_mppool_format
= "mppool"
61 kpse_mpsupport_format
= "MetaPost support"
62 kpse_ocp_format
= "ocp"
63 kpse_ofm_format
= "ofm"
64 kpse_opl_format
= "opl"
65 kpse_otp_format
= "otp"
66 kpse_ovf_format
= "ovf"
67 kpse_ovp_format
= "ovp"
68 kpse_pict_format
= "graphics/figure"
69 kpse_tex_format
= "tex"
70 kpse_texdoc_format
= "TeX system documentation"
71 kpse_texpool_format
= "texpool"
72 kpse_texsource_format
= "TeX system sources"
73 kpse_tex_ps_header_format
= "PostScript header"
74 kpse_troff_font_format
= "Troff fonts"
75 kpse_type1_format
= "type1 fonts"
77 kpse_dvips_config_format
= "dvips config"
78 kpse_ist_format
= "ist"
79 kpse_truetype_format
= "truetype fonts"
80 kpse_type42_format
= "type42 fonts"
81 kpse_web2c_format
= "web2c files"
82 kpse_program_text_format
= "other text files"
83 kpse_program_binary_format
= "other binary files"
84 kpse_miscfonts_format
= "misc fonts"
85 kpse_web_format
= "web"
86 kpse_cweb_format
= "cweb"
87 kpse_enc_format
= "enc files"
88 kpse_cmap_format
= "cmap files"
89 kpse_subfont_definition_format
= "subfont definition files"
90 kpse_opentype_format
= "opentype fonts"
91 kpse_pdftex_config_format
= "pdftex config"
92 kpse_lig_format
= "lig files"
93 kpse_texmfscripts_format
= "texmfscripts"
94 kpse_lua_format
= "lua"
95 kpse_font_feature_format
= "font feature files"
96 kpse_cid_maps_format
= "cid maps"
97 kpse_mlbib_format
= "mlbib"
98 kpse_mlbst_format
= "mlbst"