From e55be69d9eb01458e3e1a884d3edcb637b7a00f8 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 11 May 2006 10:30:00 +0200 Subject: stable 2006.05.11 10:30 --- scripts/context/ruby/base/kpse.rb | 12 ++++++++---- scripts/context/ruby/base/kpsefast.rb | 8 ++++++-- scripts/context/ruby/texmfstart.rb | 15 ++++++++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/context/ruby/base/kpse.rb b/scripts/context/ruby/base/kpse.rb index 8eb261724..a61b2f236 100644 --- a/scripts/context/ruby/base/kpse.rb +++ b/scripts/context/ruby/base/kpse.rb @@ -58,12 +58,14 @@ module Kpse @@distribution = 'miktex' unless $1 =~ /(texmf\-mswin[\/\\]bin|bin[\/\\]win32)/i end - if ENV['KPSEFAST'] == 'no' then - @@usekpserunner = false - else + @@re_true = /yes|on|true|1/i + + if (ENV['KPSEFAST'] =~ @@re_true) || (ENV['CTXMINIMAL'] =~ @@re_true) then @@usekpserunner = true require 'base/kpsefast' require 'base/kpserunner' + else + @@usekpserunner = false end if @@crossover then @@ -215,6 +217,7 @@ module Kpse end # locate writable path if ! formatpath.empty? then + done = false formatpath.split_path.each do |fp| fp.gsub!(/\\/,'/') # remove funny patterns @@ -226,11 +229,12 @@ module Kpse fpp = fp.sub(/#{engine}\/*$/,'') if FileTest.directory?(fpp) && FileTest.writable?(fpp) then # use this path - formatpath = fp.dup + formatpath, done = fp.dup, true break end end end + formatpath = '.' unless done end # needed ! begin File.makedirs(formatpath) ; rescue ; end ; diff --git a/scripts/context/ruby/base/kpsefast.rb b/scripts/context/ruby/base/kpsefast.rb index 724c90921..01210ed12 100644 --- a/scripts/context/ruby/base/kpsefast.rb +++ b/scripts/context/ruby/base/kpsefast.rb @@ -59,7 +59,8 @@ end module KpseUtil - @@texmfcnf = 'texmf.cnf' + @@texmftrees = ['texmf-local','texmf.local','texmf.gwtex','texmf.tetex','texmf'] + @@texmfcnf = 'texmf.cnf' def KpseUtil::identify ownpath = File.expand_path($0) @@ -76,7 +77,7 @@ module KpseUtil elsif ENV['SELFAUTOPARENT'] == '.' then filenames << File.join('.',@@texmfcnf) else - ['texmf-local','texmf'].each do |tree| + @@texmftrees.each do |tree| filenames << File.join(ENV['SELFAUTOPARENT'],tree,'web2c',@@texmfcnf) end end @@ -90,6 +91,9 @@ module KpseUtil end break unless busy end + filenames.delete_if do |f| + ! FileTest.file?(f) + end return filenames end diff --git a/scripts/context/ruby/texmfstart.rb b/scripts/context/ruby/texmfstart.rb index 569da636c..490bd609c 100644 --- a/scripts/context/ruby/texmfstart.rb +++ b/scripts/context/ruby/texmfstart.rb @@ -37,10 +37,16 @@ $ownpath = File.expand_path(File.dirname($0)) unless defined? $ownpath # ../../texmf-local/scripts/context/ruby # ../../texmf/scripts/context/ruby +# we may assume a symlink on unix systems, so there the library is +# at the right spot + $: << $ownpath $: << File.expand_path("#{$ownpath}/../lib") $: << File.expand_path("#{$ownpath}/texmfstart-lib") $: << File.expand_path("#{$ownpath}/../../texmf-local/scripts/context/ruby") +# $: << File.expand_path("#{$ownpath}/../../texmf.local/scripts/context/ruby") +# $: << File.expand_path("#{$ownpath}/../../texmf.gwtex/scripts/context/ruby") +# $: << File.expand_path("#{$ownpath}/../../texmf.tetex/scripts/context/ruby") $: << File.expand_path("#{$ownpath}/../../texmf/scripts/context/ruby") require "rbconfig" @@ -182,18 +188,19 @@ def check_kpse if KpseRemote::available? then $kpse = KpseRemote.new if $kpse.okay? then - puts("using remote kpse") if $verbose + puts("kpse : remote") if $verbose else $kpse = KpseDirect.new - puts("forcing direct kpse") if $verbose + puts("kpse : direct (forced)") if $verbose end else $kpse = KpseDirect.new - puts("using direct kpse") if $verbose + puts("kpse : direct") if $verbose end rescue if $verbose then puts("using kpse binary") + puts("") puts($kpsereport) unless $kpsereport.empty? end end @@ -522,6 +529,8 @@ def usage print("\n") print(" texmfstart --stubpath=/usr/local/bin [--make --remove] --verbose all\n") print(" texmfstart --stubpath=auto [--make --remove] all\n") + print("\n") + check_kpse end # somehow registration does not work out (at least not under windows) -- cgit v1.2.3