Skip to content

Commit

Permalink
Merge pull request #1279 from MODFLOW-USGS/v6.4.2
Browse files Browse the repository at this point in the history
Release 6.4.2
  • Loading branch information
wpbonelli committed Jun 28, 2023
2 parents 9595b25 + 8d91f82 commit 43f6198
Show file tree
Hide file tree
Showing 599 changed files with 38,251 additions and 27,504 deletions.
19 changes: 5 additions & 14 deletions .build_rtd_docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from subprocess import Popen, PIPE

sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
sys.path.insert(0, os.path.abspath(os.path.join("..", "distribution")))

# -- determine if running on readthedocs ------------------------------------
on_rtd = os.environ.get("READTHEDOCS") == "True"
Expand All @@ -35,18 +36,8 @@

# -- Update the modflow 6 version -------------------------------------------
print("Update the modflow6 version")
pth = os.path.join("..", "distribution")
args = (
"python",
"update_version.py",
)
# run the command
proc = Popen(args, stdout=PIPE, stderr=PIPE, cwd=pth)
stdout, stderr = proc.communicate()
if stdout:
print(stdout.decode("utf-8"))
if stderr:
print("Errors:\n{}".format(stderr.decode("utf-8")))
from update_version import update_version
update_version()

# -- import version from doc/version.py -------------------------------------
from version import __version__
Expand All @@ -68,7 +59,7 @@
# -- build the mf6io markdown files -----------------------------------------
print("Build the mf6io markdown files")
pth = os.path.join("..", "doc", "mf6io", "mf6ivar")
args = ("python", "mf6ivar.py")
args = (sys.executable, "mf6ivar.py")
# run the command
proc = Popen(args, stdout=PIPE, stderr=PIPE, cwd=pth)
stdout, stderr = proc.communicate()
Expand All @@ -92,7 +83,7 @@
# -- Project information -----------------------------------------------------

project = "MODFLOW 6 Program Documentation"
copyright = "2020, MODFLOW Development Team"
copyright = "2023, MODFLOW Development Team"
author = "MODFLOW Development Team"

# -- Project version ---------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions .build_rtd_docs/requirements.rtd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ nbsphinx_link
ipython
ipykernel
rtds_action
myst_parser
myst-parser
sphinx_rtd_theme




pytest
filelock
modflow-devtools
4 changes: 2 additions & 2 deletions .doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# -- Project information -----------------------------------------------------

project = "MODFLOW 6 Program Documentation"
copyright = "2020, MODFLOW Development Team"
copyright = "2023, MODFLOW Development Team"
author = "MODFLOW Development Team"

# -- General configuration ---------------------------------------------------
Expand All @@ -70,7 +70,7 @@
"sphinx.ext.viewcode",
"IPython.sphinxext.ipython_console_highlighting", # lowercase didn't work
"sphinx.ext.autosectionlabel",
"recommonmark",
"myst_parser",
"sphinx_markdown_tables",
]

Expand Down
2 changes: 1 addition & 1 deletion .doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ipython
ipykernel
rtds_action
sphinx_rtd_theme
recommonmark
myst-parser
47 changes: 0 additions & 47 deletions .github/common/fortran-format-check.sh

This file was deleted.

125 changes: 125 additions & 0 deletions .github/common/fortran_format_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import os
import sys
import argparse
import glob
from pathlib import Path
from subprocess import run

# MODFLOW 6 repository directories to check (relative to root)
searchpaths = ["src", "srcbmi", "utils/zonebudget/src"]

# Exclude these directories from checks
excludedirs = [
"src/Utilities/Libraries/blas", # external library blas
"src/Utilities/Libraries/daglib", # external library dag
"src/Utilities/Libraries/rcm", # external library rcm
"src/Utilities/Libraries/sparsekit", # external library sparsekit
"src/Utilities/Libraries/sparskit2", # external library sparsekit2
]

# Exclude these files from checks
excludefiles = ["src/Utilities/InputOutput.f90"] # excluded until refactored

class FortranFormatCheck:
"""
Verify MODFLOW 6 fortran source code format
"""

def __init__(self, root: Path, verbose: bool):
self._checkcount = 0
self._fprettifyfails = []
self._exclude_dirs = []
self._exclude_files = []
self._root = root.resolve()
self._verbose = verbose
self._entrypath = Path().cwd()

os.chdir(self._root)

def add_search_path(self, path: Path) -> None:
p = Path(path)

for f in p.glob("**/*.[fF]9[05]"):
self._check_src_fprettify(f)

def add_exclude_dirs(self, excl_dirs: list) -> None:
self._exclude_dirs += excl_dirs

def add_exclude_files(self, excl_files: list) -> None:
self._exclude_files += excl_files

def clear_exclude_dirs(self) -> None:
self._exclude_dirs = None
self._exclude_dirs = []

def clear_exclude_files(self) -> None:
self._exclude_files = None
self._exclude_files = []

def report(self) -> None:
print(f"\nFortran source files checked: {self._checkcount}")
print(f"Fortran source files failed: {len(self._fprettifyfails)}\n")

for f in self._fprettifyfails:
print(f"fprettify -c .fprettify.yaml {f}")

print()

def exit(self) -> int:
os.chdir(self._entrypath)

if len(self._fprettifyfails):
return 1

return 0

def _check_src_fprettify(self, path: Path) -> None:
if self._excluded(path):
return

self._checkcount += 1

if self._verbose:
print(path)

cmd = f"fprettify -d -c .fprettify.yaml {path}"
result = run(cmd, capture_output=True, shell=True)

if result.stdout or result.stderr:
self._fprettifyfails.append(path)

def _excluded(self, path: Path) -> bool:
for f in self._exclude_files:
if os.path.exists(f) and os.path.samefile(path, f):
return True

for d in self._exclude_dirs:
if os.path.exists(d) and os.path.samefile(path.parents[0], d):
return True

return False

if __name__ == "__main__":
parser = argparse.ArgumentParser(
"MODFLOW 6 fortran format source code verification"
)
parser.add_argument(
"-r", "--root", help="path to MODFLOW 6 repository root directory"
)
parser.add_argument(
"-v", "--verbose", action="store_true", help="verbose"
)
args = parser.parse_args()

# set MODFLOW 6 repository root
root = Path(args.root).resolve() if args.root else Path(".").resolve()

fformat_check = FortranFormatCheck(root=root, verbose=args.verbose)
fformat_check.add_exclude_dirs(excl_dirs=excludedirs)
fformat_check.add_exclude_files(excl_files=excludefiles)

for path in searchpaths:
fformat_check.add_search_path(path=path)

fformat_check.report()
sys.exit(fformat_check.exit())
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "daily"

0 comments on commit 43f6198

Please sign in to comment.