From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 17FA715800D for ; Thu, 6 Jul 2023 08:05:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 45631E0819; Thu, 6 Jul 2023 08:05:42 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 28DE4E0819 for ; Thu, 6 Jul 2023 08:05:42 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CBAF4335CF5 for ; Thu, 6 Jul 2023 08:05:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 22E41AC2 for ; Thu, 6 Jul 2023 08:05:39 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1688630682.e0fbc2fb33762211aa5e64175d525e66f4c257d4.sam@gentoo> Subject: [gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/ X-VCS-Repository: proj/mirrorselect X-VCS-Files: mirrorselect/main.py X-VCS-Directories: mirrorselect/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: e0fbc2fb33762211aa5e64175d525e66f4c257d4 X-VCS-Branch: master Date: Thu, 6 Jul 2023 08:05:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 69a19652-3759-45ae-8614-e51305eedc55 X-Archives-Hash: fb15ec4769bce627b620a9f05c89269a commit: e0fbc2fb33762211aa5e64175d525e66f4c257d4 Author: Sam James gentoo org> AuthorDate: Thu Jul 6 08:04:42 2023 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jul 6 08:04:42 2023 +0000 URL: https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=e0fbc2fb main: Fix --all option parsing Avoid --all erroring out with "ERROR: Choose at most one of -s or -a". Bug: https://bugs.gentoo.org/872218 Fixes: 7caac017833b01e13028658effc502430c56d770 Thanks-to: gmail.com> Signed-off-by: Sam James gentoo.org> mirrorselect/main.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 31f8e7b..7780bb7 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -145,6 +145,11 @@ class MirrorSelect(object): self.output.white(" interactive:"), " # mirrorselect -i -r", )) + + def set_servers(option, opt_str, value, parser): + set_servers.user_configured = True + setattr(parser.values, option.dest, value) + parser = OptionParser( formatter=ColoredFormatter(self.output), description=desc, version='Mirrorselect version: %s' % version) @@ -236,8 +241,8 @@ class MirrorSelect(object): "-q", "--quiet", action="store_const", const=0, dest="verbosity", help="Quiet mode") group.add_option( - "-s", "--servers", action="store", type="int", default=1, - help="Specify Number of servers for Automatic Mode " + "-s", "--servers", action="callback", callback=set_servers, + type="int", default=1, help="Specify Number of servers for Automatic Mode " "to select. this is only valid for download mirrors. " "If this is not specified, a default of 1 is used.") group.add_option( @@ -271,7 +276,7 @@ class MirrorSelect(object): if options.rsync and not (options.interactive or options.all_mirrors): self.output.print_err('rsync servers can only be selected with -i or -a') - if options.servers and options.all_mirrors: + if options.all_mirrors and hasattr(set_servers, 'user_configured'): self.output.print_err('Choose at most one of -s or -a') if options.interactive and (