Skip to content

Commit

Permalink
Dropped support for Python < 3.7 (#9480)
Browse files Browse the repository at this point in the history
* Drop Python versions <3.7.

* Updated README to clarify that Python 3.7 is the minimum.

* Removed more Python 3.5-specific code.

Also changed tests to skip missing interpreters.

* Invoke tox directly instead of through Python.

Hopefully this will pick up python3.

* Updated java_stretch image to bullseye to get Python >= 3.7.

* Use jdk11 instead of jdk8.

* Installed python2 for gtest.

* Use "python3 -m venv" instead of "virtualenv."

* Install python3-venv.
  • Loading branch information
haberman committed Feb 9, 2022
1 parent b5ab0b7 commit 301d315
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 153 deletions.
11 changes: 8 additions & 3 deletions kokoro/linux/dockerfile/test/java_stretch/Dockerfile
@@ -1,4 +1,7 @@
FROM debian:stretch
# Despite the name of this image, we are no longer on stretch.
# We should consider renaming this image, and/or evaluating what
# software versions we actually need.
FROM debian:bullseye

# Install dependencies. We start with the basic ones required to build protoc
# and the C++ build
Expand All @@ -22,9 +25,11 @@ RUN apt-get update && apt-get install -y \
wget \
# Java dependencies
maven \
openjdk-8-jdk \
openjdk-11-jdk \
# Required for the gtest build.
python2 \
# Python dependencies
python3-setuptools \
python3-pip \
virtualenv \
python3-venv \
&& apt-get clean
18 changes: 0 additions & 18 deletions kokoro/linux/python36/build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions kokoro/linux/python36/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions kokoro/linux/python36/presubmit.cfg

This file was deleted.

18 changes: 0 additions & 18 deletions kokoro/linux/python36_cpp/build.sh

This file was deleted.

11 changes: 0 additions & 11 deletions kokoro/linux/python36_cpp/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions kokoro/linux/python36_cpp/presubmit.cfg

This file was deleted.

10 changes: 0 additions & 10 deletions kokoro/release/python/windows/build_artifacts.bat
Expand Up @@ -40,16 +40,6 @@ mkdir %ARTIFACT_DIR%

REM Build wheel

SET PYTHON=C:\python36_32bit
SET PYTHON_VERSION=3.6
SET PYTHON_ARCH=32
CALL build_single_artifact.bat || goto :error

SET PYTHON=C:\python36
SET PYTHON_VERSION=3.6
SET PYTHON_ARCH=64
CALL build_single_artifact.bat || goto :error

SET PYTHON=C:\python37_32bit
SET PYTHON_VERSION=3.7
SET PYTHON_ARCH=32
Expand Down
6 changes: 0 additions & 6 deletions kokoro/release/python/windows/build_single_artifact.bat
@@ -1,11 +1,5 @@
setlocal

if %PYTHON%==C:\python36_32bit set generator=Visual Studio 14
if %PYTHON%==C:\python36_32bit set vcplatform=Win32

if %PYTHON%==C:\python36 set generator=Visual Studio 14 Win64
if %PYTHON%==C:\python36 set vcplatform=x64

if %PYTHON%==C:\python37_32bit set generator=Visual Studio 14
if %PYTHON%==C:\python37_32bit set vcplatform=Win32

Expand Down
2 changes: 1 addition & 1 deletion python/README.md
Expand Up @@ -26,7 +26,7 @@ use python c++ implementation.
Installation
============

1) Make sure you have Python 3.5 or newer. If in doubt, run:
1) Make sure you have Python 3.7 or newer. If in doubt, run:

$ python -V

Expand Down
4 changes: 1 addition & 3 deletions python/setup.py
Expand Up @@ -301,8 +301,6 @@ def get_option_from_sys_argv(option_str):
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -323,5 +321,5 @@ def get_option_from_sys_argv(option_str):
},
install_requires=install_requires,
ext_modules=ext_module_list,
python_requires=">=3.5",
python_requires=">=3.7",
)
4 changes: 2 additions & 2 deletions python/tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
py{35,36,37,38,39,310}-{cpp,python}
py{37,38,39,310}-{cpp,python}

[testenv]
usedevelop=true
Expand All @@ -14,7 +14,7 @@ setenv =
commands =
python setup.py -q build_py
python: python setup.py -q build
py{35,36,37,38,39,310}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
py{37,38,39,310}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
python: python setup.py -q test -q
cpp: python setup.py -q test -q --cpp_implementation
python: python setup.py -q test_conformance
Expand Down
58 changes: 10 additions & 48 deletions tests.sh
Expand Up @@ -116,12 +116,12 @@ build_dist_install() {

# Try to install Java
pushd java
use_java jdk8
use_java jdk11
$MVN install
popd

# Try to install Python
virtualenv --no-site-packages venv
python3 -m venv venv
source venv/bin/activate
pushd python
python3 setup.py clean build sdist
Expand Down Expand Up @@ -189,6 +189,10 @@ build_golang() {
use_java() {
version=$1
case "$version" in
jdk11)
export PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
;;
jdk8)
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Expand Down Expand Up @@ -268,7 +272,7 @@ build_java_linkage_monitor() {
# Linkage Monitor checks compatibility with other Google libraries
# https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/linkage-monitor

use_java jdk8
use_java jdk11
internal_build_cpp

# Linkage Monitor uses $HOME/.m2 local repository
Expand Down Expand Up @@ -330,39 +334,18 @@ build_objectivec_cocoapods_integration() {
build_python() {
internal_build_cpp
cd python
if [ $(uname -s) == "Linux" ]; then
envlist=py\{35,36\}-python
else
envlist=py\{36\}-python
fi
python -m tox -e $envlist
tox --skip-missing-interpreters
cd ..
}

build_python_version() {
internal_build_cpp
cd python
envlist=$1
python -m tox -e $envlist
tox -e $envlist
cd ..
}

build_python33() {
build_python_version py33-python
}

build_python34() {
build_python_version py34-python
}

build_python35() {
build_python_version py35-python
}

build_python36() {
build_python_version py36-python
}

build_python37() {
build_python_version py37-python
}
Expand All @@ -384,12 +367,7 @@ build_python_cpp() {
export LD_LIBRARY_PATH=../src/.libs # for Linux
export DYLD_LIBRARY_PATH=../src/.libs # for OS X
cd python
if [ $(uname -s) == "Linux" ]; then
envlist=py\{35,36\}-cpp
else
envlist=py\{36\}-cpp
fi
tox -e $envlist
tox --skip-missing-interpreters
cd ..
}

Expand All @@ -403,22 +381,6 @@ build_python_cpp_version() {
cd ..
}

build_python33_cpp() {
build_python_cpp_version py33-cpp
}

build_python34_cpp() {
build_python_cpp_version py34-cpp
}

build_python35_cpp() {
build_python_cpp_version py35-cpp
}

build_python36_cpp() {
build_python_cpp_version py36-cpp
}

build_python37_cpp() {
build_python_cpp_version py37-cpp
}
Expand Down

0 comments on commit 301d315

Please sign in to comment.