Skip to content

Commit

Permalink
Bug #52514: Patches the wrong usage of configure through text replace…
Browse files Browse the repository at this point in the history
…ment

  This was done with text replacement, because this is a bug from argparse
  and it was not fixed in the last 12 years. python/cpython#53584
  • Loading branch information
Polyfish0 committed Dec 1, 2022
1 parent 309b4e3 commit aab332d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doc/errata/staging/univention-appcenter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
product: ucs
release: "5.0"
version: [2]
scope: ucs_5.0-0-errata5.0-2
src: univention-appcenter
fix:
desc: |
This update addresses the following issues:
* The help text of `univention-app configure` has been fixed so that the
usage prints the allowed arguments in the correct positional order.
bug: [52514]
6 changes: 6 additions & 0 deletions management/univention-appcenter/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
univention-appcenter (9.0.3-5) unstable; urgency=medium

* Bug #52514: Patches the wrong usage of configure through text replacement

-- Mika Westphal <westphal@univention.de> Thu, 24 Nov 2022 09:27:54 +0100

univention-appcenter (9.0.3-4) unstable; urgency=medium

* Bug #54123: Include gpg_error and file timestamps in SignatureVerificationFailed exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#

from tempfile import NamedTemporaryFile
from argparse import SUPPRESS
from argparse import SUPPRESS, HelpFormatter

from univention.appcenter.actions import UniventionAppAction, StoreAppAction
from univention.appcenter.exceptions import ConfigureFailed
Expand All @@ -52,6 +52,7 @@ class Configure(UniventionAppAction):
help = 'Configure an app'

def setup_parser(self, parser):
parser.formatter_class = PatchedHelpFormatter
parser.add_argument('app', action=StoreAppAction, help='The ID of the App that shall be configured')
parser.add_argument('--list', action='store_true', help='List all configuration options as well as their current values')
parser.add_argument('--set', nargs='+', action=StoreConfigAction, metavar='KEY=VALUE', dest='set_vars', help='Sets the configuration variable. Example: --set some/variable=value some/other/variable="value 2"')
Expand Down Expand Up @@ -135,3 +136,10 @@ def _run_configure_script(self, app, action):
for line in error_file:
self.fatal(line)
return success


class PatchedHelpFormatter(HelpFormatter):
def _format_usage(self, *args, **kwargs):
usage = super(PatchedHelpFormatter, self)._format_usage(*args, **kwargs)

return usage.replace(' app\n\n', ' ').replace('[-h]', '[-h] app').rstrip()

0 comments on commit aab332d

Please sign in to comment.