Skip to content

Commit 19750a0

Browse files
authored
Replace -adt/--ansible-dev-tools argument with --seed (#274)
Related: https://issues.redhat.com/browse/AAP-30772
1 parent 149afff commit 19750a0

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

.config/constraints.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pymdown-extensions==10.12
8787
pyproject-api==1.8.0
8888
pyproject-hooks==1.2.0
8989
pytest==8.3.4
90+
pytest-instafail==0.5.0
9091
pytest-xdist==3.6.1
9192
python-dateutil==2.9.0.post0
9293
python-slugify==8.0.4

.config/requirements-test.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pre-commit
66
pydoclint
77
pylint
88
pytest
9+
pytest-instafail
910
pytest-xdist
1011
ruff
1112
toml-sort

.pre-commit-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ repos:
4343
- prettier-plugin-toml
4444
- prettier-plugin-sort-json
4545

46-
- repo: https://github.com/psf/black
47-
rev: 24.10.0
48-
hooks:
49-
- id: black
50-
5146
- repo: https://github.com/pappasam/toml-sort
5247
rev: v0.24.2
5348
hooks:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ target-version = "py310"
335335
[tool.ruff.lint]
336336
ignore = [
337337
"COM812", # conflicts with ISC001 on format
338+
"E501", # line-too-long (ruff-format or black will take care of it)
338339
"ISC001" # conflicts with COM812 on format
339340
]
340341
select = ["ALL"]

src/ansible_dev_environment/arg_parser.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
from __future__ import annotations
44

55
import argparse
6+
import logging
7+
import sys
68

79
from argparse import HelpFormatter
810
from pathlib import Path
911
from typing import TYPE_CHECKING
1012

1113

14+
logger = logging.getLogger(__name__)
15+
1216
if TYPE_CHECKING:
1317
from typing import Any
1418

@@ -186,11 +190,11 @@ def parse() -> argparse.Namespace:
186190
)
187191

188192
install.add_argument(
189-
"-adt",
190-
"--ansible-dev-tools",
193+
# "-adt",
194+
"--seed",
191195
action="store_true",
192196
dest="adt",
193-
help="Install ansible-dev-tools in the virtual environment.",
197+
help="Install seed packages inside the virtual environment (ansible-dev-tools).",
194198
)
195199

196200
_uninstall = subparsers.add_parser(
@@ -204,7 +208,14 @@ def parse() -> argparse.Namespace:
204208
for subparser in subparsers.choices.values():
205209
_group_titles(subparser)
206210

207-
return parser.parse_args()
211+
args = sys.argv[1:]
212+
for i, v in enumerate(args):
213+
for old in ("-adt", "--ansible-dev-tools"):
214+
if v == old:
215+
msg = f"Replace the deprecated {old} argument with --seed to avoid future execution failure."
216+
logger.warning(msg)
217+
args[i] = "--seed"
218+
return parser.parse_args(args)
208219

209220

210221
def _group_titles(parser: ArgumentParser) -> None:

0 commit comments

Comments
 (0)