aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-05-17 13:02:51 +0200
committerEgor Tensin <egor@tensin.name>2026-05-17 13:02:51 +0200
commit64899879b001d08efd5b62b97daa85d5c825c1ee (patch)
tree2cffff91f869ea9b3182961c2d3f9d859090275c /project
parentworkflows: add Python black run (diff)
downloadcmake-common-64899879b001d08efd5b62b97daa85d5c825c1ee.tar.gz
cmake-common-64899879b001d08efd5b62b97daa85d5c825c1ee.zip
reformat everything for fun
Diffstat (limited to 'project')
-rw-r--r--project/boost/archive.py5
-rw-r--r--project/boost/build.py140
-rw-r--r--project/boost/download.py51
-rw-r--r--project/boost/version.py1
-rw-r--r--project/build.py170
-rw-r--r--project/linkage.py8
-rw-r--r--project/platform.py8
-rw-r--r--project/toolset.py28
-rw-r--r--project/utils.py5
-rw-r--r--project/version.py5
10 files changed, 291 insertions, 130 deletions
diff --git a/project/boost/archive.py b/project/boost/archive.py
index e15e457..ee46728 100644
--- a/project/boost/archive.py
+++ b/project/boost/archive.py
@@ -75,8 +75,9 @@ class TemporaryStorage(ArchiveStorage):
@contextmanager
def write_archive(self, version, contents):
- tmp = temp_file(prefix=f'boost_{version}_',
- suffix=version.archive_ext, dir=self._dir)
+ tmp = temp_file(
+ prefix=f'boost_{version}_', suffix=version.archive_ext, dir=self._dir
+ )
with tmp as archive_path:
with open(archive_path, mode='wb') as fd:
fd.write(contents)
diff --git a/project/boost/build.py b/project/boost/build.py
index 8ef993c..a15388b 100644
--- a/project/boost/build.py
+++ b/project/boost/build.py
@@ -41,18 +41,30 @@ from project.toolset import Toolset, ToolsetVersion
from project.utils import normalize_path, setup_logging
import project.version
-
DEFAULT_PLATFORMS = (Platform.AUTO,)
-DEFAULT_CONFIGURATIONS = (Configuration.DEBUG, Configuration.RELEASE,)
+DEFAULT_CONFIGURATIONS = (
+ Configuration.DEBUG,
+ Configuration.RELEASE,
+)
DEFAULT_TOOLSET_VERSION = ToolsetVersion.default()
B2_QUIET = ['warnings=off', '-d0']
B2_VERBOSE = ['warnings=all', '-d2', '--debug-configuration']
class BuildParameters:
- def __init__(self, boost_dir, libraries, build_dir=None, platforms=None,
- configurations=None, link=None, runtime_link=None,
- toolset_version=None, verbose=False, b2_args=None):
+ def __init__(
+ self,
+ boost_dir,
+ libraries,
+ build_dir=None,
+ platforms=None,
+ configurations=None,
+ link=None,
+ runtime_link=None,
+ toolset_version=None,
+ verbose=False,
+ b2_args=None,
+ ):
boost_dir = normalize_path(boost_dir)
libraries = libraries or []
@@ -99,7 +111,9 @@ class BuildParameters:
yield self.build_dir
return
- with tempfile.TemporaryDirectory(dir=os.path.dirname(self.boost_dir)) as build_dir:
+ with tempfile.TemporaryDirectory(
+ dir=os.path.dirname(self.boost_dir)
+ ) as build_dir:
logging.info('Build directory: %s', build_dir)
try:
yield build_dir
@@ -139,59 +153,107 @@ def _parse_args(argv=None):
sys.exit(0)
parser = argparse.ArgumentParser(
- description=__doc__,
- formatter_class=argparse.RawDescriptionHelpFormatter)
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
+ )
- parser.add_argument('--help-toolsets', action='store_true',
- help='show detailed info about supported toolsets')
+ parser.add_argument(
+ '--help-toolsets',
+ action='store_true',
+ help='show detailed info about supported toolsets',
+ )
project.version.add_to_arg_parser(parser)
- parser.add_argument('-v', '--verbose', action='store_true',
- help='verbose b2 invocation (quiet by default)')
+ parser.add_argument(
+ '-v',
+ '--verbose',
+ action='store_true',
+ help='verbose b2 invocation (quiet by default)',
+ )
- parser.add_argument('--toolset', metavar='TOOLSET', dest='toolset_version',
- type=ToolsetVersion.parse, default=DEFAULT_TOOLSET_VERSION,
- help=f'toolset to use ({ToolsetVersion.usage()})')
+ parser.add_argument(
+ '--toolset',
+ metavar='TOOLSET',
+ dest='toolset_version',
+ type=ToolsetVersion.parse,
+ default=DEFAULT_TOOLSET_VERSION,
+ help=f'toolset to use ({ToolsetVersion.usage()})',
+ )
platform_options = '/'.join(map(str, Platform.all()))
configuration_options = '/'.join(map(str, Configuration.all()))
# These are used to put the built libraries into proper installation
# directory subdirectories (to avoid name clashes).
- parser.add_argument('--platform', metavar='PLATFORM', dest='platforms',
- nargs='*', type=Platform.parse, default=[],
- help=f'target platform ({platform_options})')
- parser.add_argument('--configuration', metavar='CONFIGURATION', dest='configurations',
- nargs='*', type=Configuration.parse, default=[],
- help=f'target configuration ({configuration_options})')
+ parser.add_argument(
+ '--platform',
+ metavar='PLATFORM',
+ dest='platforms',
+ nargs='*',
+ type=Platform.parse,
+ default=[],
+ help=f'target platform ({platform_options})',
+ )
+ parser.add_argument(
+ '--configuration',
+ metavar='CONFIGURATION',
+ dest='configurations',
+ nargs='*',
+ type=Configuration.parse,
+ default=[],
+ help=f'target configuration ({configuration_options})',
+ )
linkage_options = '/'.join(map(str, Linkage.all()))
# This is needed because the default behaviour on Linux and Windows is
# different: static & dynamic libs are built on Linux, but only static libs
# are built on Windows by default.
- parser.add_argument('--link', metavar='LINKAGE',
- type=Linkage.parse, default=Linkage.default_link(),
- help=f'how the libraries are linked ({linkage_options})')
+ parser.add_argument(
+ '--link',
+ metavar='LINKAGE',
+ type=Linkage.parse,
+ default=Linkage.default_link(),
+ help=f'how the libraries are linked ({linkage_options})',
+ )
# This is used to omit runtime-link=static I'd have to otherwise use a lot,
# plus the script validates the link= and runtime-link= combinations.
- parser.add_argument('--runtime-link', metavar='LINKAGE',
- type=Linkage.parse, default=Linkage.default_runtime_link(),
- help=f'how the libraries link to the runtime ({linkage_options})')
+ parser.add_argument(
+ '--runtime-link',
+ metavar='LINKAGE',
+ type=Linkage.parse,
+ default=Linkage.default_runtime_link(),
+ help=f'how the libraries link to the runtime ({linkage_options})',
+ )
- parser.add_argument('--build', metavar='DIR', dest='build_dir',
- type=normalize_path,
- help='Boost build directory (temporary directory unless specified)')
+ parser.add_argument(
+ '--build',
+ metavar='DIR',
+ dest='build_dir',
+ type=normalize_path,
+ help='Boost build directory (temporary directory unless specified)',
+ )
- parser.add_argument('--b2-arg', metavar='ARG', dest='b2_args',
- action='extend', nargs='*',
- help='additional b2 arguments, to be passed verbatim')
+ parser.add_argument(
+ '--b2-arg',
+ metavar='ARG',
+ dest='b2_args',
+ action='extend',
+ nargs='*',
+ help='additional b2 arguments, to be passed verbatim',
+ )
- parser.add_argument('boost_dir', metavar='BOOST_DIR',
- type=normalize_path,
- help='root Boost directory')
- parser.add_argument('libraries', metavar='LIBRARIES',
- action='extend', nargs='*',
- help='libraries to build (all libraries by default)')
+ parser.add_argument(
+ 'boost_dir',
+ metavar='BOOST_DIR',
+ type=normalize_path,
+ help='root Boost directory',
+ )
+ parser.add_argument(
+ 'libraries',
+ metavar='LIBRARIES',
+ action='extend',
+ nargs='*',
+ help='libraries to build (all libraries by default)',
+ )
return parser.parse_args(argv)
diff --git a/project/boost/download.py b/project/boost/download.py
index aee80dc..5ee5e96 100644
--- a/project/boost/download.py
+++ b/project/boost/download.py
@@ -32,8 +32,9 @@ import project.version
class Download:
- def __init__(self, version, unpack_dir=None, cache_dir=None,
- dest_path=None, no_retry=False):
+ def __init__(
+ self, version, unpack_dir=None, cache_dir=None, dest_path=None, no_retry=False
+ ):
if unpack_dir is None:
if cache_dir is None:
unpack_dir = '.'
@@ -125,25 +126,39 @@ def _parse_args(argv=None):
argv = sys.argv[1:]
parser = argparse.ArgumentParser(
- description=__doc__,
- formatter_class=argparse.RawDescriptionHelpFormatter)
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
+ )
project.version.add_to_arg_parser(parser)
- parser.add_argument('--unpack', metavar='DIR', dest='unpack_dir',
- type=normalize_path,
- help='directory to unpack the archive to')
- parser.add_argument('--cache', metavar='DIR', dest='cache_dir',
- type=normalize_path,
- help='download directory (temporary file unless specified)')
- parser.add_argument('--no-retry', action='store_true',
- help=argparse.SUPPRESS)
- parser.add_argument('version', metavar='VERSION',
- type=Version.from_string,
- help='Boost version (in the MAJOR.MINOR.PATCH format)')
- parser.add_argument('dest_path', metavar='DIR', nargs='?',
- type=normalize_path,
- help='rename the boost directory to DIR')
+ parser.add_argument(
+ '--unpack',
+ metavar='DIR',
+ dest='unpack_dir',
+ type=normalize_path,
+ help='directory to unpack the archive to',
+ )
+ parser.add_argument(
+ '--cache',
+ metavar='DIR',
+ dest='cache_dir',
+ type=normalize_path,
+ help='download directory (temporary file unless specified)',
+ )
+ parser.add_argument('--no-retry', action='store_true', help=argparse.SUPPRESS)
+ parser.add_argument(
+ 'version',
+ metavar='VERSION',
+ type=Version.from_string,
+ help='Boost version (in the MAJOR.MINOR.PATCH format)',
+ )
+ parser.add_argument(
+ 'dest_path',
+ metavar='DIR',
+ nargs='?',
+ type=normalize_path,
+ help='rename the boost directory to DIR',
+ )
return parser.parse_args(argv)
diff --git a/project/boost/version.py b/project/boost/version.py
index e49a81f..134c62a 100644
--- a/project/boost/version.py
+++ b/project/boost/version.py
@@ -8,7 +8,6 @@ from functools import total_ordering
import os.path
import re
-
_Version = namedtuple('_Version', ['major', 'minor', 'patch'])
diff --git a/project/build.py b/project/build.py
index 984bf0e..a2f2fb7 100644
--- a/project/build.py
+++ b/project/build.py
@@ -34,7 +34,6 @@ from project.toolset import Toolset, ToolsetVersion
from project.utils import normalize_path, mkdir_parent, run, setup_logging
import project.version
-
DEFAULT_PLATFORM = Platform.AUTO
DEFAULT_CONFIGURATION = Configuration.DEBUG
DEFAULT_TOOLSET_VERSION = ToolsetVersion.default()
@@ -52,9 +51,18 @@ def run_cmake(cmake_args):
class GenerationPhase:
- def __init__(self, src_dir, build_dir, platform=None, configuration=None,
- boost_dir=None, link=None, runtime_link=None,
- install_dir=None, cmake_args=None):
+ def __init__(
+ self,
+ src_dir,
+ build_dir,
+ platform=None,
+ configuration=None,
+ boost_dir=None,
+ link=None,
+ runtime_link=None,
+ install_dir=None,
+ cmake_args=None,
+ ):
self.src_dir = normalize_path(src_dir)
self.build_dir = normalize_path(build_dir)
@@ -99,10 +107,7 @@ class GenerationPhase:
args += [f'-DCMAKE_INSTALL_PREFIX={self.install_dir}']
# Important! -H must come as the last parameter, older CMake versions
# don't like it when it's not.
- args += [
- f'-B{self.build_dir}',
- f'-H{self.src_dir}'
- ]
+ args += [f'-B{self.build_dir}', f'-H{self.src_dir}']
return args
def run(self, toolset):
@@ -128,9 +133,19 @@ class BuildPhase:
class BuildParameters:
- def __init__(self, src_dir, build_dir, install_dir=None, platform=None,
- configuration=None, boost_dir=None, link=None,
- runtime_link=None, toolset_version=None, cmake_args=None):
+ def __init__(
+ self,
+ src_dir,
+ build_dir,
+ install_dir=None,
+ platform=None,
+ configuration=None,
+ boost_dir=None,
+ link=None,
+ runtime_link=None,
+ toolset_version=None,
+ cmake_args=None,
+ ):
self.src_dir = normalize_path(src_dir)
self.build_dir = normalize_path(build_dir) if build_dir else None
@@ -157,7 +172,9 @@ class BuildParameters:
yield self.build_dir
return
- with tempfile.TemporaryDirectory(dir=os.path.dirname(self.src_dir)) as build_dir:
+ with tempfile.TemporaryDirectory(
+ dir=os.path.dirname(self.src_dir)
+ ) as build_dir:
logging.info('Build directory: %s', build_dir)
try:
yield build_dir
@@ -169,17 +186,23 @@ def build(params):
with params.create_build_dir() as build_dir:
toolset = Toolset.make(params.toolset_version, params.platform)
- gen_phase = GenerationPhase(params.src_dir, build_dir,
- platform=params.platform,
- configuration=params.configuration,
- boost_dir=params.boost_dir,
- link=params.link,
- runtime_link=params.runtime_link,
- install_dir=params.install_dir,
- cmake_args=params.cmake_args)
+ gen_phase = GenerationPhase(
+ params.src_dir,
+ build_dir,
+ platform=params.platform,
+ configuration=params.configuration,
+ boost_dir=params.boost_dir,
+ link=params.link,
+ runtime_link=params.runtime_link,
+ install_dir=params.install_dir,
+ cmake_args=params.cmake_args,
+ )
gen_phase.run(toolset)
- build_phase = BuildPhase(build_dir, install_dir=params.install_dir,
- configuration=params.configuration)
+ build_phase = BuildPhase(
+ build_dir,
+ install_dir=params.install_dir,
+ configuration=params.configuration,
+ )
build_phase.run(toolset)
@@ -192,52 +215,91 @@ def _parse_args(argv=None):
sys.exit(0)
parser = argparse.ArgumentParser(
- description=__doc__,
- formatter_class=argparse.RawDescriptionHelpFormatter)
+ description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter
+ )
- parser.add_argument('--help-toolsets', action='store_true',
- help='show detailed info about supported toolsets')
+ parser.add_argument(
+ '--help-toolsets',
+ action='store_true',
+ help='show detailed info about supported toolsets',
+ )
project.version.add_to_arg_parser(parser)
- parser.add_argument('--toolset', metavar='TOOLSET', dest='toolset_version',
- type=ToolsetVersion.parse, default=DEFAULT_TOOLSET_VERSION,
- help=f'toolset to use ({ToolsetVersion.usage()})')
+ parser.add_argument(
+ '--toolset',
+ metavar='TOOLSET',
+ dest='toolset_version',
+ type=ToolsetVersion.parse,
+ default=DEFAULT_TOOLSET_VERSION,
+ help=f'toolset to use ({ToolsetVersion.usage()})',
+ )
platform_options = '/'.join(map(str, Platform.all()))
configuration_options = '/'.join(map(str, Configuration.all()))
- parser.add_argument('--platform', metavar='PLATFORM',
- type=Platform.parse,
- help=f'target platform ({platform_options})')
- parser.add_argument('--configuration', metavar='CONFIG',
- type=Configuration.parse, default=DEFAULT_CONFIGURATION,
- help=f'build configuration ({configuration_options})')
+ parser.add_argument(
+ '--platform',
+ metavar='PLATFORM',
+ type=Platform.parse,
+ help=f'target platform ({platform_options})',
+ )
+ parser.add_argument(
+ '--configuration',
+ metavar='CONFIG',
+ type=Configuration.parse,
+ default=DEFAULT_CONFIGURATION,
+ help=f'build configuration ({configuration_options})',
+ )
- parser.add_argument('--boost', metavar='DIR', dest='boost_dir',
- type=normalize_path,
- help='set Boost directory path')
+ parser.add_argument(
+ '--boost',
+ metavar='DIR',
+ dest='boost_dir',
+ type=normalize_path,
+ help='set Boost directory path',
+ )
linkage_options = '/'.join(map(str, Linkage.all()))
- parser.add_argument('--link', metavar='LINKAGE',
- type=Linkage.parse, default=Linkage.default_link(),
- help=f'how Boost libraries are linked ({linkage_options})')
- parser.add_argument('--runtime-link', metavar='LINKAGE',
- type=Linkage.parse, default=Linkage.default_runtime_link(),
- help=f'which runtime to link to ({linkage_options})')
+ parser.add_argument(
+ '--link',
+ metavar='LINKAGE',
+ type=Linkage.parse,
+ default=Linkage.default_link(),
+ help=f'how Boost libraries are linked ({linkage_options})',
+ )
+ parser.add_argument(
+ '--runtime-link',
+ metavar='LINKAGE',
+ type=Linkage.parse,
+ default=Linkage.default_runtime_link(),
+ help=f'which runtime to link to ({linkage_options})',
+ )
- parser.add_argument('--install', metavar='DIR', dest='install_dir',
- type=normalize_path,
- help='install directory')
+ parser.add_argument(
+ '--install',
+ metavar='DIR',
+ dest='install_dir',
+ type=normalize_path,
+ help='install directory',
+ )
- parser.add_argument('--cmake-arg', metavar='ARG', dest='cmake_args',
- action='extend', nargs='*',
- help='additional CMake arguments, to be passed verbatim')
+ parser.add_argument(
+ '--cmake-arg',
+ metavar='ARG',
+ dest='cmake_args',
+ action='extend',
+ nargs='*',
+ help='additional CMake arguments, to be passed verbatim',
+ )
- parser.add_argument('src_dir', type=normalize_path,
- help='source directory')
- parser.add_argument('build_dir', type=normalize_path, nargs='?',
- help='build directory (a temporary directory if omitted)')
+ parser.add_argument('src_dir', type=normalize_path, help='source directory')
+ parser.add_argument(
+ 'build_dir',
+ type=normalize_path,
+ nargs='?',
+ help='build directory (a temporary directory if omitted)',
+ )
return parser.parse_args(argv)
diff --git a/project/linkage.py b/project/linkage.py
index 49d9d23..3a12393 100644
--- a/project/linkage.py
+++ b/project/linkage.py
@@ -42,10 +42,14 @@ class Linkage(Enum):
def validate_linkage(link, runtime_link):
if runtime_link is Linkage.STATIC:
if link is Linkage.SHARED:
- logging.warning("Cannot link the runtime statically to a dynamic library, going to link dynamically")
+ logging.warning(
+ "Cannot link the runtime statically to a dynamic library, going to link dynamically"
+ )
runtime_link = Linkage.SHARED
elif on_linux_like():
- logging.warning("Cannot link to the GNU C Library or BSD libc (which are assumed) statically, going to link dynamically")
+ logging.warning(
+ "Cannot link to the GNU C Library or BSD libc (which are assumed) statically, going to link dynamically"
+ )
runtime_link = Linkage.SHARED
return link, runtime_link
diff --git a/project/platform.py b/project/platform.py
index fa0a7d3..39ec91b 100644
--- a/project/platform.py
+++ b/project/platform.py
@@ -68,7 +68,9 @@ class Platform(Enum):
# On Windows, use the host architecture.
return Platform.windows_native().address_model()
# On Linux, assume that the target is x64.
- raise RuntimeError('cannot determine address model unless the target platform is specified explicitly')
+ raise RuntimeError(
+ 'cannot determine address model unless the target platform is specified explicitly'
+ )
if self is Platform.X86:
return 32
if self is Platform.X64:
@@ -129,7 +131,9 @@ set(CMAKE_CXX_FLAGS -m{address_model})
return Platform.windows_native().msvc_arch()
# I don't think the -A argument is supported on any generators
# except the Visual Studio ones.
- raise RuntimeError('-A parameter is only supported for Visual Studio generators')
+ raise RuntimeError(
+ '-A parameter is only supported for Visual Studio generators'
+ )
if self is Platform.X86:
return 'Win32'
if self is Platform.X64:
diff --git a/project/toolset.py b/project/toolset.py
index 2a9d797..3c90f9b 100644
--- a/project/toolset.py
+++ b/project/toolset.py
@@ -80,7 +80,9 @@ class MSVCVersion(Enum):
try:
numeric = int(self.value)
except ValueError as e:
- raise RuntimeError(f'what? MSVC versions are supposed to be integers: {self.value}') from e
+ raise RuntimeError(
+ f'what? MSVC versions are supposed to be integers: {self.value}'
+ ) from e
numeric = Decimal(numeric) / 10
numeric = numeric.quantize(Decimal('1.0'))
return str(numeric)
@@ -113,7 +115,9 @@ class VisualStudioVersion(Enum):
try:
return VisualStudioVersion(s)
except ValueError as e:
- raise argparse.ArgumentTypeError(f'invalid Visual Studio version: {s}') from e
+ raise argparse.ArgumentTypeError(
+ f'invalid Visual Studio version: {s}'
+ ) from e
@staticmethod
def all():
@@ -138,9 +142,7 @@ _msvc_to_vs_version = {
MSVCVersion.VS2022: VisualStudioVersion.VS2022,
MSVCVersion.VS2026: VisualStudioVersion.VS2026,
}
-_vs_to_msvc_version = {
- v: k for k, v in _msvc_to_vs_version.items()
-}
+_vs_to_msvc_version = {v: k for k, v in _msvc_to_vs_version.items()}
class ToolsetType(Enum):
@@ -253,7 +255,13 @@ class ToolsetVersion:
a list of all supported toolset versions:
'''
- max_name = max((len(str(hint) + str(version)) for hint in ToolsetType.all_versioned() for version in hint.all_versions()))
+ max_name = max(
+ (
+ len(str(hint) + str(version))
+ for hint in ToolsetType.all_versioned()
+ for version in hint.all_versions()
+ )
+ )
for hint in ToolsetType.all_versioned():
for version in hint.all_versions():
name = f'{hint}{version}'
@@ -270,7 +278,7 @@ a list of all supported toolset versions:
for hint in sorted(ToolsetType.all_versioned(), key=str, reverse=True):
prefix = f'{hint}'
if s.startswith(prefix):
- return ToolsetVersion(hint, hint.parse_version(s[len(prefix):]))
+ return ToolsetVersion(hint, hint.parse_version(s[len(prefix) :]))
raise argparse.ArgumentTypeError(f'invalid toolset: {s}')
@@ -307,7 +315,10 @@ class Toolset(abc.ABC):
def detect(version):
if version.hint is ToolsetType.AUTO:
return Auto
- if version.hint is ToolsetType.MSVC or version.hint is ToolsetType.VISUAL_STUDIO:
+ if (
+ version.hint is ToolsetType.MSVC
+ or version.hint is ToolsetType.VISUAL_STUDIO
+ ):
return MSVC
if version.hint is ToolsetType.GCC:
return GCC
@@ -560,7 +571,6 @@ class Clang(BoostCustom, CMakeCustom):
options = GCC.b2_build_options()
options += [
('cxxflags', '-DBOOST_USE_WINDOWS_H'),
-
# Even with <warnings>off, the build might sometimes fail with the
# following error:
#
diff --git a/project/utils.py b/project/utils.py
index b96250c..08afef5 100644
--- a/project/utils.py
+++ b/project/utils.py
@@ -52,7 +52,8 @@ def setup_logging():
level=logging.INFO,
# Log to stdout, because that's where subprocess's output goes (so that
# they don't get interleaved).
- stream=sys.stdout)
+ stream=sys.stdout,
+ )
try:
yield
except Exception as e:
@@ -126,5 +127,7 @@ def retry(exc_type, timeout=5, tries=3, backoff=2):
current_timeout *= backoff
continue
raise
+
return func2
+
return wrapper
diff --git a/project/version.py b/project/version.py
index a860fbf..41b36ad 100644
--- a/project/version.py
+++ b/project/version.py
@@ -11,5 +11,6 @@ except:
def add_to_arg_parser(parser):
- parser.add_argument('--version', '-V', action='version',
- version=f'%(prog)s {__version__}')
+ parser.add_argument(
+ '--version', '-V', action='version', version=f'%(prog)s {__version__}'
+ )