llnl / llnl/lctio

retiff needs to do its own globbing for file arguments on Windows

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
0
Forks
0
Avg merge
1m
Merged PRs (30d)
2

Description

Apparently, the Windows shell (`cmd.exe`, at least) does not do things like filename globbing before setting `argv` in spawned processes. (There is something like this available through the MSVC runtime helpers, but the Python interpreter does not opt in to that.)

To get convenient behavior that is more consistent across platforms, we can add our own globber for the positional arguments to `retiff`. Something like the following.

```python
import argparse
import glob

class GlobFiles(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
out = []
for v in values:
matches = glob.glob(v)
if matches:
out.extend(matches)
else:
out.append(v) # keep literal (bash-like default)
setattr(namespace, self.dest, out)

p = argparse.ArgumentParser()
p.add_argument(
"infile",
nargs="+",
action=GlobFiles,
)
```

We ought to add GitHub Actions testing pipelines and include Windows testing before committing a change and resolving this issue, though.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at retiff's positional-argument parsing and compare the proposed argparse Action with the current handling of infile values. Add Windows coverage through a GitHub Actions testing pipeline, preserving unmatched literals, and confirm the pipeline exercises filename globbing before resolving the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.