From 2eee1c4e1cb1a2bcf9f961dcf4f27630de8a5db0 Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Nov 28 2019 14:20:05 +0000 Subject: Line up descriptions for better code readability Signed-off-by: Ondrej Nosek --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index bcacca1..0284aaa 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -448,7 +448,7 @@ class Commands(object): raise rpkgError('Repo in inconsistent state: %s' % e) try: merge = self.repo.git.config('--get', 'branch.%s.merge' % localbranch) - except git.GitCommandError as e: + except git.GitCommandError: raise rpkgError('Unable to find remote branch. Use --release') # Trim off the refs/heads so that we're just working with # the branch name @@ -488,11 +488,11 @@ class Commands(object): """Find the pushurl or url of remote of branch we're on.""" try: url = self.repo.git.remote('get-url', '--push', self.branch_remote) - except git.GitCommandError as e: + except git.GitCommandError: try: url = self.repo.git.config( '--get', 'remote.%s.pushurl' % self.branch_remote) - except git.GitCommandError as e: + except git.GitCommandError: try: url = self.repo.git.config( '--get', 'remote.%s.url' % self.branch_remote) @@ -1600,7 +1600,7 @@ class Commands(object): # Create a bare clone first. This gives us a good list of branches try: self.clone(repo, top_path, bare_dir=repo_path, anon=anon, depth=depth) - except Exception as e: + except Exception: # Clean out our directory shutil.rmtree(top_path) raise diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index eb17284..c3f2827 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -20,6 +20,7 @@ import logging import os import re import sys +import textwrap from gettext import gettext as _ # For `_ArgumentParser' import requests @@ -577,24 +578,25 @@ class cliClient(object): 'chain-build', parents=[self.build_parser_common], help='Build current package in order with other packages', formatter_class=argparse.RawDescriptionHelpFormatter, - description=""" -Build current package in order with other packages. + description=textwrap.dedent(""" + Build current package in order with other packages. -example: %(name)s chain-build libwidget libgizmo + example: %(name)s chain-build libwidget libgizmo -The current package is added to the end of the CHAIN list. -Colons (:) can be used in the CHAIN parameter to define groups of -packages. Packages in any single group will be built in parallel -and all packages in a group must build successfully and populate -the repository before the next group will begin building. + The current package is added to the end of the CHAIN list. + Colons (:) can be used in the CHAIN parameter to define groups of + packages. Packages in any single group will be built in parallel + and all packages in a group must build successfully and populate + the repository before the next group will begin building. -For example: + For example: -%(name)s chain-build libwidget libaselib : libgizmo : + %(name)s chain-build libwidget libaselib : libgizmo : -will cause libwidget and libaselib to be built in parallel, followed -by libgizmo and then the current directory package. If no groups are -defined, packages will be built sequentially.""" % {'name': self.name}) + will cause libwidget and libaselib to be built in parallel, followed + by libgizmo and then the current directory package. If no groups are + defined, packages will be built sequentially. + """ % {'name': self.name})) chainbuild_parser.add_argument( 'package', nargs='+', help='List the packages and order you want to build in') @@ -1411,12 +1413,12 @@ defined, packages will be built sequentially.""" % {'name': self.name}) copr_parser = self.subparsers.add_parser( 'copr-build', help='Build package in Copr', formatter_class=argparse.RawDescriptionHelpFormatter, - description=""" -Build package in Copr. + description=textwrap.dedent(""" + Build package in Copr. -Note: you need to have set up correct api key. For more information -see API KEY section of copr-cli(1) man page. -""") + Note: you need to have set up correct api key. For more information + see API KEY section of copr-cli(1) man page. + """)) copr_parser.add_argument( '--config', required=False,