You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2020/02/19 00:00:55 UTC

[lucene-solr] branch master updated: LUCENE-9230: explicitly call python version we want from builds

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

rmuir pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new b9a569e  LUCENE-9230: explicitly call python version we want from builds
b9a569e is described below

commit b9a569e7be6131f0691ed7bac150723a383e1a08
Author: Robert Muir <rm...@apache.org>
AuthorDate: Tue Feb 18 18:58:17 2020 -0500

    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
---
 build.xml                        |  4 ++--
 gradle/generation/util.gradle    |  4 ++--
 lucene/analysis/common/build.xml |  2 +-
 lucene/common-build.xml          | 12 ++++++------
 lucene/core/build.xml            |  8 ++++----
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/build.xml b/build.xml
index 1d82544..a1e8ccb 100755
--- a/build.xml
+++ b/build.xml
@@ -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"/>
diff --git a/gradle/generation/util.gradle b/gradle/generation/util.gradle
index 8bf9bed..b6981f5 100644
--- a/gradle/generation/util.gradle
+++ b/gradle/generation/util.gradle
@@ -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"]
           }
         }
diff --git a/lucene/analysis/common/build.xml b/lucene/analysis/common/build.xml
index c3d4fcc..0e14d91 100644
--- a/lucene/analysis/common/build.xml
+++ b/lucene/analysis/common/build.xml
@@ -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"/>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 1e3da88..ca6db1b 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -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"/>
diff --git a/lucene/core/build.xml b/lucene/core/build.xml
index be42c56..1759b3f 100644
--- a/lucene/core/build.xml
+++ b/lucene/core/build.xml
@@ -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"/>