diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5e42eb5..2273bb09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,7 @@ name: pymake continuous integration on: schedule: - - cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday + - cron: '0 7 * * *' # run at 7 AM UTC every day push: branches: [ master ] pull_request: @@ -47,25 +47,29 @@ jobs: - name: test on Linux if: runner.os == 'Linux' + working-directory: ./autotest run: | - pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v -n=auto --dist=loadfile -m="base or regression" --durations=0 --cov=pymake --cov-report=xml - name: test on MacOS if: runner.os == 'macOS' + working-directory: ./autotest run: | - pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v -n=auto --dist=loadfile -m="base" --durations=0 --cov=pymake --cov-report=xml - name: test on Windows if: runner.os == 'Windows' + working-directory: ./autotest shell: cmd run: | - pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v -m="base" --durations=0 --cov=pymake --cov-report=xml - name: Print coverage report before upload + working-directory: ./autotest run: | coverage report - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 with: - file: ./coverage.xml + file: ./autotest/coverage.xml diff --git a/.github/workflows/pymake-gcc.yml b/.github/workflows/pymake-gcc.yml index a54ce4fb..0f6bdc4b 100644 --- a/.github/workflows/pymake-gcc.yml +++ b/.github/workflows/pymake-gcc.yml @@ -2,7 +2,7 @@ name: pymake gcc build on: schedule: - - cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday + - cron: '0 7 * * *' # run at 7 AM UTC every day push: branches: [ master ] pull_request: @@ -46,17 +46,19 @@ jobs: .github/common/download-examples.sh - name: Run pytest + working-directory: ./autotest run: | - pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v --dist=loadfile -n=auto -m="base or regression" --durations=0 --cov=pymake --cov-report=xml - name: Print coverage report before upload + working-directory: ./autotest run: | coverage report - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 with: - file: ./coverage.xml + file: ./autotest/coverage.xml pymakeCI-gcc-prev: name: pymake CI GCC 9 and 8 @@ -102,17 +104,19 @@ jobs: .github/common/download-examples.sh - name: Run pytest + working-directory: ./autotest run: | - pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v --dist=loadfile -n=auto -m="base" --durations=0 --cov=pymake --cov-report=xml - name: Print coverage report before upload + working-directory: ./autotest run: | coverage report - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 with: - file: ./coverage.xml + file: ./autotest/coverage.xml pymakeCI-python-prev: name: pymake CI with previous python versions diff --git a/.github/workflows/pymake-requests.yml b/.github/workflows/pymake-requests.yml index fea575a3..26ad0d8b 100644 --- a/.github/workflows/pymake-requests.yml +++ b/.github/workflows/pymake-requests.yml @@ -2,7 +2,7 @@ name: pymake requests on: schedule: - - cron: '0 3 * * 3' # run at 3 AM UTC every Wednesday + - cron: '0 7 * * *' # run at 7 AM UTC every day push: branches: [ master ] pull_request: @@ -31,19 +31,22 @@ jobs: .github/common/install-python.sh - name: Run pytest + working-directory: ./autotest run: | - pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v -n=auto -m requests --durations=0 --cov=pymake --cov-report=xml - name: Run scheduled tests if: ${{ github.event_name == 'schedule' }} + working-directory: ./autotest run: | - pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml autotest/ + pytest -v -m="schedule" --durations=0 --cov=pymake --cov-report=xml - name: Print coverage report before upload + working-directory: ./autotest run: | coverage report - name: Upload coverage to Codecov uses: codecov/codecov-action@v3.1.1 with: - file: ./coverage.xml + file: ./autotest/coverage.xml diff --git a/README.md b/README.md index 5ca6f0fe..6b95bf47 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Python package for building MODFLOW-based programs from source files. -### Version 1.2.7 +### Version 1.2.8 ![pymake continuous integration](https://github.com/modflowpy/pymake/workflows/pymake%20continuous%20integration/badge.svg) [![codecov](https://codecov.io/gh/modflowpy/pymake/branch/master/graph/badge.svg)](https://codecov.io/gh/modflowpy/pymake) diff --git a/autotest/test_cli_cmds.py b/autotest/test_cli_cmds.py index 92fa3e28..5b2ecd6e 100644 --- a/autotest/test_cli_cmds.py +++ b/autotest/test_cli_cmds.py @@ -2,7 +2,6 @@ import pathlib as pl import shutil import subprocess -import sys import pytest diff --git a/autotest/test_mf6_existing_meson.py b/autotest/test_mf6_existing_meson.py index 68441bc4..5148bc19 100644 --- a/autotest/test_mf6_existing_meson.py +++ b/autotest/test_mf6_existing_meson.py @@ -1,8 +1,6 @@ -import contextlib import os import shutil import sys -import time import flopy import pytest diff --git a/autotest/test_requests.py b/autotest/test_requests.py index ea952336..d480771b 100644 --- a/autotest/test_requests.py +++ b/autotest/test_requests.py @@ -107,9 +107,9 @@ def test_latest_assets(): keys = assets.keys() test_keys = [ "code.json", + "code.md", "mac.zip", "linux.zip", - "win32.zip", "win64.zip", ] for key in keys: diff --git a/pymake/config.py b/pymake/config.py index 20ccbc4a..e238ccc4 100644 --- a/pymake/config.py +++ b/pymake/config.py @@ -1,6 +1,6 @@ __author__ = "Joseph D. Hughes" -__date__ = "December 8, 2022" -__version__ = "1.2.7" +__date__ = "July 5, 2023" +__version__ = "1.2.8" __maintainer__ = "Joseph D. Hughes" __email__ = "jdhughes@usgs.gov" __status__ = "Production" diff --git a/pymake/utils/_usgs_src_update.py b/pymake/utils/_usgs_src_update.py index 89dd0b14..fb9dbd3d 100644 --- a/pymake/utils/_usgs_src_update.py +++ b/pymake/utils/_usgs_src_update.py @@ -7,6 +7,7 @@ import shutil import sys import types +from typing import Union from .usgsprograms import usgs_program_data @@ -65,8 +66,7 @@ def _build_replace(targets): # remove exe extension from targets for idx, target in enumerate(targets): - if ".exe" in target.lower(): - targets[idx] = target[:-4] + targets[idx] = pl.Path(target).with_suffix("").name # get a dictionary of update functions funcs = _get_function_names(sys.modules[__name__], select_name="_update_") @@ -432,6 +432,11 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double): "FMTARG = 'BINARY'": "FMTARG = 'UNFORMATTED'\n ACCARG = 'STREAM'", ",SHARED,ACCESS='SEQUENTIAL'": ",ACCESS='SEQUENTIAL'", "FORM=FMTARG,SHARED,": "FORM=FMTARG,", + ",BUFFERED='YES',": ",", + ", BUFFERED='NO')": ")", + ",SHARE = 'DENYNONE'": ",", + ", SHARE = 'DENYNONE',": ",", + "FORM='FORMATTED',ACCESS='SEQUENTIAL',": "FORM='FORMATTED',ACCESS='SEQUENTIAL'", } fpth = pl.Path(srcdir) / "glo2basu1.f" @@ -446,6 +451,20 @@ def _update_mfusg_gsi_files(srcdir, fc, cc, arch, double): f.write(line) f.close() + tags = {",share='DENYNONE',": ","} + + fpth = pl.Path(srcdir) / "UpdtSt.for" + if fpth.exists(): + with open(fpth) as f: + lines = f.readlines() + f = open(fpth, "w") + for idx, line in enumerate(lines): + for key, value in tags.items(): + if key in line: + line = line.replace(key, value) + f.write(line) + f.close() + tag = "DEALLOCATE(ITHFLG)" tag2 = "DEALLOCATE(LAYTYP)" fpth = pl.Path(srcdir) / "gwf2bcf-lpf-u1.f" @@ -829,7 +848,116 @@ def _update_vs2dt_files(srcdir, fc, cc, arch, double): return +def _update_mf6_files( + srcdir: Union[str, os.PathLike], + fc: str, + cc: str, + arch: str, + double: bool, +) -> None: + """ + Update MODFLOW 6 source files to remove files with external dependencies. + This was required for releases >= 6.4.2 + + Parameters + ---------- + srcdir : str + path to directory with source files + fc : str + fortran compiler + cc : str + c/c++ compiler + arch : str + architecture + double : bool + boolean indicating if compiler switches are used to build a + double precision target + + Returns + ------- + + """ + _update_mf6_external_dependencies(srcdir) + return + + +def _update_libmf6_files( + srcdir: Union[str, os.PathLike], + fc: str, + cc: str, + arch: str, + double: bool, +) -> None: + """ + Update MODFLOW 6 shared object source files to remove files with external + dependencies. This was required for releases >= 6.4.2 + + Parameters + ---------- + srcdir : str + path to directory with source files + fc : str + fortran compiler + cc : str + c/c++ compiler + arch : str + architecture + double : bool + boolean indicating if compiler switches are used to build a + double precision target + + Returns + ------- + + """ + _update_mf6_external_dependencies(srcdir, target="libmf6") + return + + # common source file replacement functions +def _update_mf6_external_dependencies( + srcdir: Union[str, os.PathLike], + target: str = "mf6", +) -> None: + """ + Remove MODFLOW 6 files with external library dependencies (PETSc, MPI). + + + Parameters + ---------- + srcdir : os.PathLike + path to directory with source files + target: str + target to create (Default is mf6) + + Returns + ------- + None + + """ + if not isinstance(srcdir, pl.Path): + srcdir = pl.Path(srcdir) + if target == "libmf6": + srcdir = srcdir.parent / "src" + parallel_files = ( + "Utilities/Vector/PetscVector.F90", + "Utilities/Matrix/PetscMatrix.F90", + "Solution/PETSc/PetscSolver.F90", + "Solution/PETSc/PetscConvergence.F90", + "Distributed/MpiMessageBuilder.f90", + "Distributed/MpiRouter.f90", + "Distributed/MpiRunControl.F90", + "Distributed/MpiWorld.f90", + "Solution/ParallelSolution.f90", + ) + for file in parallel_files: + path = srcdir / file + if path.is_file(): + print(f'Removing..."{path}"') + os.remove(path) + return + + def _update_utl7(srcdir): """Update utl7.f source file diff --git a/pymake/utils/usgsprograms.txt b/pymake/utils/usgsprograms.txt index 717a28ca..ae63d308 100644 --- a/pymake/utils/usgsprograms.txt +++ b/pymake/utils/usgsprograms.txt @@ -1,7 +1,7 @@ target , version, current, url , dirname , srcdir , standard_switch, double_switch, shared_object -mf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , src , True , False , False -zbud6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , utils/zonebudget/src, True , False , False -libmf6 , 6.4.1 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.1/mf6.4.1_linux.zip , mf6.4.1_linux , srcbmi , True , False , True +mf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , src , True , False , False +zbud6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , utils/zonebudget/src, True , False , False +libmf6 , 6.4.2 , True , https://github.com/MODFLOW-USGS/modflow6/releases/download/6.4.2/mf6.4.2_linux.zip , mf6.4.2_linux , srcbmi , True , False , True mp7 , 7.2.001, True , https://water.usgs.gov/water-resources/software/MODPATH/modpath_7_2_001.zip , modpath_7_2_001 , source , True , False , False mt3dms , 5.3.0 , True , https://hydro.geo.ua.edu/mt3d/mt3dms_530.exe , mt3dms5.3.0 , src/true-binary , True , False , False mt3dusgs , 1.1.0 , True , https://water.usgs.gov/water-resources/software/MT3D-USGS/mt3dusgs1.1.0.zip , mt3dusgs1.1.0 , src , True , False , False @@ -18,6 +18,6 @@ swtv4 , 4.00.05, True , https://water.usgs.gov/water-resources/software mp6 , 6.0.1 , True , https://water.usgs.gov/water-resources/software/MODPATH/modpath.6_0_01.zip , modpath.6_0 , src , True , False , False mflgr , 2.0.0 , True , https://water.usgs.gov/ogw/modflow-lgr/modflow-lgr-v2.0.0/mflgrv2_0_00.zip , mflgr.2_0 , src , True , True , False zonbud3 , 3.01 , True , https://water.usgs.gov/water-resources/software/ZONEBUDGET/zonbud3_01.exe , Zonbud.3_01 , Src , True , False , False -mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False -mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , True , False -mfusg_gsi , 2.01.0 , True , https://www.gsienv.com/wp-content/uploads/2023/01/USG-Transport-V_2.1.0-1.zip , . , Source , True , True , False +mfnwt1.1.4 , 1.1.4 , False , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.1.4.zip , MODFLOW-NWT_1.1.4 , src , True , False , False +mfnwt , 1.3.0 , True , https://water.usgs.gov/water-resources/software/MODFLOW-NWT/MODFLOW-NWT_1.3.0.zip , MODFLOW-NWT , src , True , True , False +mfusg_gsi , 2.1.1 , True , https://www.gsienv.com/wp-content/uploads/2023/04/USG-Transport-V_2.1.1.zip , USGT-v2-1-1-source , . , True , False , False