From 36e0a60868a91490c3a5ab331cf1ce5fd93c8039 Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Sat, 25 Dec 2010 21:28:43 +0000 Subject: Unix wrapper scripts eliminated git-svn-id: svn://tug.org/texlive/trunk@20860 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/epspdf/epspdf | 3 --- Master/texmf-dist/scripts/epspdf/epspdf.help | 23 +++++++++++++---------- Master/texmf-dist/scripts/epspdf/epspdf.rb | 17 +++++++++++++++-- Master/texmf-dist/scripts/epspdf/epspdfrc.rb | 7 ++----- Master/texmf-dist/scripts/epspdf/epspdftk | 7 ------- Master/texmf-dist/scripts/epspdf/epspdftk.tcl | 25 +++++++++++++++++++------ 6 files changed, 49 insertions(+), 33 deletions(-) delete mode 100755 Master/texmf-dist/scripts/epspdf/epspdf delete mode 100755 Master/texmf-dist/scripts/epspdf/epspdftk (limited to 'Master/texmf-dist/scripts/epspdf') diff --git a/Master/texmf-dist/scripts/epspdf/epspdf b/Master/texmf-dist/scripts/epspdf/epspdf deleted file mode 100755 index f973474b312..00000000000 --- a/Master/texmf-dist/scripts/epspdf/epspdf +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -script=`kpsewhich -format=texmfscripts epspdf.rb` -"$script" "$@" diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.help b/Master/texmf-dist/scripts/epspdf/epspdf.help index 23c7efe5381..dbd1cd3b93f 100644 --- a/Master/texmf-dist/scripts/epspdf/epspdf.help +++ b/Master/texmf-dist/scripts/epspdf/epspdf.help @@ -1,7 +1,7 @@ Epspdf and epsdftk ****************** -This manual is for epspdf, version 0.5.1. +This manual is for epspdf, version 0.5.2. Copyright (C) 2006, 2008, 2009, 2010 Siep Kroonenberg. @@ -131,16 +131,19 @@ conversions come out slightly clipped. It has two effects: epspdf.rb is the backend of epspdftk, but it can also be used standalone. It shares configuration settings with epspdftk.tcl. -It is strongly recommended to invoke epspdf.rb via a wrapper script -epspdf or epspdf.bat on the search path, e.g. - #!/bin/sh - PATH_TO_EPSPDF/epspdf.rb "$@" -for Unix/Linux/OS X, or +Under Windows, is strongly recommended to invoke epspdf.rb via a +wrapper script epspdf.bat on the search path, e.g. "PATH_TO_RUBY.EXE" "PATH_TO_EPSPDF.RB" %* -for Windows. It is the responsibility of the caller to provide double -quotes. -The TeX Live package for epspdf already includes a wrapper. +The TeX Live package for epspdf already includes wrappers for Windows, +both for epspdf and for epspdftk. + +The first parameter of epspdftk is interpreted as startup directory for +the file browser. + +From version 0.5.2 on, there is no longer need for a wrapper script +under Unix/Linux/Mac OS X; a symlink on the searchpath to the actual +script suffices. Basic usage: @@ -151,7 +154,7 @@ Basic usage: Typing `epspdf --help' gives you the following summary: $ epspdf --help - Epspdf version 0.5.1 + Epspdf version 0.5.2 Copyright (C) 2006, 2008, 2009, 2010 Siep Kroonenberg Convert between [e]ps and pdf formats Usage: epspdf.rb [options] infile [outfile] diff --git a/Master/texmf-dist/scripts/epspdf/epspdf.rb b/Master/texmf-dist/scripts/epspdf/epspdf.rb index d10e55fb5e0..94da56c4c99 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdf.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdf.rb @@ -30,7 +30,19 @@ # some initialization # add directory of this source to loadpath -$:.unshift( File.dirname( __FILE__ ) ) +# WARNING +# readlink apparently only works right from the directory of the symlink + +$SCRIPTDIR = File.dirname( File.expand_path( __FILE__ )) +if RUBY_PLATFORM !~ /win32|mingw/ and File.symlink?( __FILE__ ) + savedir = Dir.pwd + Dir.chdir( $SCRIPTDIR ) + # puts File.readlink( __FILE__ ) + $SCRIPTDIR = File.dirname( File.expand_path( File.readlink( __FILE__ ))) + Dir.chdir( savedir ) +end +$:.unshift( $SCRIPTDIR ) +# puts $: # turn on warnings #$VERBOSE = 1 @@ -59,12 +71,13 @@ class EPSystemError < StandardError; end # PostScript header file for grayscaling -$GRAYHEAD = File.join( File.dirname( __FILE__ ), "makegray.pro" ) +$GRAYHEAD = File.join( $SCRIPTDIR, "makegray.pro" ) ########################################### # handle auto-detected and saved settings +#require 'epspdfrc' require 'epspdfrc' ########################################### diff --git a/Master/texmf-dist/scripts/epspdf/epspdfrc.rb b/Master/texmf-dist/scripts/epspdf/epspdfrc.rb index 6ee8ba6fccb..66ecdb8c1d6 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdfrc.rb +++ b/Master/texmf-dist/scripts/epspdf/epspdfrc.rb @@ -1,4 +1,4 @@ -EPVERSION = '0.5.1' +EPVERSION = '0.5.2' COPYRIGHT = '2006, 2008, 2009, 2010' # epspdf conversion utility, configuration module @@ -25,12 +25,9 @@ COPYRIGHT = '2006, 2008, 2009, 2010' # a stand-alone program, and # 2. a configuration screen in epspdftk.rb. -require 'rbconfig' -include Config - # for notational convenience, we keep ARCH separate -ARCH = case CONFIG['arch'] +ARCH = case RUBY_PLATFORM when /win32|mingw/ 'w32' when /darwin/ diff --git a/Master/texmf-dist/scripts/epspdf/epspdftk b/Master/texmf-dist/scripts/epspdf/epspdftk deleted file mode 100755 index e1e1fb36064..00000000000 --- a/Master/texmf-dist/scripts/epspdf/epspdftk +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -script=`kpsewhich -format=texmfscripts epspdftk.tcl` -if test "x$1" = "x"; then - "$script" $HOME -else - "$script" "$@" -fi \ No newline at end of file diff --git a/Master/texmf-dist/scripts/epspdf/epspdftk.tcl b/Master/texmf-dist/scripts/epspdf/epspdftk.tcl index ac96d844be7..ff29eff893d 100755 --- a/Master/texmf-dist/scripts/epspdf/epspdftk.tcl +++ b/Master/texmf-dist/scripts/epspdf/epspdftk.tcl @@ -25,10 +25,12 @@ set classic_unix [expr {$::tcl_platform(platform) eq "unix" && \ # Get full path of epspdf.rb. It should be in the same directory as # either this script or of the starpack containing this script. +# For non-windows versions, epspdftk might be called via a symlink. # For the windows-only starpack, a ruby subset is included. # Otherwise, ruby should be on the searchpath. proc set_progs {} { + set scriptfile [file normalize [info script]] # starpack edition? set starred 0 if {$::tcl_platform(platform) eq "windows"} { @@ -39,13 +41,24 @@ proc set_progs {} { } } } + set syml 0 + if {$::tcl_platform(platform) eq "unix" && \ + ! [catch {file readlink [$scriptfile]}]} { + set syml 1 + } if {$starred} { - set eproot [file normalize \ - [regsub {([\\/])([^\\/]+)$} [info nameofexecutable] {}]] + set eproot [file dirname [file normalize [info nameofexecutable]]] set ::ruby [file normalize "$eproot/../rubysub/bin/ruby.exe"] } else { - set eproot [file normalize \ - [regsub {([\\/])([^\\/]+)$} [info script] {}]] + set eproot [file dirname $scriptfile] + if {$::tcl_platform(platform) eq "unix" && \ + ! [catch {file readlink $scriptfile}]} { + # evaluate readlink from symlink directory + set savedir [pwd] + cd $eproot + set eproot [file dirname [file normalize [file readlink $scriptfile]]] + cd $savedir + } set ::ruby "ruby" } set ::epspdf_rb [file join $eproot "epspdf.rb"] @@ -661,7 +674,7 @@ proc page_valid {w} { # end conversion options -pack [label .status] -side bottom -anchor w -fill x +pack [label .status -justify left] -side bottom -anchor w -fill x -expand 1 # main buttons @@ -758,7 +771,7 @@ proc saveDialog {} { lappend cmd $::gfile(path) lappend cmd $try # $cmd/run_epspdf never bombs, but returns 1 (success) or 0 (fail) - .status configure -text "Working..." + .status configure -text "Working..." -justify "left" foreach b {view open convert done} { .bottomf.$b configure -state disabled } -- cgit v1.2.3