diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-04-12 01:01:02 +0100 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-04-12 01:01:02 +0100 |
commit | c7ff75a5f0633d21860a91060a6c3a4fb64660b2 (patch) | |
tree | 8438edd38291966954b56775743ff99edbd6ee1e /configure | |
parent | 4826db6fe54db2864d1a4f548ed8906590184456 (diff) |
Configure script dealing properly with empty software directories
Until now, we hadn't actually tested the case where a whole software
directory (Python modules in particular) is empty. So the configure script
finished with some errors in this case.
With this commit, this step of the configure script was modified to deal
with such cases cleanly.
Also, in `initialize.mk', I added a `-f' to the symbolic link command, so
it doesn't complain if the file link already exists.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 54 |
1 files changed, 34 insertions, 20 deletions
@@ -654,7 +654,7 @@ itidir=$verdir/tex if ! [ -d $itidir ]; then mkdir $itidir; fi texdir=$bdir/tex -if ! [ -d $texdir ]; then mkdir $texdir; fi +if ! [ -d $texdir ]; then mkdir $texdir; ln -s $texdir tex/pipeline; fi mtexdir=$texdir/macros if ! [ -d $mtexdir ]; then mkdir $mtexdir; fi @@ -1019,25 +1019,40 @@ fi -# Put all the names and versions in a human-readable format in LaTeX. +# Put all the names and versions in a human-readable paragraph. function prepare_name_version() { - # Total number of tools to report. - num=$(.local/bin/cat "$@" | .local/bin/wc -l) - - # Put them all in one paragraph. - .local/bin/cat "$@" \ - | .local/bin/sort \ - | .local/bin/awk 'NF>0 { \ - c++; \ - if(c==1) \ - { \ - if('$num'==1) printf("%s", $0); \ - else printf("%s", $0); \ - } \ - else if(c=='$num') printf(" and %s\n", $0); \ - else printf(", %s", $0) \ - }' + # First see if the (possible) `*' in the input arguments corresponds to + # anything. Note that some of the given directories may be empty (no + # software installed). + hasfiles=0 + for f in $@; do + if [ -f $f ]; then hasfiles=1; break; fi; + done + + # If there are any files, merge all the names in a paragraph. + if [ $hasfiles = 1 ]; then + + # Count how many names there are. This is necessary to identify the + # last element. + num=$(.local/bin/cat $@ \ + | .local/bin/sed '/^\s*$/d' \ + | .local/bin/wc -l) + + # Put them all in one paragraph. + .local/bin/cat $@ \ + | .local/bin/sort \ + | .local/bin/awk 'NF>0 { \ + c++; \ + if(c==1) \ + { \ + if('$num'==1) printf("%s", $0); \ + else printf("%s", $0); \ + } \ + else if(c=='$num') printf(" and %s\n", $0); \ + else printf(", %s", $0) \ + }' + fi } # Report the different software in separate contexts (separating Python and @@ -1050,8 +1065,7 @@ texpkg=$(prepare_name_version $verdir/tex/texlive) pkgver=$mtexdir/dependencies.tex .local/bin/echo "This research was done with the following free" > $pkgver .local/bin/echo "software programs and libraries: $proglibs." >> $pkgver -npython=$(.local/bin/ls $verdir/python/* | .local/bin/wc -l) -if [ $npython != 0 ]; then +if [ x$pymodules != x ]; then .local/bin/echo "Within Python, the following modules" >> $pkgver echo "were used: $pymodules." >> $pkgver fi |