[EMAIL PROTECTED]:
> > Karl Hammar schreef:
> > > 
> > > Since configure does not test for readlink it is perhaps a bad choise, 
> > > the alternative would be to use a shell or python script or if someone 
> > > comes up with a good way to find the afm files.
> > 
> > we rely on python anyway, so I'm all for a Python based solution.
> > Patch?
...
> 
> Ack, later this week.
...

Attached (diff) is a possible patch:

        * configure.in: readlink -f is system dependent, replaced with 
        python version

1. One could maybe write it as an one-liner:

  $ ls -l /usr/bin/emacs
  lrwxrwxrwx  1 root root 23 Nov 12  2005 /usr/bin/emacs -> 
/etc/alternatives/emacs
  $ ls -l /etc/alternatives/emacs
  lrwxrwxrwx  1 root root 18 Nov 24  2005 /etc/alternatives/emacs -> 
/usr/bin/emacs21-x
  $ python  -c 'import os.path, sys;  print os.path.realpath(sys.argv.pop(1))' 
/usr/bin/emacs
  /usr/bin/emacs21-x
  $

2. It requires python >= 2.2. One could put the python version check 
   elsewhere.

3. the manual doesn't indicate wheter sys.argv is ro or rw --- so
   sys.argv.pop(1) could fail for others, the alternative is to use
   changeqoute's and sys.argv[1] instead, as in diff2

4. one could put the python code in a seperate file, as in diff3, and 
   put readlink.py in python/ or elsewhere

Regards,
/Karl

import os
import sys

for i in sys.argv[1:]:
  print os.path.realpath(i)
Index: configure.in
===================================================================
RCS file: /sources/lilypond/lilypond/configure.in,v
retrieving revision 1.194
diff -u -r1.194 configure.in
--- configure.in        24 May 2006 09:11:18 -0000      1.194
+++ configure.in        5 Jun 2006 21:33:30 -0000
@@ -53,6 +53,8 @@
 # must come before any header checks
 STEPMAKE_COMPILE
 
+# os.path.realpath() requires python 2.2 and unix
+STEPMAKE_PYTHON(REQUIRED, 2.2)
 AC_CHECK_PROG(FCMATCH, fc-match, fc-match)
 AC_MSG_CHECKING([New Century Schoolbook PFB files])
 AC_SUBST(NCSB_SOURCE_FILES)
@@ -71,7 +73,7 @@
       NCSB_FILE=`$FCMATCH --verbose "Century Schoolbook L:style=$style" | grep 
'file:'`
 
       NCSB_FILE=`echo $NCSB_FILE | sed 's/^.*"\(.*\)".*$/\1/g'`
-      NCSB_FILE=`readlink -f $NCSB_FILE`
+      NCSB_FILE=`$PYTHON python/readlink.py $NCSB_FILE`
       NCSB_SOURCE_FILES="$NCSB_FILE $NCSB_SOURCE_FILES"
     done
   else
Index: configure.in
===================================================================
RCS file: /sources/lilypond/lilypond/configure.in,v
retrieving revision 1.194
diff -u -r1.194 configure.in
--- configure.in        24 May 2006 09:11:18 -0000      1.194
+++ configure.in        5 Jun 2006 21:19:05 -0000
@@ -53,6 +53,8 @@
 # must come before any header checks
 STEPMAKE_COMPILE
 
+# os.path.realpath() requires python 2.2 and unix
+STEPMAKE_PYTHON(REQUIRED, 2.2)
 AC_CHECK_PROG(FCMATCH, fc-match, fc-match)
 AC_MSG_CHECKING([New Century Schoolbook PFB files])
 AC_SUBST(NCSB_SOURCE_FILES)
@@ -71,7 +73,13 @@
       NCSB_FILE=`$FCMATCH --verbose "Century Schoolbook L:style=$style" | grep 
'file:'`
 
       NCSB_FILE=`echo $NCSB_FILE | sed 's/^.*"\(.*\)".*$/\1/g'`
-      NCSB_FILE=`readlink -f $NCSB_FILE`
+      # resolv symbolic links
+      changequote(<<<, >>>)#dnl
+      NCSB_FILE=`cat <<EOF | $PYTHON - $NCSB_FILE
+import os.path, sys
+print os.path.realpath(sys.argv[1])
+EOF`
+      changequote([, ])#dnl
       NCSB_SOURCE_FILES="$NCSB_FILE $NCSB_SOURCE_FILES"
     done
   else
Index: configure.in
===================================================================
RCS file: /sources/lilypond/lilypond/configure.in,v
retrieving revision 1.194
diff -u -r1.194 configure.in
--- configure.in        24 May 2006 09:11:18 -0000      1.194
+++ configure.in        5 Jun 2006 20:53:18 -0000
@@ -53,6 +53,8 @@
 # must come before any header checks
 STEPMAKE_COMPILE
 
+# os.path.realpath() requires python 2.2 and unix
+STEPMAKE_PYTHON(REQUIRED, 2.2)
 AC_CHECK_PROG(FCMATCH, fc-match, fc-match)
 AC_MSG_CHECKING([New Century Schoolbook PFB files])
 AC_SUBST(NCSB_SOURCE_FILES)
@@ -71,7 +73,11 @@
       NCSB_FILE=`$FCMATCH --verbose "Century Schoolbook L:style=$style" | grep 
'file:'`
 
       NCSB_FILE=`echo $NCSB_FILE | sed 's/^.*"\(.*\)".*$/\1/g'`
-      NCSB_FILE=`readlink -f $NCSB_FILE`
+      # resolv symbolic links
+      NCSB_FILE=`cat <<EOF | $PYTHON - $NCSB_FILE
+import os.path, sys
+print os.path.realpath(sys.argv.pop(1))
+EOF`
       NCSB_SOURCE_FILES="$NCSB_FILE $NCSB_SOURCE_FILES"
     done
   else
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to