ppa-dev-tools:set-command-basic-options

Last commit made on 2022-12-16
Get this branch:
git clone -b set-command-basic-options https://git.launchpad.net/ppa-dev-tools
Only Bryce Harrington can upload to this branch. If you are Bryce Harrington please log in for upload directions.

Branch merges

Branch information

Name:
set-command-basic-options
Repository:
lp:ppa-dev-tools

Recent commits

321446a... by Bryce Harrington

create: Add unit test

I don't think this test case needs to test the team name or ppa address
since those are already adequately covered by test_ppa_group.py. This
test basically just needs to verify the specified command line arguments
were interpreted and applied correctly.

436a47d... by Bryce Harrington

ppa: Add --enable/--disable options

These options control whether packages can be uploaded to the PPA for
building. The option names and descriptions are drawn from Launchpad's
name and description of the same feature for consistency.

fcda15e... by Bryce Harrington

Expand support for setting CPU architectures for PPA

Options --all-architectures and --default-architectures (and abbreviated
forms for convenience) are added for the two most common use cases:
"Give me everything" and "Just the usual", respectively.

Note that ppa create's default behavior corresponds with
--all-architectures, NOT --default-architectures. 'default' here refers
to _Launchpad_'s default behavior, not ppa-dev-tool's. It's felt that
current users of this CLI tool prefer all architectures to be enabled.

However, it's likely there are people who are satisfied with Launchpad's
default, so --default-architectures is added as a straightforward to
understand way of setting things up that way. Note that since all
command line arguments can be specified in the config file, this gives
users an effective way to locally change this default behavior to their
own druthers.

33134ce... by Bryce Harrington

create: Allow settings to be specified at creation time

Commit 3837ef8c states the intent for configuration settings to be
specified either at creation time or after. However that commit only
allowed the name and description. This commit modifies create() so it
can accept arbitrary settings, which are then passed directly to
Launchpad.

428d58f... by Bryce Harrington

test_ppa_group: Drop extraneous description tests

These two tests no longer pass, but they're essentially just cosmetic
tests of description setting. There are no specifications as to how ppa
descriptions should be written, and no special support planned for the
tool around bug numbers.

3837ef8... by Bryce Harrington

Add ppa set command

The set and create commands will support the same set of
configuration settings, so this adds the set command and generalizes
some of the option handling for create to work for both.

For now this supports only the already existing displayname,
description, and architecture settings, but this establishes the
structure we'll slot all the other settings into subsequently.

01d9b53... by Bryce Harrington

ppa: For subparsers, don't add attributes if arg isn't present

Since we're now adding global arguments both at the top level and at the
subparser level, it's possible to cause the default to be set twice -
which can override options set at the top level (before the command)
with the subparser's post-command argument handler. Setting SUPPRESS on
the subparsers prevents this behavior.

Fixes the following failure found by the testsuite:

            # Check -D, --debug
            args = parser.parse_args(['-D', 'status', 'test-ppa'])
    > assert args.debug is True
    E AssertionError: assert False is True
    E + where False = Namespace(command='status', config_filename='~/.config/ppa-dev-tools/config.yml', debug=False, dry_run=False, ppa_name='test-ppa', quiet=False, verbose=False).debug

Note that a default value needs to be provided for --show-urls, else the
following test failure happens:

            # Check --show-urls, --show-url, -L
            args = parser.parse_args([command, 'tests-ppa'])
    > assert args.show_urls is False
    E AttributeError: 'Namespace' object has no attribute 'show_urls'

The --show-urls argument for the tests command uses action='store_true',
which includes automatic functionality to set the default value to the
opposite (False), however it appears that SUPPRESS interferes with this.

4ab433e... by Bryce Harrington

Improve flake/lint

With these changes, pylint rates code 8.28/10.

There is only one remaining flake issue, but I plan to deal with it via
a future refactoring change, so not worrying about it for now.

f487911... by Bryce Harrington

ppa: Remove unused/redundant variables

f9b6cb8... by Bryce Harrington

ppa: Use 'the_ppa' as variable name instead of 'ppa'

Since the module is named 'ppa' already, variables with the same name
will shadow access to it. This gives lint/flake errors like:

    import 'ppa' from line 95 shadowed by loop variable

Fixes: https://bugs.launchpad.net/ppa-dev-tools/+bug/1993741