Skip to content

Commit 268dd64

Browse files
authored
Merge pull request #403 from sourceryinstitute/issue-402-no-more-tree-cmd
Fixes #402 no more tree cmd
2 parents 232d234 + a084623 commit 268dd64

File tree

9 files changed

+74
-106
lines changed

9 files changed

+74
-106
lines changed

developer-scripts/style.pl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env perl
2+
3+
use strict;
4+
use warnings;
5+
6+
die "usage: $0 <file>\n" if (not @ARGV);
7+
8+
my $rc = 0;
9+
my $file = shift;
10+
11+
open(my $fh, '<', $file) or die "Cannot open \`$file' for read: $!\n";
12+
while (<$fh>) {
13+
next if (/^\s*#/);
14+
15+
my $errors = 0;
16+
17+
# remove everything between single quotes
18+
# this will remove too much in case of: echo "var='$var'"
19+
# and thus miss an opportunity to complain later on
20+
# also it mangles the input line irreversible
21+
s/'[^']+'/'___'/g;
22+
23+
# highlight unbraced variables--
24+
# unless properly backslash'ed
25+
$errors += s/((?:^|[^\\]))(((\\\\)+)?\$\w)/$1\033[31m$2\033[0m/g;
26+
27+
# highlight single square brackets
28+
$errors += s/((?:^|\s+))\[([^\[].+[^\]])\](\s*(;|&&|\|\|))/$1\033[31m\[\033[0m$2\033[31m\]\033[0m$3/g;
29+
30+
# highlight double equal sign
31+
# $errors += s/(\[\[.*)(==)(.*\]\])/$1\033[31m$2\033[0m$3/g;
32+
33+
# highlight tabs mixed with whitespace at beginning of lines
34+
$errors += s/^( *)(\t+ *)/\033[31m\[$2\]\033[0m/;
35+
36+
# highlight trailing whitespace
37+
$errors += s/([ \t]+)$/\033[31m\[$1\]\033[0m/;
38+
39+
next if (not $errors);
40+
print "${file}[$.]: $_";
41+
$rc = 1;
42+
}
43+
close($fh);
44+
45+
exit $rc;

doc/dependency_tree/gitkeep.sh

Lines changed: 0 additions & 73 deletions
This file was deleted.

doc/dependency_tree/opencoarrays-tree.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

doc/dependency_tree/opencoarrays/cmake-3.4.0/.gitkeep

Whitespace-only changes.

doc/dependency_tree/opencoarrays/mpich-3.2/gcc-6.1.0/flex-2.6.0/bison-3.0.4/m4-1.4.17/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/dependency_tree/opencoarrays/mpich-3.2/gcc-6.1.0/gmp/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/dependency_tree/opencoarrays/mpich-3.2/gcc-6.1.0/mpc/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

doc/dependency_tree/opencoarrays/mpich-3.2/gcc-6.1.0/mpfr/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
# shellcheck shell=bash disable=SC2154,SC2148
2-
print_header()
3-
{
2+
print_header() {
3+
pushd "${__dir}" >/dev/null
4+
local gccver mpichver cmakever flexver bisonver m4ver
5+
gccver="$("${__file}" -V gcc)"
6+
mpichver="$("${__file}" -V mpich)"
7+
cmakever="$("${__file}" -V cmake)"
8+
flexver="$("${__file}" -V flex)"
9+
bisonver="$("${__file}" -V bison)"
10+
m4ver="$("${__file}" -V m4)"
11+
popd >/dev/null
412
clear
513
echo ""
6-
echo "*** By default, building OpenCoarrays requires CMake 3.4.0 or later, ***"
7-
echo "*** MPICH 3.2, and GCC Fortran (gfortran) 6.1.0 or later. To see ***"
14+
echo "*** By default, building OpenCoarrays requires CMake ${cmakever} or later, ***"
15+
echo "*** MPICH ${mpichver}, and GCC Fortran (gfortran) ${gccver} or later. To see ***"
816
echo "*** options for forcing the use of older or alternative packages, execute ***"
917
echo "*** this script with the -h flag. This script will recursively traverse ***"
1018
echo "*** the following dependency tree, asking permission to download, build, ***"
1119
echo "*** and install any packages that are required for building another ***"
1220
echo "*** package and are neither in your PATH nor in ***"
1321
echo "*** opencoarrays/prerequisites/installations: ***"
1422
echo ""
15-
# Move to a directory tree whose structure mirrors the dependency tree
16-
pushd "$opencoarrays_src_dir/doc/dependency_tree/" > /dev/null
17-
if type tree &> /dev/null; then
18-
# dynamically compute and print the tree, suppressing the final line
19-
tree opencoarrays | sed '$d'
20-
else
21-
# print the most recently saved output of the above 'tree' command
22-
sed '$d' < opencoarrays-tree.txt
23-
fi
24-
popd > /dev/null
23+
# Generate the following text using the `tree` command w/ dummy directory structure
24+
cat <<-EOF
25+
opencoarrays
26+
├── cmake-${cmakever}
27+
└── mpich-${mpichver}
28+
└── gcc-${gccver}
29+
├── flex-${flexver}
30+
│ └── bison-${bisonver}
31+
│ └── m4-${m4ver}
32+
├── gmp
33+
├── mpc
34+
└── mpfr
35+
36+
EOF
2537
echo ""
2638
printf "%s will be installed in %s\n" "${arg_p}" "${install_path}"
2739
echo ""
@@ -30,9 +42,9 @@ print_header()
3042
else
3143
printf "Ready to rock and roll? (Y/n)"
3244
read -r install_now
33-
echo -e " $install_now\n"
34-
if [[ "$install_now" == "n" || "$install_now" == "no" ]]; then
35-
emergency "$this_script: Aborting. [exit 85]\n"
45+
printf '%s\n' "${install_now}"
46+
if [[ "${install_now}" == "n" || "${install_now}" == "no" ]]; then
47+
emergency "${this_script}: Aborting. [exit 85]"
3648
fi
3749
fi
3850
}

0 commit comments

Comments
 (0)