Skip to content

Commit

Permalink
fix(dist): multiple fixes following review (#1573)
Browse files Browse the repository at this point in the history
* omit utils/idmloader subdir
* update distribution checks
* rerun mf6ivar.py to update mf6io files
* fix typo in gwf-maw.dfn (missing and)
* use latex-friendly quotes in gwf-rcha dfn and tex description
  • Loading branch information
wpbonelli authored Jan 24, 2024
1 parent c547479 commit 5aefebf
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 71 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ jobs:
cp modflow6/meson.build "$distname/meson.build"
cp -r modflow6-examples/examples "$distname"
cp -r modflow6/src "$distname"
cp -r modflow6/utils "$distname"
cp -r modflow6/utils/mf5to6 "$distname/utils/mf5to6"
cp -r modflow6/utils/zonebudget "$distname/utils/zonebudget"
# create LaTeX file describing the folder structure
cd modflow6/doc/ReleaseNotes
Expand Down
47 changes: 29 additions & 18 deletions distribution/build_dist.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import argparse
import os
import platform
import shutil
import sys
import textwrap
from os import PathLike, environ
from pathlib import Path
from pprint import pprint
from shutil import copytree
from shutil import copy, copyfile, copytree, ignore_patterns

import pytest
from modflow_devtools.build import meson_build
Expand All @@ -16,8 +15,11 @@
from modflow_devtools.misc import get_model_paths

from build_docs import build_documentation
from build_makefiles import (build_mf5to6_makefile, build_mf6_makefile,
build_zbud6_makefile)
from build_makefiles import (
build_mf5to6_makefile,
build_mf6_makefile,
build_zbud6_makefile,
)
from utils import get_project_root_path, run_command

# default paths
Expand Down Expand Up @@ -54,31 +56,32 @@ def copy_sources(output_path: PathLike):
str(source_msvs_path / "mf6bmi.sln"),
str(source_msvs_path / "mf6bmi.vfproj"),
]:
shutil.copy(d, output_path / "msvs")
copy(d, output_path / "msvs")

ignored = shutil.ignore_patterns(".DS_Store")
ignored = [".DS_Store"]

# copy top-level meson.build and meson.options
shutil.copy(_project_root_path / "meson.build", output_path)
shutil.copy(_project_root_path / "meson.options", output_path)
copy(_project_root_path / "meson.build", output_path)
copy(_project_root_path / "meson.options", output_path)

# copy source folder
src_path = _project_root_path / "src"
dst_path = output_path / "src"
print(f"Copying {src_path} to {dst_path}")
copytree(src_path, dst_path, ignore=ignored)
copytree(src_path, dst_path, ignore=ignore_patterns(*ignored))

# copy srcbmi folder
src_path = _project_root_path / "srcbmi"
dst_path = output_path / "srcbmi"
print(f"Copying {src_path} to {dst_path}")
copytree(src_path, dst_path, ignore=ignored)
copytree(src_path, dst_path, ignore=ignore_patterns(*ignored))

# copy utils folder
src_path = _project_root_path / "utils"
dst_path = output_path / "utils"
print(f"Copying {src_path} to {dst_path}")
copytree(src_path, dst_path, ignore=ignored)
ignored.extend(["idmloader"])
copytree(src_path, dst_path, ignore=ignore_patterns(*ignored))


def test_copy_sources(tmp_path):
Expand All @@ -94,6 +97,14 @@ def test_copy_sources(tmp_path):
assert (tmp_path / "utils" / "meson.build").is_file()
assert (tmp_path / "msvs" / "mf6.sln").is_file()

assert (tmp_path / "utils").is_dir()
assert (tmp_path / "utils" / "mf5to6").is_dir()
assert (tmp_path / "utils" / "zonebudget").is_dir()
assert (tmp_path / "utils" / "mf5to6" / "pymake").is_dir()
assert (tmp_path / "utils" / "zonebudget" / "pymake").is_dir()
assert not (tmp_path / "utils" / "idmloader").is_dir()



def build_examples(examples_repo_path: PathLike, overwrite: bool = False):
examples_repo_path = Path(examples_repo_path).expanduser().absolute()
Expand Down Expand Up @@ -234,10 +245,10 @@ def build_makefiles(output_path: PathLike):
# create and copy mf6 makefile
build_mf6_makefile()
(output_path / "make").mkdir(parents=True, exist_ok=True)
shutil.copyfile(
copyfile(
_project_root_path / "make" / "makefile", output_path / "make" / "makefile"
)
shutil.copyfile(
copyfile(
_project_root_path / "make" / "makedefaults",
output_path / "make" / "makedefaults",
)
Expand All @@ -246,10 +257,10 @@ def build_makefiles(output_path: PathLike):
build_zbud6_makefile()
rel_path = Path("utils") / "zonebudget" / "make"
(output_path / rel_path).mkdir(parents=True, exist_ok=True)
shutil.copyfile(
copyfile(
_project_root_path / rel_path / "makefile", output_path / rel_path / "makefile"
)
shutil.copyfile(
copyfile(
_project_root_path / rel_path / "makedefaults",
output_path / rel_path / "makedefaults",
)
Expand All @@ -258,10 +269,10 @@ def build_makefiles(output_path: PathLike):
build_mf5to6_makefile()
rel_path = Path("utils") / "mf5to6" / "make"
(output_path / rel_path).mkdir(parents=True, exist_ok=True)
shutil.copyfile(
copyfile(
_project_root_path / rel_path / "makefile", output_path / rel_path / "makefile"
)
shutil.copyfile(
copyfile(
_project_root_path / rel_path / "makedefaults",
output_path / rel_path / "makedefaults",
)
Expand Down Expand Up @@ -301,7 +312,7 @@ def build_distribution(
)

# code.json metadata
shutil.copy(_project_root_path / "code.json", output_path)
copy(_project_root_path / "code.json", output_path)

# full releases include examples, source code, makefiles and docs
if not full:
Expand Down
11 changes: 11 additions & 0 deletions distribution/check_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ def test_sources(dist_dir_path, releasemode, full):
if not full:
pytest.skip(reason="sources not included in minimal distribution")

# check top-level meson files
assert (dist_dir_path / "meson.build").is_file()
assert (dist_dir_path / "meson.options").is_file()

# check src subdir
assert (dist_dir_path / "src").is_dir()
assert (dist_dir_path / "src" / "mf6.f90").is_file()
version_file_path = dist_dir_path / "src" / "Utilities" / "version.f90"
Expand All @@ -90,6 +93,14 @@ def test_sources(dist_dir_path, releasemode, full):
idevelopmode = 0 if releasemode else 1
assert f"IDEVELOPMODE = {idevelopmode}" in line

# check utils subdir
assert (dist_dir_path / "utils").is_dir()
assert (dist_dir_path / "utils" / "mf5to6").is_dir()
assert (dist_dir_path / "utils" / "zonebudget").is_dir()
assert (dist_dir_path / "utils" / "mf5to6" / "pymake").is_dir()
assert (dist_dir_path / "utils" / "zonebudget" / "pymake").is_dir()
assert not (dist_dir_path / "utils" / "idmloader").is_dir()


@pytest.mark.skipif(not _fc, reason="needs Fortran compiler")
def test_makefiles(dist_dir_path, full):
Expand Down
2 changes: 1 addition & 1 deletion doc/mf6io/mf6ivar/dfn/gwf-maw.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ tagged false
in_record true
reader urword
longname screen bottom
description value that defines the bottom elevation of the screen for the multi-aquifer well connection. If CONDEQN is SPECIFIED, THIEM, SKIN, or COMPOSITE, SCRN\_BOT can be any value is set to the bottom of the cell. If CONDEQN is MEAN, SCRN\_BOT is set to the multi-aquifer well connection cell bottom if the specified value is less than the cell bottom. The program will terminate with an error if the screen bottom is greater than the screen top.
description value that defines the bottom elevation of the screen for the multi-aquifer well connection. If CONDEQN is SPECIFIED, THIEM, SKIN, or COMPOSITE, SCRN\_BOT can be any value and is set to the bottom of the cell. If CONDEQN is MEAN, SCRN\_BOT is set to the multi-aquifer well connection cell bottom if the specified value is less than the cell bottom. The program will terminate with an error if the screen bottom is greater than the screen top.

block connectiondata
name hk_skin
Expand Down
2 changes: 1 addition & 1 deletion doc/mf6io/mf6ivar/dfn/gwf-rcha.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ reader urword
optional false
tagged false
longname file name of time series information
description defines a time-array-series file defining a time-array series that can be used to assign time-varying values. See the Time-Variable Input section for instructions on using the time-array series capability.
description defines a time-array-series file defining a time-array series that can be used to assign time-varying values. See the ``Time-Variable Input'' section for instructions on using the time-array series capability.

block options
name obs_filerecord
Expand Down
Loading

0 comments on commit 5aefebf

Please sign in to comment.