All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vit Mojzis <vmojzis@redhat.com>
To: Petr Lautrbach <lautrbach@redhat.com>, selinux@vger.kernel.org
Subject: Re: [PATCH 2/4] python/semanage: Drop hard formating from localized strings
Date: Tue, 6 Jun 2023 17:20:39 +0200	[thread overview]
Message-ID: <69d6f186-bdd7-32f0-8be1-340782fd1cee@redhat.com> (raw)
In-Reply-To: <20230517134934.709059-2-lautrbach@redhat.com>

On 5/17/23 15:49, Petr Lautrbach wrote:
> It confuses translators and new lines are dropped by parser module anyway.
> 
> Signed-off-by: Petr Lautrbach <lautrbach@redhat.com>
> ---
>   python/audit2allow/audit2allow | 14 ++++++++---
>   python/semanage/semanage       | 44 +++++++++++++---------------------
>   2 files changed, 28 insertions(+), 30 deletions(-)
> 
> diff --git a/python/audit2allow/audit2allow b/python/audit2allow/audit2allow
> index 5587a2dbb006..35b0b151ac86 100644
> --- a/python/audit2allow/audit2allow
> +++ b/python/audit2allow/audit2allow
> @@ -234,9 +234,17 @@ class AuditToPolicy:
>               print(e)
>               sys.exit(1)
>   
> -        sys.stdout.write(_("******************** IMPORTANT ***********************\n"))
> -        sys.stdout.write((_("To make this policy package active, execute:" +
> -                            "\n\nsemodule -i %s\n\n") % packagename))
> +        sys.stdout.write(
> +"""******************** {important} ***********************
> +{text}
> +
> +semodule -i {packagename}
> +
> +""".format(
> +    important=_("IMPORTANT"),
> +    text=_("To make this policy package active, execute:"),
> +    packagename=packagename
> +))
>   
>       def __output_audit2why(self):
>           import selinux
> diff --git a/python/semanage/semanage b/python/semanage/semanage
> index e0bd98a95c77..898df4b93c10 100644
> --- a/python/semanage/semanage
> +++ b/python/semanage/semanage
> @@ -238,30 +238,22 @@ def parser_add_level(parser, name):
>   
>   
>   def parser_add_range(parser, name):
> -    parser.add_argument('-r', '--range', default='',
> -                        help=_('''
> -MLS/MCS Security Range (MLS/MCS Systems only)
> -SELinux Range  for SELinux login mapping
> -defaults to the SELinux user record range.
> -SELinux Range for SELinux user defaults to s0.
> -'''))
> +    parser.add_argument('-r', '--range', default='', help=_(
> +        "MLS/MCS Security Range (MLS/MCS Systems only) SELinux Range for SELinux login mapping defaults to the SELinux user record range. \
> +SELinux Range for SELinux user defaults to s0."
> +    ))
>   
>   
>   def parser_add_proto(parser, name):
> -    parser.add_argument('-p', '--proto', help=_('''
> -    Protocol  for  the specified port (tcp|udp|dccp|sctp) or internet protocol
> -    version for the specified node (ipv4|ipv6).
> -'''))
> +    parser.add_argument('-p', '--proto', help=_(
> +        "Protocol for the specified port (tcp|udp|dccp|sctp) or internet protocol version for the specified node (ipv4|ipv6)."
> +    ))
>   
>   def parser_add_subnet_prefix(parser, name):
> -    parser.add_argument('-x', '--subnet_prefix', help=_('''
> -    Subnet prefix for  the specified infiniband ibpkey.
> -'''))
> +    parser.add_argument('-x', '--subnet_prefix', help=_('Subnet prefix for  the specified infiniband ibpkey.'))
>   
>   def parser_add_ibdev_name(parser, name):
> -    parser.add_argument('-z', '--ibdev_name', help=_('''
> -    Name for the specified infiniband end port.
> -'''))
> +    parser.add_argument('-z', '--ibdev_name', help=_("Name for the specified infiniband end port."))
>   
>   def parser_add_modify(parser, name):
>       parser.add_argument('-m', '--modify', dest='action', action='store_const', const='modify', help=_("Modify a record of the %s object type") % name)
> @@ -372,10 +364,10 @@ If you do not specify a file type, the file type will default to "all files".
>       parser_add_extract(fcontext_action, "fcontext")
>       parser_add_deleteall(fcontext_action, "fcontext")
>   
> -    fcontextParser.add_argument('-e', '--equal', help=_('''Substitute  target  path with sourcepath when generating default
> -                                                                  label.  This is used with fcontext. Requires source  and  target
> -                                                                  path  arguments.  The context labeling for the target subtree is
> -                                                                  made equivalent to that defined for the source.'''))
> +    fcontextParser.add_argument('-e', '--equal', help=_(
> +        "Substitute target path with sourcepath when generating default label. This is used with fcontext. Requires source and target \
> +path arguments. The context labeling for the target subtree is made equivalent to that defined for the source."
> +    ))
>       fcontextParser.add_argument('-f', '--ftype', default="", choices=["a", "f", "d", "c", "b", "s", "l", "p"], help=_(ftype_help))
>       parser_add_seuser(fcontextParser, "fcontext")
>       parser_add_type(fcontextParser, "fcontext")
> @@ -426,9 +418,7 @@ def setupUserParser(subparsers):
>       parser_add_range(userParser, "user")
>       userParser.add_argument('-R', '--roles', default=[],
>                               action=CheckRole,
> -                            help=_('''
> -SELinux Roles.  You must enclose multiple roles within quotes, separate by spaces. Or specify -R multiple times.
> -'''))
> +                            help=_("SELinux Roles. You must enclose multiple roles within quotes, separate by spaces. Or specify -R multiple times."))
>       userParser.add_argument('-P', '--prefix', default="user", help=argparse.SUPPRESS)
>       userParser.add_argument('selinux_name', nargs='?', default=None, help=_('selinux_name'))
>       userParser.set_defaults(func=handleUser)
> @@ -901,9 +891,9 @@ def setupImportParser(subparsers):
>   def createCommandParser():
>       commandParser = seParser(prog='semanage',
>                                formatter_class=argparse.ArgumentDefaultsHelpFormatter,
> -                             description='''semanage is used to configure certain elements
> -                                                            of SELinux policy with-out requiring modification
> -                                                            to or recompilation from policy source.''')
> +                             description=_(
> +            "semanage is used to configure certain elements of SELinux policy with-out requiring modification or recompilation from policy source."
> +                             ))
>   
>       #To add a new subcommand define the parser for it in a function above and call it here.
>       subparsers = commandParser.add_subparsers(dest='subcommand')


python/semanage/semanage 343: ftype_help = '''
could also use some improvements (multiple double/triple spaces and 
missing spaces after commas).

Nitpick: The patch header says "python/semanage", but the patch also 
touches python/audit2allow.

Otherwise LGTM.

Vit


  reply	other threads:[~2023-06-06 15:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 13:49 [PATCH 1/4] python: improve format strings for proper localization Petr Lautrbach
2023-05-17 13:49 ` [PATCH 2/4] python/semanage: Drop hard formating from localized strings Petr Lautrbach
2023-06-06 15:20   ` Vit Mojzis [this message]
2023-05-17 13:49 ` [PATCH 3/4] semanage: Drop unnecessary import from seobject Petr Lautrbach
2023-05-17 13:49 ` [PATCH 4/4] python: update python.pot Petr Lautrbach
2023-06-06 15:20 ` [PATCH 1/4] python: improve format strings for proper localization Vit Mojzis
2023-06-12 16:21   ` Petr Lautrbach
2023-06-12 16:21     ` [PATCH v2 1/4] python: improve format strings for proper localization Petr Lautrbach
2023-06-13  9:30       ` Vit Mojzis
2023-06-12 16:21     ` [PATCH v2 2/4] python: Drop hard formating from localized strings Petr Lautrbach
2023-06-12 16:21     ` [PATCH v2 3/4] semanage: Drop unnecessary import from seobject Petr Lautrbach
2023-06-12 16:21     ` [PATCH v2 4/4] python: update python.pot Petr Lautrbach
2023-06-13  9:42       ` Petr Lautrbach
2023-06-13  9:42         ` [PATCH v3 1/4] python: improve format strings for proper localization Petr Lautrbach
2023-06-13  9:42         ` [PATCH v3 2/4] python: Drop hard formating from localized strings Petr Lautrbach
2023-06-13  9:42         ` [PATCH v3 3/4] semanage: Drop unnecessary import from seobject Petr Lautrbach
2023-06-13  9:42         ` [PATCH v3 4/4] python: update python.pot Petr Lautrbach
2023-06-13 11:20           ` Petr Lautrbach
2023-06-13 11:20             ` [PATCH v4 1/4] python: improve format strings for proper localization Petr Lautrbach
2023-06-13 11:20             ` [PATCH v4 2/4] python: Drop hard formating from localized strings Petr Lautrbach
2023-06-13 11:20             ` [PATCH v4 3/4] semanage: Drop unnecessary import from seobject Petr Lautrbach
2023-06-13 11:20             ` [PATCH v4 4/4] python: update python.pot Petr Lautrbach
2023-06-13 12:37               ` Vit Mojzis
2023-06-27 13:55                 ` Petr Lautrbach
2023-07-06 13:39                   ` James Carter
2023-07-12 17:33                     ` James Carter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69d6f186-bdd7-32f0-8be1-340782fd1cee@redhat.com \
    --to=vmojzis@redhat.com \
    --cc=lautrbach@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.