LUCENE-9230: explicitly call python version we want from builds

On newer linux distros, at least, 'python' now means python3. So
we can't rely on what version of python it will invoke (at least for a
few years).

For example in Fedora Linux:

https://fedoraproject.org/wiki/Changes/Python_means_Python3

For python2.x code, explicitly call 'python2.7' and for python3.x code,
explicitly call 'python3'.

Ant variable names are cleaned up, e.g. 'python.exe' is renamed to
'python2.exe' and 'python32.exe' is renamed to 'python3.exe'. This also
makes it easy to identify remaining python 2.x code that should be
migrated to python 3.x
This commit is contained in:
Robert Muir 2020-02-18 18:58:17 -05:00
parent aa130c4259
commit b9a569e7be
No known key found for this signature in database
GPG Key ID: 817AE1DD322D7ECA
5 changed files with 15 additions and 15 deletions

View File

@ -441,7 +441,7 @@ File | Project Structure | Platform Settings | SDKs):
</condition>
</fail>
<property name="-smokeTestRelease.java12params" value=""/><!-- (if not yet defined) -->
<exec executable="${python32.exe}" failonerror="true" taskname="python32">
<exec executable="${python3.exe}" failonerror="true" taskname="python3">
<arg value="-V"/>
</exec>
<subant target="prepare-release-no-sign" inheritall="false" failonerror="true">
@ -460,7 +460,7 @@ File | Project Structure | Platform Settings | SDKs):
</copy>
<local name="url"/>
<makeurl file="${smokeTestRelease.dir}" validate="false" property="url"/>
<exec executable="${python32.exe}" failonerror="true" taskname="smoker">
<exec executable="${python3.exe}" failonerror="true" taskname="smoker">
<arg value="-u"/>
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>

View File

@ -57,7 +57,7 @@ configure(project(":lucene:core")) {
logger.lifecycle("Executing: ${prog} in ${targetDir}")
project.exec {
workingDir targetDir
executable "python"
executable "python2.7"
args = ['-B', "${prog}"]
}
}
@ -82,7 +82,7 @@ configure(project(":lucene:core")) {
['True', 'False'].each { transpose ->
project.exec {
workingDir targetDir
executable "python"
executable "python2.7"
args = ['-B', 'createLevAutomata.py', num, transpose, "${momanDir}/finenight/python"]
}
}

View File

@ -45,7 +45,7 @@
<target name="generate-jflex-html-char-entities">
<exec dir="src/java/org/apache/lucene/analysis/charfilter"
output="src/java/org/apache/lucene/analysis/charfilter/HTMLCharacterEntities.jflex"
executable="${python.exe}" failonerror="true" logerror="true">
executable="${python2.exe}" failonerror="true" logerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="htmlentity.py"/>

View File

@ -247,10 +247,10 @@
<property name="git.exe" value="git" />
<property name="perl.exe" value="perl" />
<property name="python.exe" value="python" />
<!-- todo: rename this variable -->
<property name="python32.exe" value="python3" />
<!-- we default to python2.7 because not all OSs (e.g. mac) have a python2 link -->
<property name="python2.exe" value="python2.7" />
<property name="python3.exe" value="python3" />
<property name="gpg.exe" value="gpg" />
<property name="gpg.key" value="CODE SIGNING KEY" />
@ -2440,7 +2440,7 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}
<macrodef name="check-broken-links">
<attribute name="dir"/>
<sequential>
<exec dir="." executable="${python32.exe}" failonerror="true">
<exec dir="." executable="${python3.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="${dev-tools.dir}/scripts/checkJavadocLinks.py"/>
@ -2453,7 +2453,7 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}
<attribute name="dir"/>
<attribute name="level" default="class"/>
<sequential>
<exec dir="." executable="${python32.exe}" failonerror="true">
<exec dir="." executable="${python3.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="${dev-tools.dir}/scripts/checkJavaDocs.py"/>

View File

@ -69,7 +69,7 @@
<attribute name="n"/>
<sequential>
<exec dir="src/java/org/apache/lucene/util/automaton"
executable="${python.exe}" failonerror="true">
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="createLevAutomata.py"/>
@ -79,7 +79,7 @@
<arg value="../../../../../../../../build/core/moman/finenight/python"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/automaton"
executable="${python.exe}" failonerror="true">
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="createLevAutomata.py"/>
@ -94,13 +94,13 @@
<target name="createPackedIntSources">
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python.exe}" failonerror="true">
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_BulkOperation.py"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python.exe}" failonerror="true">
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_Packed64SingleBlock.py"/>