diff options
author | 2018-05-26 18:28:53 +0300 | |
---|---|---|
committer | 2018-05-26 08:40:31 -0700 | |
commit | d0f37a2cb9734439c2d69f74c16ffb0489a30280 (patch) | |
tree | 8ddfd36138253f1cfefcf4df57e6d634c74e8794 /mirrorselect | |
parent | main.py: Remove obsolete 'SYNC' option (diff) | |
download | mirrorselect-d0f37a2cb9734439c2d69f74c16ffb0489a30280.tar.gz mirrorselect-d0f37a2cb9734439c2d69f74c16ffb0489a30280.tar.bz2 mirrorselect-d0f37a2cb9734439c2d69f74c16ffb0489a30280.zip |
Mirrorselect: add 'exclude' option to allow excluding hosts from mirrors list.
Diffstat (limited to 'mirrorselect')
-rwxr-xr-x | mirrorselect/main.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mirrorselect/main.py b/mirrorselect/main.py index 04698f3..b49461b 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -243,6 +243,9 @@ class MirrorSelect(object): group.add_option( "-t", "--timeout", action="store", type="int", default="10", help="Timeout for deep mode. Defaults to 10 seconds.") + group.add_option( + "-e", "--exclude", action="append", dest="exclude", + default=None, help="Exclude host from mirrors list.") @@ -302,6 +305,10 @@ class MirrorSelect(object): else: self.output.write("using url: %s\n" % MIRRORS_3_XML, 2) hosts = Extractor(MIRRORS_3_XML, options, self.output).hosts + + if options.exclude: + hosts = [x for x in hosts if x[0] not in options.exclude] + return hosts |