diff options
author | Zac Medico <zmedico@gentoo.org> | 2019-07-12 22:00:33 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2019-07-12 22:09:20 -0700 |
commit | 95ba3ca5e8db2a6b360e4abdcee026076652551d (patch) | |
tree | f9e2b99659c671a9ed0a0bf0e4d1515f3cc13214 /mirrorselect/selectors.py | |
parent | Update version for 2.2.5 release (diff) | |
download | mirrorselect-95ba3ca5e8db2a6b360e4abdcee026076652551d.tar.gz mirrorselect-95ba3ca5e8db2a6b360e4abdcee026076652551d.tar.bz2 mirrorselect-95ba3ca5e8db2a6b360e4abdcee026076652551d.zip |
netselect: make netselect ipv6 support optional
Since netselect with ipv6 support does not work on a system where
ipv6 is disabled, use a NETSELECT_SUPPORTS_IPV4_IPV6 variable to
optionally enable the use of netselect -4/-6 options. The ebuild
will use sed to set NETSELECT_SUPPORTS_IPV4_IPV6 = True when
USE=ipv6 is enabled, and will have a dependency like
RDEPEND=">=net-analyzer/netselect-0.4[ipv6(+)?]".
Bug: https://bugs.gentoo.org/688214
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'mirrorselect/selectors.py')
-rw-r--r-- | mirrorselect/selectors.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mirrorselect/selectors.py b/mirrorselect/selectors.py index e3f718c..4564f11 100644 --- a/mirrorselect/selectors.py +++ b/mirrorselect/selectors.py @@ -61,6 +61,11 @@ else: from mirrorselect.output import encoder, get_encoding, decode_selection +# The netselect --ipv4 and --ipv6 options are supported only +# with >=net-analyzer/netselect-0.4[ipv6(+)]. +NETSELECT_SUPPORTS_IPV4_IPV6 = False + + class Shallow(object): """handles rapid server selection via netselect""" @@ -96,10 +101,12 @@ class Shallow(object): host_string = ' '.join(hosts) cmd = ['netselect', '-s%d' % (number,)] - if self._options.ipv4: - cmd.append('-4') - elif self._options.ipv6: - cmd.append('-6') + + if NETSELECT_SUPPORTS_IPV4_IPV6: + if self._options.ipv4: + cmd.append('-4') + elif self._options.ipv6: + cmd.append('-6') cmd.extend(hosts) |