2 # -*- coding: ISO-8859-1 -*-
5 # Copyright (C) 2003-2004 Jörg Lehmann <joergl@users.sourceforge.net>
6 # Copyright (C) 2003-2004 André Wobst <wobsta@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 *
30 def find_file(filename
, kpse_file_format
):
31 command
= 'kpsewhich --format="%s" %s' % (kpse_file_format
, filename
)
32 if not find_file_cache
.has_key(command
):
33 find_file_cache
[command
] = os
.popen(command
, "r").readline().strip()
34 return find_file_cache
[command
]
37 kpse_any_glyph_format
= "bitmap font"
38 kpse_tfm_format
= "tfm"
39 kpse_afm_format
= "afm"
40 kpse_base_format
= "base"
41 kpse_bib_format
= "bib"
42 kpse_bst_format
= "bst"
43 kpse_cnf_format
= "cnf"
44 kpse_db_format
= "ls-R"
45 kpse_fmt_format
= "fmt"
46 kpse_fontmap_format
= "map"
47 kpse_mem_format
= "mem"
49 kpse_mfpool_format
= "mfpool"
50 kpse_mft_format
= "mft"
52 kpse_mppool_format
= "mppool"
53 kpse_mpsupport_format
= "MetaPost support"
54 kpse_ocp_format
= "ocp"
55 kpse_ofm_format
= "ofm"
56 kpse_opl_format
= "opl"
57 kpse_otp_format
= "otp"
58 kpse_ovf_format
= "ovf"
59 kpse_ovp_format
= "ovp"
60 kpse_pict_format
= "graphics/figure"
61 kpse_tex_format
= "tex"
62 kpse_texdoc_format
= "TeX system documentation"
63 kpse_texpool_format
= "texpool"
64 kpse_texsource_format
= "TeX system sources"
65 kpse_tex_ps_header_format
= "PostScript header"
66 kpse_troff_font_format
= "Troff fonts"
67 kpse_type1_format
= "type1 fonts"
69 kpse_dvips_config_format
= "dvips config"
70 kpse_ist_format
= "ist"
71 kpse_truetype_format
= "truetype fonts"
72 kpse_type42_format
= "type42 fonts"
73 kpse_web2c_format
= "web2c"
74 kpse_program_text_format
= "other text files"
75 kpse_program_binary_format
= "other binary files"
76 kpse_miscfonts_format
= "misc fonts"
77 kpse_web_format
= "web"
78 kpse_cweb_format
= "cweb"