shexec 2.3.0__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shexec
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Run a shell-type command over every file of an input tree: a ChRIS DS plugin on pfdo_run
5
5
  Home-page: https://github.com/FNNDSC/pl-shexec
6
6
  Author: FNNDSC
@@ -18,8 +18,8 @@ Requires-Python: >=3.11
18
18
  Description-Content-Type: text/x-rst
19
19
  License-File: LICENSE
20
20
  Requires-Dist: chris_plugin>=0.4.0
21
- Requires-Dist: pfdo>=6.2.0
22
- Requires-Dist: pfdo_run>=4.2.0
21
+ Requires-Dist: pfdo>=6.3.0
22
+ Requires-Dist: pfdo_run>=4.3.0
23
23
  Requires-Dist: hostlib>=1.2.0
24
24
  Requires-Dist: pflog>=2.0.0
25
25
  Provides-Extra: dev
@@ -159,7 +159,7 @@ From the command line, with the image:
159
159
  fnndsc/pl-shexec shexec --fileFilter txt \
160
160
  --exec "wc -l %{inputWorkingDir}/%{inputWorkingFile}" /incoming /outgoing
161
161
 
162
- docker run --rm fnndsc/pl-shexec shexec --man /tmp /tmp
162
+ docker run --rm fnndsc/pl-shexec shexec --man
163
163
 
164
164
  With Apptainer, ``apptainer exec docker://fnndsc/pl-shexec shexec ...``. The image carries the coreutils, zip and unzip, bc, perl, tar, ImageMagick and the DCMTK tools.
165
165
 
@@ -130,7 +130,7 @@ From the command line, with the image:
130
130
  fnndsc/pl-shexec shexec --fileFilter txt \
131
131
  --exec "wc -l %{inputWorkingDir}/%{inputWorkingFile}" /incoming /outgoing
132
132
 
133
- docker run --rm fnndsc/pl-shexec shexec --man /tmp /tmp
133
+ docker run --rm fnndsc/pl-shexec shexec --man
134
134
 
135
135
  With Apptainer, ``apptainer exec docker://fnndsc/pl-shexec shexec ...``. The image carries the coreutils, zip and unzip, bc, perl, tar, ImageMagick and the DCMTK tools.
136
136
 
@@ -13,7 +13,7 @@ authors = [{ email = "dev@babyMRI.org" }]
13
13
  # fields, which the [project] table does not emit; setup.cfg supplies them, and the
14
14
  # author name lives there alone so Author-email stays a bare address.
15
15
  requires-python = ">=3.11"
16
- dependencies = ["chris_plugin>=0.4.0", "pfdo>=6.2.0", "pfdo_run>=4.2.0", "hostlib>=1.2.0", "pflog>=2.0.0"]
16
+ dependencies = ["chris_plugin>=0.4.0", "pfdo>=6.3.0", "pfdo_run>=4.3.0", "hostlib>=1.2.0", "pflog>=2.0.0"]
17
17
  classifiers = [
18
18
  "Programming Language :: Python :: 3",
19
19
  "Programming Language :: Python :: 3.11",
@@ -14,7 +14,7 @@ Dependencies:
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- __version__: str = "2.3.0"
17
+ __version__: str = "2.4.0"
18
18
 
19
19
  from shexec.models import (
20
20
  DirNode,
@@ -38,7 +38,7 @@ from pathlib import Path
38
38
  from chris_plugin import chris_plugin
39
39
  from pfdo_run.__main__ import ARGS_SYNOPSIS_DS, CLI_DS, TAG_HELP, parser_build
40
40
  from pflog import timed
41
- from pftree.manual import Manual, manual_print
41
+ from pftree.manual import Manual, manual_attach
42
42
 
43
43
  from shexec.models import Plugin, PluginSpec
44
44
  from shexec.shexec import plugin_run
@@ -189,11 +189,13 @@ def parser_forSpec(spec: PluginSpec) -> argparse.ArgumentParser:
189
189
  The defaults are set on the parser rather than applied afterwards, so the
190
190
  description ``chris_plugin_info`` serialises carries them and ChRIS shows them.
191
191
  They are set after the omission, so a spec can pin an omitted flag to a value
192
- of its own.
192
+ of its own. ``--man`` and ``--synopsis`` print the plugin's own manual and exit as
193
+ they are read, so they need no ``inputdir outputdir``.
193
194
  """
194
195
  parser: argparse.ArgumentParser = parser_build(standalone=False, command=spec.name, version=spec.version)
195
196
  parser_omit(parser, spec.omit)
196
197
  parser.set_defaults(**spec.defaults)
198
+ manual_attach(parser, manual_build(spec))
197
199
  return parser
198
200
 
199
201
 
@@ -217,9 +219,6 @@ def plugin_build(spec: PluginSpec, singleton: bool = True) -> Plugin:
217
219
  manual: Manual = manual_build(spec)
218
220
 
219
221
  def body(options: argparse.Namespace, inputdir: Path, outputdir: Path) -> int:
220
- if options.man or options.synopsis:
221
- manual_print(manual, shortOnly=not options.man)
222
- return 0
223
222
  return plugin_run(options, inputdir, outputdir)
224
223
 
225
224
  body.__name__ = spec.name
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shexec
3
- Version: 2.3.0
3
+ Version: 2.4.0
4
4
  Summary: Run a shell-type command over every file of an input tree: a ChRIS DS plugin on pfdo_run
5
5
  Home-page: https://github.com/FNNDSC/pl-shexec
6
6
  Author: FNNDSC
@@ -18,8 +18,8 @@ Requires-Python: >=3.11
18
18
  Description-Content-Type: text/x-rst
19
19
  License-File: LICENSE
20
20
  Requires-Dist: chris_plugin>=0.4.0
21
- Requires-Dist: pfdo>=6.2.0
22
- Requires-Dist: pfdo_run>=4.2.0
21
+ Requires-Dist: pfdo>=6.3.0
22
+ Requires-Dist: pfdo_run>=4.3.0
23
23
  Requires-Dist: hostlib>=1.2.0
24
24
  Requires-Dist: pflog>=2.0.0
25
25
  Provides-Extra: dev
@@ -159,7 +159,7 @@ From the command line, with the image:
159
159
  fnndsc/pl-shexec shexec --fileFilter txt \
160
160
  --exec "wc -l %{inputWorkingDir}/%{inputWorkingFile}" /incoming /outgoing
161
161
 
162
- docker run --rm fnndsc/pl-shexec shexec --man /tmp /tmp
162
+ docker run --rm fnndsc/pl-shexec shexec --man
163
163
 
164
164
  With Apptainer, ``apptainer exec docker://fnndsc/pl-shexec shexec ...``. The image carries the coreutils, zip and unzip, bc, perl, tar, ImageMagick and the DCMTK tools.
165
165
 
@@ -1,6 +1,6 @@
1
1
  chris_plugin>=0.4.0
2
- pfdo>=6.2.0
3
- pfdo_run>=4.2.0
2
+ pfdo>=6.3.0
3
+ pfdo_run>=4.3.0
4
4
  hostlib>=1.2.0
5
5
  pflog>=2.0.0
6
6
 
@@ -17,11 +17,15 @@ from shexec.plugin import synopsis_build
17
17
 
18
18
 
19
19
  def test_manual_andSynopsis(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
20
- assert main(parser.parse_args(["--man"]), tmp_path, tmp_path) == 0
20
+ with pytest.raises(SystemExit) as exc:
21
+ parser.parse_args(["--man"])
22
+ assert exc.value.code == 0
21
23
  out: str = capsys.readouterr().out
22
24
  body: str = out.split("DESCRIPTION", 1)[1]
23
25
  assert "`" not in body and "TAGS" in body and "<inputDir>" in body and "shexec" in body
24
- assert main(parser.parse_args(["--synopsis"]), tmp_path, tmp_path) == 0
26
+ with pytest.raises(SystemExit) as exc:
27
+ parser.parse_args(["--synopsis"])
28
+ assert exc.value.code == 0
25
29
  assert "TAGS" not in capsys.readouterr().out
26
30
 
27
31
 
@@ -62,3 +66,13 @@ def test_chris_plugin_info_describesThePlugin() -> None:
62
66
  assert description["documentation"] == "https://github.com/FNNDSC/pl-shexec"
63
67
  assert description["authors"] == "FNNDSC <dev@babyMRI.org>"
64
68
  assert any(p["name"] == "exec" for p in description["parameters"])
69
+
70
+
71
+ def test_consoleScript_manNeedsNoDirectories(
72
+ monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
73
+ ) -> None:
74
+ monkeypatch.setattr("sys.argv", ["shexec", "--man"])
75
+ with pytest.raises(SystemExit) as exc:
76
+ main()
77
+ assert exc.value.code == 0
78
+ assert "TAGS" in capsys.readouterr().out
@@ -76,7 +76,9 @@ def test_derivedPlugin_describesItself_forChris() -> None:
76
76
 
77
77
  def test_derivedPlugin_manualAndVersion_areItsOwn(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
78
78
  plugin: Plugin = plugin_build(spec_make(), singleton=False)
79
- assert plugin.main(plugin.parser.parse_args(["--man"]), tmp_path, tmp_path) == 0
79
+ with pytest.raises(SystemExit) as exc:
80
+ plugin.parser.parse_args(["--man"])
81
+ assert exc.value.code == 0
80
82
  out: str = capsys.readouterr().out
81
83
  assert "linecount" in out and "Counts lines." in out and "9.9.9" in out and "TAGS" in out
82
84
  with pytest.raises(SystemExit):
@@ -105,7 +107,8 @@ def test_omittedFlags_absentFromParserDescriptionAndManual_valuePinned(
105
107
  plugin.parser.parse_args(["--threads", "4"])
106
108
  assert raised.value.code == 2
107
109
  capsys.readouterr()
108
- assert plugin.main(plugin.parser.parse_args(["--man"]), Path("/tmp"), Path("/tmp")) == 0
110
+ with pytest.raises(SystemExit):
111
+ plugin.parser.parse_args(["--man"])
109
112
  manual: str = capsys.readouterr().out
110
113
  assert "[--threads" not in manual and "[--threadsSplit" not in manual
111
114
  assert "[--verbosity" in manual
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes