-
Notifications
You must be signed in to change notification settings - Fork 5
/
autoformat.py
executable file
·51 lines (44 loc) · 1.7 KB
/
autoformat.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.6"
# dependencies = [
# "configargparse",
# ]
# ///
#############################################################################
# This file is part of fprettify.
# Copyright (C) 2016-2019 Patrick Seewald, CP2K developers group
#
# fprettify is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# fprettify is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with fprettify. If not, see <http://www.gnu.org/licenses/>.
###############################################################################
# Vendored to ABIN by Daniel Hollas, with minor modifications.
# The source code in fprettify/ was taken from the 'abin' branch of the fork at
# https://github.com/danielhollas/fprettify
"""Wrapper script to run fprettify.
When no arguments are provided, we run on all Fortran files in src/
"""
import sys
from fprettify import run
try:
import configargparse
except ImportError:
print("ERROR: Could not find configargparse package")
print("Please install the package, e.g. 'pip install --user configargparse'")
sys.exit(1)
if len(sys.argv) == 1:
print("Autoformatting files in src/")
sys.argv.append('-r')
sys.argv.append('src/')
if __name__ == '__main__':
run()