ppa-dev-tools:set-command

Last commit made on 2022-12-15
Get this branch:
git clone -b set-command 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
Repository:
lp:ppa-dev-tools

Recent commits

b6866c8... by Bryce Harrington

Add ppa set command

The set and create commands will support the same set of 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

84ee88b... by Bryce Harrington

ppa: Introduce add_global_options()

Applies the global options to all commands. This enables the --version,
--quiet, etc. options to work either before or after the command.

It's necessary to add prog=progname arguments to prevent an issue with
--version that makes it print the program and command, i.e.

  $ ppa wait --version
  ppa wait 0.3.0

Instead of the expected

  $ ppa wait --version
  ppa 0.3.0

One side effect is that previously, the actual command being run would
be substituted, e.g. "./scripts/ppa 0.3.0", but now it always prints
just the program name "ppa 0.3.0".

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

092a88c... by Bryce Harrington

ppa: Fix crash when running with no parameters

Running `ppa` with no arguments causes a crash because it attempts to
parse a non-existant ppa_name.

There is no practical use for running ppa without a command (and
ppa_name). Displaying the usage is probably the most useful thing for
the user in this situation.

Fixes: https://bugs.launchpad.net/bugs/1998933

ec30901... by Bryce Harrington

Debian packaging for 0.3.0

e1f1076... by Bryce Harrington

Releasing 0.3.0

5462acf... by Bryce Harrington

RELEASING: Note command to check for dependencies