You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2019/06/05 19:12:02 UTC

[lucene-solr] branch LUCENE-8827-poll-mirrors created (now 974a92e)

This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a change to branch LUCENE-8827-poll-mirrors
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


      at 974a92e  LUCENE-8827: Speed up poll-mirrors.py and add -once argument. Python3 only

This branch includes the following new commits:

     new 974a92e  LUCENE-8827: Speed up poll-mirrors.py and add -once argument. Python3 only

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[lucene-solr] 01/01: LUCENE-8827: Speed up poll-mirrors.py and add -once argument. Python3 only

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch LUCENE-8827-poll-mirrors
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 974a92ea7325ff37e525c0602dee7c88c845c145
Author: Jan Høydahl <ja...@apache.org>
AuthorDate: Wed Jun 5 20:59:38 2019 +0200

    LUCENE-8827: Speed up poll-mirrors.py and add -once argument. Python3 only
---
 dev-tools/scripts/poll-mirrors.py | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/dev-tools/scripts/poll-mirrors.py b/dev-tools/scripts/poll-mirrors.py
index 13c5652..e020c61 100644
--- a/dev-tools/scripts/poll-mirrors.py
+++ b/dev-tools/scripts/poll-mirrors.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 #
 # vim: softtabstop=2 shiftwidth=2 expandtab
 #
@@ -32,20 +32,16 @@ import re
 import sys
 import time
 
-try:
-  from urllib.parse import urlparse
-except:
-  from urlparse import urlparse
+from urllib.parse import urlparse
+from multiprocessing import Pool
+import http.client as http
 
-try:
-  import http.client as http
-except ImportError:
-  import httplib as http
 
 def p(s):
   sys.stdout.write(s)
   sys.stdout.flush()
 
+
 def mirror_contains_file(url):
   url = urlparse(url)
   
@@ -54,6 +50,7 @@ def mirror_contains_file(url):
   elif url.scheme == 'ftp':
     return ftp_file_exists(url)
 
+
 def http_file_exists(url):
   exists = False
 
@@ -68,6 +65,7 @@ def http_file_exists(url):
 
   return exists
 
+
 def ftp_file_exists(url):
   listing = []
   try:
@@ -97,6 +95,7 @@ parser.add_argument('-version', '-v', help='Lucene/Solr version to check')
 parser.add_argument('-path', '-p', help='instead of a versioned release, check for some/explicit/path')
 parser.add_argument('-interval', '-i', help='seconds to wait before re-querying mirrors', type=int, default=300)
 parser.add_argument('-details', '-d', help='print missing mirror URLs', action='store_true', default=False)
+parser.add_argument('-once', '-o', help='run only once', action='store_true', default=False)
 args = parser.parse_args()
 
 if (args.version is None and args.path is None) \
@@ -153,7 +152,7 @@ while True:
     p('\n\n{} is{}downloadable from Maven Central'.format(label, ' ' if maven_available else ' not '))
   p('\n{} is downloadable from {}/{} Apache Mirrors ({:.2f}%)\n'
     .format(label, available_mirrors, total_mirrors, available_mirrors * 100 / total_mirrors))
-  if len(pending_mirrors) == 0:
+  if len(pending_mirrors) == 0 or args.once == True:
     break
 
   if remaining > 0: