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 13, 2024
1 parent 5590110 commit 73a1d86
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions distgen/cli_parser.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
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,
description=DESCRIPTION,
formatter_class=RawDescriptionHelpFormatter,
)

Expand All @@ -35,7 +30,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 +133,4 @@
'--multispec-combinations',
action='store_true',
help='Print available multispec combinations',
)
)

0 comments on commit 73a1d86

Please sign in to comment.