[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [chutney/master] Travis: Use the latest Python versions



commit e6f47dd9681b67c4b8b3fe293c195b9211a6ffab
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Thu Nov 28 13:14:07 2019 +1000

    Travis: Use the latest Python versions
    
    Also:
    * Set $PYTHON for macOS python3
    * Use "python" as the default for $PYTHON
    * Respect $PYTHON in unit-tests.sh
    
    Part of 32631.
---
 .travis.yml         | 40 ++++++++++++++++++++++++++++------------
 tests/unit-tests.sh | 14 +++++++++-----
 2 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 7ca2c74..971f825 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,6 +8,8 @@ os:
   - linux
   ## We also use macOS for some networks
 
+## We don't use the build matrix cross-product, because it makes too many jobs
+## Instead, we list each job under matrix: include:
 matrix:
   # include creates Linux, python 2.7, tor master builds by default
   # we use tor master to catch tor issues before stable releases
@@ -112,10 +114,17 @@ matrix:
 
     ## Test all supported python releases
 
+    ## Pre-installed in macOS
+    - os: osx
+      language: c
+      python:
+      ## python 3 is already installed, under this name
+      env: PYTHON="python3" TOR="stable-release"
+
     ## Pre-installed in Travis xenial:
     ## https://docs.travis-ci.com/user/reference/xenial/#python-support
     ## End of Life: 1 January 2020
-    ## https://www.python.org/dev/peps/pep-0373/#id2
+    ## https://www.python.org/dev/peps/pep-0373/#update
     - python: "2.7"
     ## End of Life: December 2021
     ## https://www.python.org/dev/peps/pep-0494/#lifespan
@@ -123,23 +132,28 @@ matrix:
     ## End of Life: June 2023
     ## https://www.python.org/dev/peps/pep-0537/#lifespan
     - python: "3.7"
-    ## Stable: 20 October 2019
-    ## (Switch from 3.8-dev to 3.8, and check for 3.9-dev)
+
+    ## Extra Installs
     ## End of Life: October 2024
     ## https://www.python.org/dev/peps/pep-0569/#lifespan
-    - python: "3.8-dev"
+    - python: "3.8"
+    ## Python 3.9
+    ## Travis Dev Package: ????
+    ## (Add 3.9-dev)
+    ## Stable: 10 October 2020
+    ## (Switch from 3.9-dev to 3.9, and check for {3.10,4.0}-dev)
+    ## End of Life: October 2025
+    ## https://www.python.org/dev/peps/pep-0596/#lifespan
+    #- python: "3.9-dev"
     - python: "nightly"
-    # PyPy versions
+
+    ## PyPy versions
     ## End of Life: "forever"
     ## http://doc.pypy.org/en/latest/faq.html#how-long-will-pypy-support-python2
     ## But chutney can decide not to support python 2 after 1 Jan 2020.
-    ## Travis Xenial does not support pypy2.7
-    #- python: "pypy2.7"
+    - python: "pypy"
     ## PyPy does not have documented end of life dates
-    - python: "pypy3.5"
-    ## PyPy 3.6 is currently in alpha
-    ## Travis Xenial does not support pypy3.6-dev yet?
-    #- python: "pypy3.6-dev"
+    - python: "pypy3"
 
   ## Uncomment to allow the build to report success (with non-required
   ## sub-builds continuing to run) if all required sub-builds have
@@ -195,7 +209,9 @@ install:
   ## List installed package versions
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then dpkg-query --show; fi
   - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list --versions; fi
-  - python --version
+  ## Use the default spelling for python, unless it is overridden
+  - export PYTHON=${PYTHON:-python}
+  - $PYTHON --version
   - if command -v shellcheck ; then shellcheck --version; fi
   - tor --version
 
diff --git a/tests/unit-tests.sh b/tests/unit-tests.sh
index 07e8b32..2bf99c1 100755
--- a/tests/unit-tests.sh
+++ b/tests/unit-tests.sh
@@ -5,10 +5,13 @@ set -e
 # Verbose mode
 set -v
 
-
 # Output is prefixed with the name of the script
 myname=$(basename "$0")
 
+# Respect the user's $PYTHON
+PYTHON=${PYTHON:-python}
+echo "$myname: using python '$PYTHON'"
+
 echo "$myname: finding chutney directory"
 TEST_DIR=$(dirname "$0")
 CHUTNEY_DIR=$(dirname "$TEST_DIR")
@@ -25,7 +28,7 @@ test -n "$LOG_FILE"
 
 unset CHUTNEY_DEBUG
 export CHUTNEY_DEBUG
-lib/chutney/Debug.py | tee "$LOG_FILE"
+$PYTHON lib/chutney/Debug.py | tee "$LOG_FILE"
 LOG_FILE_LINES=$(wc -l < "$LOG_FILE")
 test "$LOG_FILE_LINES" -eq 1
 
@@ -34,7 +37,7 @@ export LOG_FILE
 test -n "$LOG_FILE"
 
 export CHUTNEY_DEBUG=1
-lib/chutney/Debug.py | tee "$LOG_FILE"
+$PYTHON lib/chutney/Debug.py | tee "$LOG_FILE"
 LOG_FILE_LINES=$(wc -l < "$LOG_FILE")
 test "$LOG_FILE_LINES" -eq 2
 
@@ -48,7 +51,7 @@ LOG_FILE=$(mktemp)
 export LOG_FILE
 test -n "$LOG_FILE"
 
-lib/chutney/Templating.py torrc_templates/common.i | tee "$LOG_FILE"
+$PYTHON lib/chutney/Templating.py torrc_templates/common.i | tee "$LOG_FILE"
 grep -q owning_controller_process "$LOG_FILE"
 grep -q connlimit "$LOG_FILE"
 grep -q controlport "$LOG_FILE"
@@ -64,7 +67,8 @@ export LOG_FILE
 test -n "$LOG_FILE"
 
 # Choose an arbitrary port
-PYTHONPATH=$PYTHONPATH:lib lib/chutney/Traffic.py 9999 | tee "$LOG_FILE"
+PYTHONPATH=$PYTHONPATH:lib $PYTHON lib/chutney/Traffic.py 9999 \
+    | tee "$LOG_FILE"
 
 # Traffic.py produces output with a single newline. But we don't want to get
 # too picky about the details: allow an extra line and a few extra chars.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits