texlive[67585] Build/extra/epstopdf: (check_prog_exists): need drive

commits+karl at tug.org commits+karl at tug.org
Sat Jul 8 23:10:53 CEST 2023


Revision: 67585
          http://tug.org/svn/texlive?view=revision&revision=67585
Author:   karl
Date:     2023-07-08 23:10:52 +0200 (Sat, 08 Jul 2023)
Log Message:
-----------
(check_prog_exists): need drive letters for windows, etc.; update doc; release 2.30

Modified Paths:
--------------
    trunk/Build/extra/epstopdf/Makefile
    trunk/Build/extra/epstopdf/epstopdf.1
    trunk/Build/extra/epstopdf/epstopdf.pl

Added Paths:
-----------
    trunk/Build/extra/epstopdf/test-dosepsbin.eps

Modified: trunk/Build/extra/epstopdf/Makefile
===================================================================
--- trunk/Build/extra/epstopdf/Makefile	2023-07-08 19:48:18 UTC (rev 67584)
+++ trunk/Build/extra/epstopdf/Makefile	2023-07-08 21:10:52 UTC (rev 67585)
@@ -17,6 +17,7 @@
        check-atend \
        check-binary check-bin2 \
        check-binhdr-lf check-binhdr-cr check-binhdr-crlf \
+       check-dosepsbin \
        check-filter check-filter-outfile \
        check-gray \
        check-gscmd check-gsopt check-gsopts \
@@ -24,9 +25,9 @@
        check-output \
        check-pdfversion \
        check-percent \
-       check-restricted-nosafer \
        check-restricted-device \
        check-restricted-gscmd \
+       check-restricted-nosafer \
        check-restricted-outfile \
        check-restricted-safe-in check-restricted-safe-out \
        check-simple \
@@ -140,6 +141,11 @@
 check-binhdr-crlf:
 	$(MAKE) file=test-binhdr-crlf check1
 
+# Another DOS EPS binary file.
+# Reported to tex-k from Pat Ridley, 26 Sep 2020 12:38:42.
+check-dosepsbin:
+	$(MAKE) file=test-dosepsbin check1
+
 check-pdfversion:
 	$(e2p) test-simple.eps 
 	pdfinfo test-simple.pdf | grep '^PDF version.*1\.5$$'
@@ -157,7 +163,11 @@
 
 # can't override kpsewhich, so just test gs cmd lookup.
 check-which:
-	! $(e2p) --gscmd=/nonesuch test-simple.eps
+	! $(e2p) --gscmd=/noneslash test-simple.eps
+	! $(e2p) --gscmd=./nonedot test-simple.eps
+	! $(e2p) --gscmd=../nonedotdot test-simple.eps
+	! $(e2p) --gscmd=nonepath test-simple.eps
+	! $(re2p) --gscmd=nonepath test-simple.eps
 
 check-write-error:
 	! $(e2p) test-simple.eps --outfile=/dev/full

Modified: trunk/Build/extra/epstopdf/epstopdf.1
===================================================================
--- trunk/Build/extra/epstopdf/epstopdf.1	2023-07-08 19:48:18 UTC (rev 67584)
+++ trunk/Build/extra/epstopdf/epstopdf.1	2023-07-08 21:10:52 UTC (rev 67585)
@@ -1,4 +1,4 @@
-.TH EPSTOPDF 1 "6 March 2023"
+.TH EPSTOPDF 1 "8 July 2023"
 .\" $Id$
 .SH NAME
 epstopdf, repstopdf \- convert an EPS file to PDF
@@ -118,6 +118,10 @@
 In restricted mode, options are limited to those with names and values
 known to be safe.  Some options taking booleans, integers or fixed
 names are allowed, those taking general strings are not.
+.PP
+In order to give a comprehensible error message, epstopdf checks whether
+kpsewhich and (the specified) gs are found in the current PATH, or
+executable if they are specified as absolute names.
 
 .SH EXAMPLES
 These examples all equivalently convert `test.eps' to `test.pdf':
@@ -153,7 +157,7 @@
 \fBpdfcrop\fP(1).
 .PP
 The epstopdf LaTeX package, which automates running this script on the
-fly under TeX: https://ctan.org/pkg/epstopdf-pkg.
+fly under LaTeX: https://ctan.org/pkg/epstopdf-pkg.
 .SH AUTHOR
 Originally written by Sebastian Rahtz, for Elsevier Science, with
 subsequent contributions from Thomas Esser, Gerben Wierda, Heiko
@@ -161,9 +165,11 @@
 .PP
 Man page originally written by Jim Van Zandt.
 .PP
+epstopdf package page on CTAN: https://ctan.org/pkg/epstopdf.
+.PP
 epstopdf home page: https://tug.org/epstopdf.
 .PP
 You may freely use, modify and/or distribute this man page.
-The epstopdf script is released under a modified BSD license.
+The epstopdf script is released under the modified BSD license.
 .PP
 $Id$

Modified: trunk/Build/extra/epstopdf/epstopdf.pl
===================================================================
--- trunk/Build/extra/epstopdf/epstopdf.pl	2023-07-08 19:48:18 UTC (rev 67584)
+++ trunk/Build/extra/epstopdf/epstopdf.pl	2023-07-08 21:10:52 UTC (rev 67585)
@@ -36,7 +36,7 @@
 # emacs-page
 #
 my $ver = "2.32";
-#  2023/07/qqq 2.32 (Karl Berry)
+#  2023/07/08 2.32 (Karl Berry)
 #    * check that kpsewhich and gs are in PATH.
 #    * correct TL path for kpsewhich to bin/windows.
 #  2023/03/06 v2.31 (Karl Berry)
@@ -512,21 +512,36 @@
 }
 debug "kpsewhich command: $kpsewhich";
 
-### check that PROG is in PATH and executable, abort if not.
-# it'd be better to actually try running the program, but then we'd have
-# to either replicate Perl's logic for finding the command interpreter
+### check that PROG is in PATH and executable, abort if not. It'd be
+# better to actually try running the program, but then we'd have to
+# either replicate Perl's logic for finding the command interpreter
 # (trivial on Unix, complicated on Windows), or do a fork/exec and close
-# the file descriptors ourselves, which seems too painful. Instead we'll
-# just look along PATH for the program, which is good enough in
-# practice for us, since the only goal here is to give a better error
-# message if the program isn't available.
+# the file descriptors ourselves, which seems too painful. Nor do we
+# want to load/assume File::Which. Instead we'll look along PATH
+# ourselves, which is good enough in practice for us, since the only
+# goal here is to give a better error message if the program isn't
+# available.
 sub check_prog_exists {
   my ($prog) = @_;
+  my @w_ext = ("exe", "com", "bat");
   debug " Checking if $prog is in PATH";
-  if ($prog =~ m,^(/|\./|\.\./),) {
+
+  # absolute unix
+  if (! $on_windows_or_cygwin && $prog =~ m,^((\.(\.)?)?/),) {
     return 1 if -x $prog; # absolute or explicitly relative
     error "Required program $prog not found, given explicit directory";
+
+  # absolute windows: optional drive letter, then . or .., then \ or /.
+  } elsif ($on_windows_or_cygwin
+           && $prog =~ m,^(([a-zA-Z]:)?(\.(\.)?)?[/\\]),) {
+    return 1 if -x $prog;
+    for my $ext (@w_ext) {
+      return 1 if (-x "$prog.$ext");
+    }
+    error "Required program $prog not found, given explicit Windows directory";
   }
+
+  # not absolute, check path
   for my $dir (split ($on_windows_or_cygwin ? ";" : ":", $ENV{"PATH"})) {
     $dir = "." if $dir eq ""; # empty path element
     debug " Checking dir $dir";
@@ -533,13 +548,12 @@
     if (-x "$dir/$prog") {
       return 1;
     } elsif ($on_windows_or_cygwin) {
-      for my $ext ("exe", "com", "bat") {
-        if (-x "$dir/$prog.$ext") {
-          return 1;
-        }
+      for my $ext (@w_ext) {
+        return 1 if (-x "$dir/$prog.$ext");
       }
     }
   }
+
   # if made it through the whole loop, not found, so quit.
   error "Required program $prog not found in PATH ($ENV{PATH})";
 }

Added: trunk/Build/extra/epstopdf/test-dosepsbin.eps
===================================================================
(Binary files differ)

Index: trunk/Build/extra/epstopdf/test-dosepsbin.eps
===================================================================
--- trunk/Build/extra/epstopdf/test-dosepsbin.eps	2023-07-08 19:48:18 UTC (rev 67584)
+++ trunk/Build/extra/epstopdf/test-dosepsbin.eps	2023-07-08 21:10:52 UTC (rev 67585)

Property changes on: trunk/Build/extra/epstopdf/test-dosepsbin.eps
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/x-eps
\ No newline at end of property


More information about the tex-live-commits mailing list.