Skip to content

Commit

Permalink
Make linter(s) happy
Browse files Browse the repository at this point in the history
  • Loading branch information
praiskup committed Sep 25, 2024
1 parent 00c94db commit 1f0c245
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions distgen/cli_parser.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
from argparse import ArgumentParser, RawDescriptionHelpFormatter
"""
Separated argument parser. This makes the manual page generator happy because
we don't need any other dependencies installed at build-time. See #149.
"""

from importlib.metadata import version, PackageNotFoundError
from argparse import ArgumentParser, RawDescriptionHelpFormatter

try:
version = version("distgen")
except PackageNotFoundError:
# package is not installed, due to this file being used by manpage generator
# we have to check for this, we do not need valid version during manpage
# generation, but it will crash
version = 0
pass
from distgen.version import dg_version

description = \
"""
DESCRIPTION = """\
Generate script using predefined metadata about distribution and
templates.
As an example of 'dg' usage, to generate _Dockerfile_ for Fedora
21 64-bit system, you may use command(s):
$ cd project/directory
$ dg --spec docker-data.yaml \\
--template docker.tpl
"""
$ cd project/directory
$ dg --spec docker-data.yaml \\
--template docker.tpl
"""

parser = ArgumentParser(
description=description,
prog='dg',
description=DESCRIPTION,
formatter_class=RawDescriptionHelpFormatter,
)

Expand All @@ -35,7 +31,7 @@
parser.add_argument(
'--version',
action='version',
version="dg (distgen) {0}".format(version)
version=f"dg (distgen) {dg_version}",
)

parser.add_argument(
Expand Down Expand Up @@ -138,4 +134,4 @@
'--multispec-combinations',
action='store_true',
help='Print available multispec combinations',
)
)

0 comments on commit 1f0c245

Please sign in to comment.