mirror of https://github.com/apache/lucene.git
fixup some python3 issues
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1369223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bc0a8e69d8
commit
e76a86110b
|
@ -112,7 +112,7 @@ def getHREFs(urlString):
|
||||||
break
|
break
|
||||||
|
|
||||||
links = []
|
links = []
|
||||||
for subUrl, text in reHREF.findall(urllib.request.urlopen(urlString).read()):
|
for subUrl, text in reHREF.findall(urllib.request.urlopen(urlString).read().decode('UTF-8')):
|
||||||
fullURL = urllib.parse.urljoin(urlString, subUrl)
|
fullURL = urllib.parse.urljoin(urlString, subUrl)
|
||||||
links.append((text, fullURL))
|
links.append((text, fullURL))
|
||||||
return links
|
return links
|
||||||
|
@ -144,7 +144,7 @@ def download(name, urlString, tmpDir, quiet=False):
|
||||||
print(' %.1f MB' % (os.path.getsize(fileName)/1024./1024.))
|
print(' %.1f MB' % (os.path.getsize(fileName)/1024./1024.))
|
||||||
|
|
||||||
def load(urlString):
|
def load(urlString):
|
||||||
return urllib.request.urlopen(urlString).read()
|
return urllib.request.urlopen(urlString).read().decode('utf-8')
|
||||||
|
|
||||||
def checkSigs(project, urlString, version, tmpDir, isSigned):
|
def checkSigs(project, urlString, version, tmpDir, isSigned):
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ def checkSigs(project, urlString, version, tmpDir, isSigned):
|
||||||
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
||||||
logFile)
|
logFile)
|
||||||
# Forward any GPG warnings, except the expected one (since its a clean world)
|
# Forward any GPG warnings, except the expected one (since its a clean world)
|
||||||
f = open(logFile, 'rb')
|
f = open(logFile, encoding='UTF-8')
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.lower().find('warning') != -1 \
|
if line.lower().find('warning') != -1 \
|
||||||
and line.find('WARNING: This key is not certified with a trusted signature') == -1:
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1:
|
||||||
|
@ -260,7 +260,7 @@ def checkSigs(project, urlString, version, tmpDir, isSigned):
|
||||||
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
||||||
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
||||||
# Forward any GPG warnings:
|
# Forward any GPG warnings:
|
||||||
f = open(logFile, 'rb')
|
f = open(logFile, encoding='UTF-8')
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.lower().find('warning') != -1:
|
if line.lower().find('warning') != -1:
|
||||||
print(' GPG: %s' % line.strip())
|
print(' GPG: %s' % line.strip())
|
||||||
|
@ -287,7 +287,7 @@ def testChangesText(dir, version, project):
|
||||||
if 'CHANGES.txt' in files:
|
if 'CHANGES.txt' in files:
|
||||||
fullPath = '%s/CHANGES.txt' % root
|
fullPath = '%s/CHANGES.txt' % root
|
||||||
#print 'CHECK %s' % fullPath
|
#print 'CHECK %s' % fullPath
|
||||||
checkChangesContent(open(fullPath).read(), version, fullPath, project, False)
|
checkChangesContent(open(fullPath, encoding='UTF-8').read(), version, fullPath, project, False)
|
||||||
|
|
||||||
def checkChangesContent(s, version, name, project, isHTML):
|
def checkChangesContent(s, version, name, project, isHTML):
|
||||||
|
|
||||||
|
@ -347,10 +347,10 @@ def verifyDigests(artifact, urlString, tmpDir):
|
||||||
|
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
s = hashlib.sha1()
|
s = hashlib.sha1()
|
||||||
f = open('%s/%s' % (tmpDir, artifact))
|
f = open('%s/%s' % (tmpDir, artifact), 'rb')
|
||||||
while True:
|
while True:
|
||||||
x = f.read(65536)
|
x = f.read(65536)
|
||||||
if x == '':
|
if len(x) == 0:
|
||||||
break
|
break
|
||||||
m.update(x)
|
m.update(x)
|
||||||
s.update(x)
|
s.update(x)
|
||||||
|
@ -526,8 +526,8 @@ def verifyUnpacked(project, artifact, unpackPath, version, tmpDir):
|
||||||
checkJavadocpath('%s/docs' % unpackPath)
|
checkJavadocpath('%s/docs' % unpackPath)
|
||||||
|
|
||||||
def testNotice(unpackPath):
|
def testNotice(unpackPath):
|
||||||
solrNotice = open('%s/NOTICE.txt' % unpackPath).read()
|
solrNotice = open('%s/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
||||||
luceneNotice = open('%s/lucene/NOTICE.txt' % unpackPath).read()
|
luceneNotice = open('%s/lucene/NOTICE.txt' % unpackPath, encoding='UTF-8').read()
|
||||||
|
|
||||||
expected = """
|
expected = """
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
@ -580,7 +580,7 @@ def testSolrExample(unpackPath, javaPath, isSrc):
|
||||||
print(' index example docs...')
|
print(' index example docs...')
|
||||||
run('sh ./exampledocs/post.sh ./exampledocs/*.xml', 'post-example-docs.log')
|
run('sh ./exampledocs/post.sh ./exampledocs/*.xml', 'post-example-docs.log')
|
||||||
print(' run query...')
|
print(' run query...')
|
||||||
s = urllib.request.urlopen('http://localhost:8983/solr/select/?q=video').read()
|
s = urllib.request.urlopen('http://localhost:8983/solr/select/?q=video').read().decode('UTF-8')
|
||||||
if s.find('<result name="response" numFound="3" start="0">') == -1:
|
if s.find('<result name="response" numFound="3" start="0">') == -1:
|
||||||
print('FAILED: response is:\n%s' % s)
|
print('FAILED: response is:\n%s' % s)
|
||||||
raise RuntimeError('query on solr example instance failed')
|
raise RuntimeError('query on solr example instance failed')
|
||||||
|
@ -632,7 +632,7 @@ def testDemo(isSrc, version):
|
||||||
run('%s; java -cp "%s" org.apache.lucene.demo.IndexFiles -index index -docs %s' % (javaExe('1.6'), cp, docsDir), 'index.log')
|
run('%s; java -cp "%s" org.apache.lucene.demo.IndexFiles -index index -docs %s' % (javaExe('1.6'), cp, docsDir), 'index.log')
|
||||||
run('%s; java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % (javaExe('1.6'), cp), 'search.log')
|
run('%s; java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % (javaExe('1.6'), cp), 'search.log')
|
||||||
reMatchingDocs = re.compile('(\d+) total matching documents')
|
reMatchingDocs = re.compile('(\d+) total matching documents')
|
||||||
m = reMatchingDocs.search(open('search.log', 'rb').read())
|
m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read())
|
||||||
if m is None:
|
if m is None:
|
||||||
raise RuntimeError('lucene demo\'s SearchFiles found no results')
|
raise RuntimeError('lucene demo\'s SearchFiles found no results')
|
||||||
else:
|
else:
|
||||||
|
@ -772,13 +772,13 @@ def verifyMavenDigests(artifacts):
|
||||||
raise RuntimeError('missing: MD5 digest for %s' % artifactFile)
|
raise RuntimeError('missing: MD5 digest for %s' % artifactFile)
|
||||||
if artifactFile + '.sha1' not in artifacts[project]:
|
if artifactFile + '.sha1' not in artifacts[project]:
|
||||||
raise RuntimeError('missing: SHA1 digest for %s' % artifactFile)
|
raise RuntimeError('missing: SHA1 digest for %s' % artifactFile)
|
||||||
with open(artifactFile + '.md5', 'r') as md5File:
|
with open(artifactFile + '.md5', encoding='UTF-8') as md5File:
|
||||||
md5Expected = md5File.read().strip()
|
md5Expected = md5File.read().strip()
|
||||||
with open(artifactFile + '.sha1', 'r') as sha1File:
|
with open(artifactFile + '.sha1', encoding='UTF-8') as sha1File:
|
||||||
sha1Expected = sha1File.read().strip()
|
sha1Expected = sha1File.read().strip()
|
||||||
md5 = hashlib.md5()
|
md5 = hashlib.md5()
|
||||||
sha1 = hashlib.sha1()
|
sha1 = hashlib.sha1()
|
||||||
inputFile = open(artifactFile)
|
inputFile = open(artifactFile, 'rb')
|
||||||
while True:
|
while True:
|
||||||
bytes = inputFile.read(65536)
|
bytes = inputFile.read(65536)
|
||||||
if bytes == '': break
|
if bytes == '': break
|
||||||
|
@ -846,7 +846,7 @@ def checkNonMavenizedDeps(nonMavenizedDependencies, POMtemplates, artifacts,
|
||||||
if releaseBranchSvnURL is None:
|
if releaseBranchSvnURL is None:
|
||||||
pomPath = '%s/%s/%s' % (workingCopy, pomDir, pomFile)
|
pomPath = '%s/%s/%s' % (workingCopy, pomDir, pomFile)
|
||||||
if os.path.exists(pomPath):
|
if os.path.exists(pomPath):
|
||||||
doc2 = ET.XML(open(pomPath).read())
|
doc2 = ET.XML(open(pomPath, encoding='UTF-8').read())
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
entries = getDirEntries('%s/%s' % (releaseBranchSvnURL, pomDir))
|
entries = getDirEntries('%s/%s' % (releaseBranchSvnURL, pomDir))
|
||||||
|
@ -904,7 +904,7 @@ def verifyMavenSigs(baseURL, tmpDir, artifacts):
|
||||||
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
run('gpg --homedir %s --verify %s %s' % (gpgHomeDir, sigFile, artifactFile),
|
||||||
logFile)
|
logFile)
|
||||||
# Forward any GPG warnings, except the expected one (since its a clean world)
|
# Forward any GPG warnings, except the expected one (since its a clean world)
|
||||||
f = open(logFile, 'rb')
|
f = open(logFile, encoding='UTF-8')
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.lower().find('warning') != -1 \
|
if line.lower().find('warning') != -1 \
|
||||||
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
||||||
|
@ -918,7 +918,7 @@ def verifyMavenSigs(baseURL, tmpDir, artifacts):
|
||||||
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
logFile = '%s/%s.%s.gpg.trust.log' % (tmpDir, project, artifact)
|
||||||
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
run('gpg --verify %s %s' % (sigFile, artifactFile), logFile)
|
||||||
# Forward any GPG warnings:
|
# Forward any GPG warnings:
|
||||||
f = open(logFile, 'rb')
|
f = open(logFile, encoding='UTF-8')
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.lower().find('warning') != -1 \
|
if line.lower().find('warning') != -1 \
|
||||||
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
and line.find('WARNING: This key is not certified with a trusted signature') == -1 \
|
||||||
|
|
Loading…
Reference in New Issue