Here is the first conversion. Please test if TexFiles.py generates the same (after sort) list files under your platform.
I will wait for confirmation from win/cygwin. The real 'svn ci' will use svn rename. Bo
Index: src/frontends/controllers/tex_helpers.C =================================================================== --- src/frontends/controllers/tex_helpers.C (revision 14223) +++ src/frontends/controllers/tex_helpers.C (working copy) @@ -52,11 +52,8 @@ Path p(package().user_support()); Systemcall one; one.startscript(Systemcall::Wait, - "sh " + - quoteName(libFileSearch("scripts", "TeXFiles.sh"))); - // To be changed to - // "python " + - // quoteName(libFileSearch("scripts", "TeXFiles.py"))); + "python " + + quoteName(libFileSearch("scripts", "TeXFiles.py"))); } Index: lib/scripts/TeXFiles.py =================================================================== --- lib/scripts/TeXFiles.py (revision 0) +++ lib/scripts/TeXFiles.py (revision 0) @@ -0,0 +1,129 @@ +#!/usr/bin/env python +# -*- coding: iso-8859-1 -*- + +# file TeXFiles.py +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. + +# \author Herbert Voß +# \author Jean-Marc Lasgouttes +# \author Jürgen Spitzmüller +# \author Bo Peng + +# Full author contact details are available in file CREDITS. + +# all files -> without option +# TeX class files -> option cls +# TeX style files -> option sty +# bibtex style files -> option bst +# bibtex database files -> option bib +# +# with the help +# of kpsewhich and creates a +# bstFiles.lst, clsFiles.lst, styFiles.lst, bibFiles.lst +# without any parameter all files are created. +# +# Herbert Voss <[EMAIL PROTECTED]> +# +# Updates from Jean-Marc Lasgouttes. +# +# bib support added by Juergen Spitzmueller (v0.3) +# +# translated to python by Bo Peng, +# this version only rely on python and kpsewhich (no shell command is used) +# + +import os, sys, re + +CLS_STYLEFILE = 'clsFiles.lst' +STY_STYLEFILE = 'styFiles.lst' +BST_STYLEFILE = 'bstFiles.lst' +BIB_FILES = 'bibFiles.lst' + +version = 'TeXFiles.py 0.4 2006-06-24' +progname = os.path.split(sys.argv[0])[1] +usage = '''Usage: TeXFiles.py [-version | cls | sty | bst | bib ] + Default is without any Parameters, + so that all files will be created''' + +def cmdOutput(cmd): + '''utility function: run a command and get its output as a string + cmd: command to run + ''' + fout = os.popen(cmd) + output = fout.read() + fout.close() + return output + +# processing command line options +if len(sys.argv) > 1: + if sys.argv[1] in ['--help', '-help']: + print usage + sye.exit(0) + elif sys.argv[1] in ['--version', '-version']: + print os.path.split(sys.argv[0])[1], version + print cmdOutput('kpsewhich --version') + sys.exit(0) + else: + types = [sys.argv[1]] + if types[0] not in ['cls', 'sty', 'bst', 'bib']: + print 'ERROR: unknown type', types[0] + sys.exit(1) +else: + # if no parameter is specified, assume all + types = ['cls', 'sty', 'bst', 'bib'] + +# +# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate +# directories in path lists whereas Unix uses `:'. Make an exception for +# Cygwin, where we could have either teTeX (using `:') or MikTeX (using `;'). +# Create a variable that holds the right character to be used by the scripts. +SEP = os.pathsep +if sys.platform == 'cygwin': + # MikTeX's kpsewhich says "kpathsea emulation version x.x.x", whereas + # teTeX's simply "kpathsea version x.x.x". + if 'emulation' in cmdOutput('kpsewhich --version'): + SEP = ';' + else: + SEP = ':' + +# +# FIXME: what is this comment for? +# +# A copy of some stuff from mktex.opt, so we can run in the presence of +# terminally damaged ls-R files. +# + +for type in types: + print "Indexing files of type", type + if type == 'cls': + outfile = CLS_STYLEFILE + kpsetype = '.tex' + elif type == 'sty': + outfile = STY_STYLEFILE + kpsetype = '.tex' + elif type == 'bst': + outfile = BST_STYLEFILE + kpsetype = '.bst' + elif type == 'bib': + outfile = BIB_FILES + kpsetype = '.bib' + + dirs = cmdOutput('kpsewhich --show-path=' + kpsetype).replace('!!', '').strip() + # remove excessive // + dirs = re.sub('//+', '/', dirs) + + file_ext = '.' + type + out = open(outfile, 'w') + for dir in dirs.split(SEP): + # for each valid directory + if os.path.isdir(dir): + # implementation of a simple find command + # walk down the file hierarchy + for root,path,files in os.walk(dir): + # check file type + for file in files: + if len(file) > 4 and file[-4:] == file_ext: + out.write(os.path.join(root, file) + '\n') + out.close() + Property changes on: lib/scripts/TeXFiles.py ___________________________________________________________________ Name: svn:executable + *