From e55be69d9eb01458e3e1a884d3edcb637b7a00f8 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
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 ++++++++++++---
 tex/context/base/cont-new.tex         |  2 +-
 tex/context/base/context.tex          |  2 +-
 tex/context/interface/keys-cz.xml     |  2 +-
 tex/context/interface/keys-de.xml     |  2 +-
 tex/context/interface/keys-en.xml     |  2 +-
 tex/context/interface/keys-fr.xml     |  2 +-
 tex/context/interface/keys-it.xml     |  2 +-
 tex/context/interface/keys-nl.xml     |  2 +-
 tex/context/interface/keys-ro.xml     |  2 +-
 12 files changed, 35 insertions(+), 18 deletions(-)

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)
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 64d27e992..2ea338088 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2006.05.10 23:26}
+\newcontextversion{2006.05.11 10:30}
 
 %D This file is loaded at runtime, thereby providing an
 %D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/context.tex b/tex/context/base/context.tex
index 953c7e5f5..4caf3c21e 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -31,7 +31,7 @@
 %D 2004.8.30 the low level interface is english. Watch out and adapt
 %D your styles an modules.
 
-\def\contextversion{2006.05.10 23:26}
+\def\contextversion{2006.05.11 10:30}
 
 %D For those who want to use this:
 
diff --git a/tex/context/interface/keys-cz.xml b/tex/context/interface/keys-cz.xml
index e191d8162..27f0b8cc5 100644
--- a/tex/context/interface/keys-cz.xml
+++ b/tex/context/interface/keys-cz.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="cz" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="jedna"/>
diff --git a/tex/context/interface/keys-de.xml b/tex/context/interface/keys-de.xml
index 01f4f2e9b..7bc1325cd 100644
--- a/tex/context/interface/keys-de.xml
+++ b/tex/context/interface/keys-de.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="de" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="eins"/>
diff --git a/tex/context/interface/keys-en.xml b/tex/context/interface/keys-en.xml
index 9dc7275e5..489d66e12 100644
--- a/tex/context/interface/keys-en.xml
+++ b/tex/context/interface/keys-en.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="en" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="one"/>
diff --git a/tex/context/interface/keys-fr.xml b/tex/context/interface/keys-fr.xml
index 7bb9d5a1d..59f640722 100644
--- a/tex/context/interface/keys-fr.xml
+++ b/tex/context/interface/keys-fr.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="fr" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="un"/>
diff --git a/tex/context/interface/keys-it.xml b/tex/context/interface/keys-it.xml
index 53302e793..5239212b0 100644
--- a/tex/context/interface/keys-it.xml
+++ b/tex/context/interface/keys-it.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="it" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="uno"/>
diff --git a/tex/context/interface/keys-nl.xml b/tex/context/interface/keys-nl.xml
index 81c09e56c..e0dab0345 100644
--- a/tex/context/interface/keys-nl.xml
+++ b/tex/context/interface/keys-nl.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="nl" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="een"/>
diff --git a/tex/context/interface/keys-ro.xml b/tex/context/interface/keys-ro.xml
index cd9f2eb03..4c7a2e40f 100644
--- a/tex/context/interface/keys-ro.xml
+++ b/tex/context/interface/keys-ro.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 
-<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.05.10 23:26">
+<cd:interface xmlns:cd="http://www.pragma-ade.com/commands" name="context" language="ro" version="2006.05.11 10:30">
 
   <cd:variables>
     <cd:variable name="one" value="unu"/>
-- 
cgit v1.2.3