Skip to content

Commit

Permalink
found out what was wrong with diff
Browse files Browse the repository at this point in the history
  • Loading branch information
sbryngelson committed Jan 5, 2024
1 parent e2b57cb commit 642dcb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions toolchain/bootstrap/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,15 @@ if [ "$1" == "diff" ]; then

# Indent acc directives
out_indent=""
fn=""
# for filename in src/simulation/m_bubbles.fpp; do
for filename in src/*/*.f*; do
out_indent+=$(python3 toolchain/indenter.py "$filename" "diff")
done
echo out_indent
echo ${out_indent}
exit 0


# Check prettify out
out_prettify=$(fprettify ${@:-src} --exclude "src/*/autogen" $opts -s -d)
if [ -z "${out_prettify}" ] && [ -z "${out_indent}" ]; then
# if [ -z "${out_indent}" ]; then
echo "Already pretty!"
exit 0
else
Expand Down
6 changes: 4 additions & 2 deletions toolchain/indenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ def main():

adjust_indentation(infile, outfile)
if num_args == 2:
print('replacing',infile,'with',outfile)
os.replace(outfile,infile)
if num_args == 3:
same = filecmp.cmp(outfile,infile)
if not same:
print(infile)
cmd = 'diff ' + outfile + ' ' + infile
so = os.popen(cmd).read()
print(so)
print('different!')
# os.remove(outfile)
os.remove(outfile)

def adjust_indentation(input_file, output_file):
startingchar='!$acc'
Expand Down

0 comments on commit 642dcb8

Please sign in to comment.