lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripts/build/scan-mf-deps: script to generate MF dependencies (issu


From: jonas . hahnfeld
Subject: Re: scripts/build/scan-mf-deps: script to generate MF dependencies (issue 553700043 by address@hidden)
Date: Tue, 17 Mar 2020 02:22:23 -0700

On 2020/03/17 07:41:26, hahnjo wrote:
>
https://codereview.appspot.com/553700043/diff/567370043/mf/scan-mf-deps.py#newcode10
> mf/scan-mf-deps.py:10: re.sub("\\(%s/?([^\n )]*\\.mf)" % srcdir,
lambda m:
> deps.append(m.group(1)), input)
> Now that should be very possible with sed in .sh plus you already have
all the
> information available and don't need to parse it from sys.argv

Admittedly two sed's:
diff --git a/mf/invoke-mf2pt.sh b/mf/invoke-mf2pt.sh
index ea2afe771f..aa5740240a 100755
--- a/mf/invoke-mf2pt.sh
+++ b/mf/invoke-mf2pt.sh
@@ -8,7 +8,8 @@ realpath() {
 set -eu
 mf2pt1=$(realpath $1)
 src=$(realpath $2)
-target=$(realpath $3)
+target=$3
+target_path=$(realpath $target)
 srcdir=$(dirname ${src})
 name=$(basename ${src} .mf)
 
@@ -16,7 +17,7 @@ name=$(basename ${src} .mf)
 #
 # the soft link for mf2pt1.mp is for recent mpost versions
 # which no longer dump a .mem file
-tmp=$(dirname $target)/tmp.$(basename $target)
+tmp=$(dirname $target_path)/tmp.$(basename $target)
 rm -rf $tmp
 mkdir $tmp
 cd $tmp
@@ -31,7 +32,10 @@ ${mf2pt1} --rounding=0.0001 \
          --fullname=$name \
          --name=$name $src
 
-python ${srcdir}/scan-mf-deps.py ${srcdir} ${target} ${name}.log >
${name}.dep
+# First put every possible inclusion starting with ( into a separate
line. Then
+# print only the included .mf files (sed -n) and munge the rest of that
line.
+dependencies=$(cat ${name}.log | sed "s|(|\n(|g" | sed -n
"s|(\\$srcdir/*\([^ )]*\.mf\).*| \1 \\\\|pg")
+echo "$target:$dependencies" > ${name}.dep
 
 mv *.pfb *.tfm *.log *.dep ..
 cd ..

https://codereview.appspot.com/553700043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]