From: Thanh Ha Date: Fri, 10 Mar 2017 19:32:25 +0000 (-0500) Subject: Use PEP8Bear X-Git-Tag: v0.0.8~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=5204e9417147ebc43ddc1e58e6e864110e082141;p=releng%2Flftools.git Use PEP8Bear Looks like we forgot to configure the PEP8Bear. PEP8Bear also handles space consistency so let's leave that job to PEP8Bear for Python files instead. Change-Id: I7f582a2202a33d7f8ea0d737befecde9f1842805 Signed-off-by: Thanh Ha --- diff --git a/.coafile b/.coafile index 5406fa94..17c66085 100644 --- a/.coafile +++ b/.coafile @@ -8,15 +8,14 @@ ignore_length_regex = Signed-off-by, [Python] bears = BanditBear, + PEP8Bear, PyCommentedCodeBear, PyDocStyleBear, PyFlakesBear, - PyImportSortBear, - SpaceConsistencyBear + PyImportSortBear files = lftools/**/*.py pydocstyle_ignore = D203, D213, D301 -indent_size = 4 -use_spaces = yeah +max_line_length = 120 [Shell] bears = ShellCheckBear, @@ -25,4 +24,3 @@ files = shell/* shell = bash indent_size = 4 use_spaces = yeah - diff --git a/lftools/cli/nexus.py b/lftools/cli/nexus.py index 696e0855..dcbfe70f 100644 --- a/lftools/cli/nexus.py +++ b/lftools/cli/nexus.py @@ -30,6 +30,7 @@ def reorder_staged_repos(ctx, settings): """ nexuscmd.reorder_staged_repos(settings) + nexus.add_command(reorder_staged_repos) @@ -41,9 +42,11 @@ def create(ctx): @create.command() -@click.option('-c', '--config', type=str, required=True, +@click.option( + '-c', '--config', type=str, required=True, help='Repo config file for how to the Nexus repository should be created.') -@click.option('-s', '--settings', type=str, required=True, +@click.option( + '-s', '--settings', type=str, required=True, help='Config file containing administrative settings.') @click.pass_context def repo(ctx, config, settings): diff --git a/lftools/cli/version.py b/lftools/cli/version.py index 13aeb3a2..f70d3723 100644 --- a/lftools/cli/version.py +++ b/lftools/cli/version.py @@ -51,6 +51,7 @@ def version(ctx): """ pass + @click.command() @click.argument('release-tag') @click.pass_context @@ -83,7 +84,8 @@ def release(ctx, release_tag): @click.command() @click.argument('release-tag') @click.argument('patch-dir') -@click.option('--project', default='OpenDaylight', +@click.option( + '--project', default='OpenDaylight', help='Project name to use when tagging. (Default: OpenDaylight)') @click.pass_context def patch(ctx, release_tag, patch_dir, project): diff --git a/lftools/nexus/__init__.py b/lftools/nexus/__init__.py index 5df9c06e..16519ebf 100644 --- a/lftools/nexus/__init__.py +++ b/lftools/nexus/__init__.py @@ -99,7 +99,7 @@ class Nexus: delete update """ - url = '/'.join([self.baseurl,'service/local/privileges_target']) + url = '/'.join([self.baseurl, 'service/local/privileges_target']) privileges = { 'data': { diff --git a/lftools/nexus/cmd.py b/lftools/nexus/cmd.py index ed1f5644..c92983b5 100644 --- a/lftools/nexus/cmd.py +++ b/lftools/nexus/cmd.py @@ -22,7 +22,8 @@ def reorder_staged_repos(settings_file): to be in the correct reverse sorted order. There is a problem with Nexus where it is not doing this like it should be. """ - with open(settings_file, 'r') as f: settings = yaml.safe_load(f) + with open(settings_file, 'r') as f: + settings = yaml.safe_load(f) for setting in ['nexus', 'user', 'password']: if not setting in settings: @@ -59,8 +60,10 @@ def create_repos(config_file, settings_file): :arg str settings: Settings file containing administrative credentials and information. """ - with open(config_file, 'r') as f: config = yaml.safe_load(f) - with open(settings_file, 'r') as f: settings = yaml.safe_load(f) + with open(config_file, 'r') as f: + config = yaml.safe_load(f) + with open(settings_file, 'r') as f: + settings = yaml.safe_load(f) for setting in ['nexus', 'user', 'password', 'email_domain']: if not setting in settings: @@ -106,16 +109,26 @@ def create_repos(config_file, settings_file): print('Building for %s.%s' % (base_groupId, repo)) groupId = '%s.%s' % (base_groupId, repo) target = '^/%s/.*' % groupId.replace('.', '[/\.]') + if 'extra_privs' in config: extra_privs = config['extra_privs'] else: extra_privs = [] - create_nexus_perms(repoId, [target], settings['email_domain'], - config['password'], extra_privs) + + create_nexus_perms( + repoId, + [target], + settings['email_domain'], + config['password'], + extra_privs) + if 'repositories' in config: for sub_repo in config['repositories']: sub_repo_id = '%s-%s' % (repoId, sub_repo) - build_repo(sub_repo, sub_repo_id, config['repositories'][sub_repo], + build_repo( + sub_repo, + sub_repo_id, + config['repositories'][sub_repo], groupId) for repo in config['repositories']: