1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-05 15:13:39 +02:00

Merge pull request #1544 from dmach/build-noclean

Document '--buildtool-opt=--noclean' example in 'build' command's help
This commit is contained in:
2024-04-22 13:57:34 +02:00
committed by GitHub
2 changed files with 22 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ A modern, lightweight alternative to cmdln.py from https://github.com/trentm/cmd
import argparse
import inspect
import sys
import textwrap
def option(*args, **kwargs):
@@ -78,6 +79,19 @@ def hide(value=True):
class HelpFormatter(argparse.RawDescriptionHelpFormatter):
def _split_lines(self, text, width):
# remove the leading and trailing whitespaces to avoid printing unwanted blank lines
text = text.strip()
result = []
for line in text.splitlines():
if not line.strip():
# textwrap normally returns [] on a string that contains only whitespaces; we want [""] to print a blank line
result.append("")
else:
result.extend(textwrap.wrap(line, width))
return result
def _format_action(self, action):
if isinstance(action, argparse._SubParsersAction):
parts = []

View File

@@ -7172,7 +7172,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('--build-opt', metavar='OPT', action='append',
help='pass option OPT to the build command')
@cmdln.option('--buildtool-opt', metavar='OPT', action='append',
help='pass option OPT to the build tool command (rpmbuild)')
help=textwrap.dedent(
"""
pass option OPT to the build tool command (rpmbuild), for example:
* don't clean build environment after a successful build:
--buildtool-opt=--noclean
"""
),
)
@cmdln.option('--userootforbuild', '--login-as-root', action='store_true',
help='Run build or shell as root. The default is to build as '
'unprivileged user. Note that a line "# norootforbuild" '