Skip to content

Commit 9fe92e3

Browse files
committed
wip
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 1d1f3ea commit 9fe92e3

File tree

4 files changed

+11
-33
lines changed

4 files changed

+11
-33
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Read the full [documentation][link_rtfd] for more details.
4343

4444
## Requirements
4545

46-
* Python `>=3.8,<4`
46+
* Python `>=3.9,<4`
4747

4848
However, there are older versions of this tool available, which
4949
support Python `>=2.7`.

cyclonedx_py/_internal/cli.py

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import logging
1919
import sys
20-
from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter
20+
from argparse import ArgumentParser, BooleanOptionalAction, FileType, RawDescriptionHelpFormatter
2121
from itertools import chain
2222
from typing import TYPE_CHECKING, Any, Dict, List, NoReturn, Optional, Sequence, TextIO, Type, Union
2323

@@ -35,20 +35,11 @@
3535
from .utils.args import argparse_type4enum, choices4enum
3636

3737
if TYPE_CHECKING: # pragma: no cover
38-
from argparse import Action
39-
4038
from cyclonedx.model.bom import Bom
4139
from cyclonedx.model.component import Component
4240

4341
from . import BomBuilder
4442

45-
BooleanOptionalAction: Optional[Type[Action]]
46-
47-
if sys.version_info >= (3, 9):
48-
from argparse import BooleanOptionalAction
49-
else:
50-
BooleanOptionalAction = None
51-
5243
OPTION_OUTPUT_STDOUT = '-'
5344

5445

@@ -121,25 +112,12 @@ def make_argument_parser(cls, sco: ArgumentParser, **kwargs: Any) -> ArgumentPar
121112
type=FileType('wt', encoding='utf8'),
122113
dest='output_file',
123114
default=OPTION_OUTPUT_STDOUT)
124-
if BooleanOptionalAction:
125-
op.add_argument('--validate',
126-
help='Whether to validate resulting BOM before outputting.'
127-
' (default: %(default)s)',
128-
action=BooleanOptionalAction,
129-
dest='should_validate',
130-
default=True)
131-
else:
132-
vg = op.add_mutually_exclusive_group()
133-
vg.add_argument('--validate',
134-
help='Validate resulting BOM before outputting.'
135-
' (default: %(default)s)',
136-
action='store_true',
137-
dest='should_validate',
138-
default=True)
139-
vg.add_argument('--no-validate',
140-
help='Disable validation of resulting BOM.',
141-
dest='should_validate',
142-
action='store_false')
115+
op.add_argument('--validate',
116+
help='Whether to validate resulting BOM before outputting.'
117+
' (default: %(default)s)',
118+
action=BooleanOptionalAction,
119+
dest='should_validate',
120+
default=True)
143121

144122
scbbc: Type['BomBuilder']
145123
sct: str

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ classifiers = [
6767
cyclonedx-py = "cyclonedx_py._internal.cli:run"
6868

6969
[tool.poetry.dependencies]
70-
python = "^3.8"
70+
python = "^3.9"
7171
cyclonedx-python-lib = { version = "^8.0 || ^9.0 || ^10", extras = ["validation"] }
7272
packageurl-python = ">=0.11, <2" # keep in sync with same dep in `cyclonedx-python-lib`
7373
pip-requirements-parser = "^32.0"

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ minversion = 4.0
88
envlist =
99
flake8
1010
mypy-{current,lowest}
11-
py{313,312,311,310,39,38}
11+
py{313,312,311,310,39}
1212
bandit
1313
skip_missing_interpreters = True
1414
usedevelop = False
@@ -35,7 +35,7 @@ skip_install = True
3535
commands =
3636
# mypy config is on own file: `.mypy.ini`
3737
!lowest: poetry run mypy
38-
lowest: poetry run mypy --python-version=3.8
38+
lowest: poetry run mypy --python-version=3.9
3939

4040
[testenv:flake8]
4141
skip_install = True

0 commit comments

Comments
 (0)