Navigation Menu

Skip to content

Commit

Permalink
drop Jython support
Browse files Browse the repository at this point in the history
CI runs very long - can no longer maintain it and have very little usage
  • Loading branch information
gaborbernat committed May 5, 2019
1 parent 5e3a70c commit 758f9c7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 84 deletions.
3 changes: 0 additions & 3 deletions azure-pipelines.yml
Expand Up @@ -33,8 +33,6 @@ jobs:
- template: azure-run-tox-env.yml
parameters: {tox: package_readme, python: '3.7'}

- template: azure-run-tox-env.yml
parameters: {tox: jython, python: '3.7', os: linux}
- template: azure-run-tox-env.yml
parameters: {tox: pypy, python: pypy2, os: linux}
- template: azure-run-tox-env.yml
Expand Down Expand Up @@ -87,7 +85,6 @@ jobs:
- linux_py27
- linux_pypy3
- linux_pypy
- linux_jython
- macOS_py36
- macOS_py27
steps:
Expand Down
37 changes: 9 additions & 28 deletions azure-run-tox-env.yml
Expand Up @@ -19,25 +19,10 @@ jobs:

steps:
# ensure the required Python versions are available
- ${{ if notIn(parameters.python, 'jython') }}:
- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: ${{ parameters.python }}

# provision jython
- ${{ if eq(parameters.tox, 'jython') }}:
- script: "wget http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.7.1/jython-installer-2.7.1.jar -O $(Agent.ToolsDirectory)/jython.jar"
displayName: download jython

- script: "java -jar $(Agent.ToolsDirectory)/jython.jar -sd $(Agent.ToolsDirectory)/jython -e demo src doc"
displayName: install jython

- script: echo "##vso[task.setvariable variable=PATH]$(Agent.ToolsDirectory)/jython/bin:$(PATH)"
displayName: setvarStep

- script: echo $(PATH)
displayName: show PATH
- task: UsePythonVersion@0
displayName: setup python
inputs:
versionSpec: ${{ parameters.python }}

- script: "python -c \"import sys; print(sys.version); print(sys.executable)\""
displayName: show python information
Expand All @@ -49,7 +34,7 @@ jobs:
displayName: install tox

# provision additional shells
- ${{ if or( startsWith(parameters.tox, 'py'), eq(parameters.tox, 'jython')) }}:
- ${{ if startsWith(parameters.tox, 'py') }}:
- ${{if eq(parameters.os, 'linux') }}:
- script: "sudo apt-get update && sudo apt-get install fish csh"
displayName: install fish and csh
Expand All @@ -59,21 +44,17 @@ jobs:
- script: "brew install fish tcsh"
displayName: install fish and csh

- ${{ if eq(parameters.tox, 'jython') }}:
- script: "python -m pip install --user $(System.DefaultWorkingDirectory)"
displayName: install dev venv for tox

- script: ${{ format('python -m tox -e {0} --notest --skip-missing-interpreters=false', parameters.tox) }}
displayName: install test dependencies

- ${{ if or( startsWith(parameters.tox, 'py'), eq(parameters.tox, 'jython') ) }}:
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: python -m tox -e coverage --notest --skip-missing-interpreters=false
displayName: install coverage dependencies

- script: ${{ format('python -m tox --skip-missing-interpreters=false -e {0}', parameters.tox) }}
displayName: run tests

- ${{ if or( startsWith(parameters.tox, 'py'), eq(parameters.tox, 'jython') ) }}:
- ${{ if startsWith(parameters.tox, 'py') }}:
- task: PublishTestResults@2
displayName: publish test results via junit
condition: succeededOrFailed()
Expand All @@ -82,12 +63,12 @@ jobs:
testResultsFiles: ${{ format('$(System.DefaultWorkingDirectory)/.tox/.test.{0}.xml', parameters.tox) }}
testRunTitle: ${{ format('{0}_{1}', parameters.os, parameters.tox) }}

- ${{ if or( startsWith(parameters.tox, 'py'), eq(parameters.tox, 'jython') ) }}:
- ${{ if startsWith(parameters.tox, 'py') }}:
- script: "python -m tox --skip-missing-interpreters=false -e coverage"
displayName: create coverag report
condition: succeededOrFailed()

- ${{ if or( startsWith(parameters.tox, 'py'), eq(parameters.tox, 'jython') ) }}:
- ${{ if startsWith(parameters.tox, 'py') }}:
- task: CopyFiles@2
displayName: move coverage files into staging area
condition: succeededOrFailed()
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog/1354.feature.rst
@@ -0,0 +1,2 @@
Drop Jython support. Jython became slower and slower in the last few months and significantly holds back our
CI and development. As there's very little user base for it decided to drop support for it.
5 changes: 0 additions & 5 deletions tests/activation/test_activate_this.py
Expand Up @@ -21,17 +21,12 @@
import sys
import textwrap

import virtualenv


def test_activate_this(clean_python, tmp_path, monkeypatch):
# to test this, we'll try to use the activation env from this Python
monkeypatch.delenv(str("VIRTUAL_ENV"), raising=False)
monkeypatch.delenv(str("PYTHONPATH"), raising=False)
paths = [str(tmp_path), str(tmp_path / "other")]
if virtualenv.IS_JYTHON:
# jython calls OS commands to determine environment, so need path access
paths += os.getenv(str("PATH"), "").split(os.pathsep)
start_path = os.pathsep.join(paths)
monkeypatch.setenv(str("PATH"), start_path)
activator = tmp_path.__class__(clean_python[1]) / "activate_this.py"
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Expand Up @@ -67,8 +67,6 @@ def wheel(tmp_path_factory):
"""test that we can create a virtual environment by feeding to a clean python the wheels content"""
dest_path = tmp_path_factory.mktemp("wheel")
env = os.environ.copy()
if virtualenv.IS_JYTHON:
env[str("PIP_NO_CACHE_DIR")] = str("off")
try:
subprocess.check_output(
[sys.executable, "-m", "pip", "wheel", "-w", str(dest_path), "--no-deps", str(ROOT_DIR)],
Expand Down
2 changes: 0 additions & 2 deletions tests/test_cmdline.py
Expand Up @@ -11,8 +11,6 @@

def get_src(path):
base, _ = os.path.splitext(path)
if virtualenv.IS_JYTHON and base.endswith("$py"):
base = base[:-3] # strip away Jython ext
return "{}.py".format(base)


Expand Down
2 changes: 0 additions & 2 deletions tests/test_virtualenv.py
Expand Up @@ -350,8 +350,6 @@ def test_install_python_bin():

for pth in required_executables:
assert os.path.exists(os.path.join(bin_dir, pth)), "%s should exist in bin_dir" % pth
if not virtualenv.IS_JYTHON:
assert os.path.exists(inc_dir)
root_inc_dir = os.path.join(home_dir, "include")
assert not os.path.islink(root_inc_dir)
finally:
Expand Down
13 changes: 4 additions & 9 deletions tox.ini
@@ -1,30 +1,25 @@
[tox]
minversion = 3.6.1
envlist = fix_lint, embed, py{27,34,35,36,37}, pypy{,3}, jython, cross_python{2,3}, docs, package_readme
envlist = fix_lint, embed, py{27,34,35,36,37}, pypy{,3}, cross_python{2,3}, docs, package_readme
isolated_build = true
skip_missing_interpreters = true

[testenv]
description = run tests with {basepython}
deps = pip >= 19.0.1
setenv = COVERAGE_FILE = {env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}}
# separate jython form other python caches
jython: PIP_NO_CACHE_DIR = off
passenv = https_proxy http_proxy no_proxy HOME PYTEST_* PIP_* CI_RUN TERM
extras = testing
install_command = python -m pip install {opts} {packages} --disable-pip-version-check
commands = coverage run --source=virtualenv \
-m pytest tests \
{posargs:\
--junitxml={env:JUNIT_XML_FILE:{toxworkdir}/.test.{envname}.xml} \
!jython: --timeout=180 \
!jython: -n 0 \
--timeout=180 \
-n 0 \
}
coverage combine
!jython: coverage report --show-missing

[testenv:jython]
deps = pip == 18.1.0
coverage report --show-missing

[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report;
Expand Down
41 changes: 8 additions & 33 deletions virtualenv.py
Expand Up @@ -44,7 +44,7 @@
# noinspection PyPep8Naming
import configparser as ConfigParser

__version__ = "16.5.0"
__version__ = "17.0.0"
virtualenv_version = __version__ # legacy
DEBUG = os.environ.get("_VIRTUALENV_DEBUG", None) == "1"
if sys.version_info < (2, 7):
Expand All @@ -63,7 +63,6 @@

PY_VERSION = "python{}.{}".format(sys.version_info[0], sys.version_info[1])

IS_JYTHON = sys.platform.startswith("java")
IS_PYPY = hasattr(sys, "pypy_version_info")
IS_WIN = sys.platform == "win32"
IS_CYGWIN = sys.platform == "cygwin"
Expand All @@ -79,8 +78,6 @@

if IS_PYPY:
EXPECTED_EXE = "pypy"
elif IS_JYTHON:
EXPECTED_EXE = "jython"
else:
EXPECTED_EXE = "python"

Expand Down Expand Up @@ -745,7 +742,7 @@ def should_reinvoke(options):
if options.python and not os.environ.get("VIRTUALENV_INTERPRETER_RUNNING"):
return options.python
# All of the remaining cases are only for Windows
if sys.platform == "win32":
if IS_WIN:
# 2. Are we running from a venv-style virtual environment with a redirector?
if hasattr(sys, "_base_executable"):
return sys._base_executable
Expand Down Expand Up @@ -999,8 +996,6 @@ def space_path2url(p):
extra_args = ["--ignore-installed"]
if DEBUG:
extra_args.append("-v")
if IS_JYTHON:
extra_args.append("--no-cache")

config = _pip_config(py_executable, python_path)
defined_cert = bool(config.get("install.cert") or config.get(":env:.cert") or config.get("global.cert"))
Expand Down Expand Up @@ -1051,7 +1046,6 @@ def space_path2url(p):

env = {
"PYTHONPATH": python_path,
"JYTHONPATH": python_path, # for Jython < 3.x
"PIP_FIND_LINKS": find_links,
"PIP_USE_WHEEL": "1",
"PIP_ONLY_BINARY": ":all:",
Expand All @@ -1075,7 +1069,7 @@ def _pip_config(py_executable, python_path):
for line in call_subprocess(
cmd,
show_stdout=False,
extra_env={"PYTHONPATH": python_path, "JYTHONPATH": python_path},
extra_env={"PYTHONPATH": python_path},
remove_from_env=["PIP_VERBOSE", "PIP_QUIET"],
raise_on_return_code=False,
):
Expand Down Expand Up @@ -1171,10 +1165,6 @@ def path_locations(home_dir, dry_run=False):
lib_dir = join(home_dir, "Lib")
inc_dir = join(home_dir, "Include")
bin_dir = join(home_dir, "Scripts")
if IS_JYTHON:
lib_dir = join(home_dir, "Lib")
inc_dir = join(home_dir, "Include")
bin_dir = join(home_dir, "bin")
elif IS_PYPY:
lib_dir = home_dir
inc_dir = join(home_dir, "include")
Expand Down Expand Up @@ -1283,11 +1273,11 @@ def copy_required_modules(dst_prefix, symlink):
# special-case custom readline.so on OS X, but not for pypy:
if (
modname == "readline"
and sys.platform == "darwin"
and IS_DARWIN
and not (IS_PYPY or filename.endswith(join("lib-dynload", "readline.so")))
):
dst_filename = join(dst_prefix, "lib", "python{}".format(sys.version[:3]), "readline.so")
elif modname == "readline" and sys.platform == "win32":
elif modname == "readline" and IS_WIN:
# special-case for Windows, where readline is not a standard module, though it may have been installed
# in site-packages by a third-party package
dst_filename = None
Expand Down Expand Up @@ -1449,25 +1439,10 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
if IS_WIN:
exec_dir = join(sys.exec_prefix, "lib")
elif IS_JYTHON:
exec_dir = join(sys.exec_prefix, "Lib")
else:
exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
copy_required_files(exec_dir, lib_dir, symlink)

if IS_JYTHON:
# Jython has either jython-dev.jar and javalib/ dir, or just
# jython.jar
for name in "jython-dev.jar", "javalib", "jython.jar":
src = join(prefix, name)
if os.path.exists(src):
copyfile(src, join(home_dir, name), symlink)
# XXX: registry should always exist after Jython 2.5rc1
src = join(prefix, "registry")
if os.path.exists(src):
copyfile(src, join(home_dir, "registry"), symlink=False)
copyfile(join(prefix, "cachedir"), join(home_dir, "cachedir"), symlink=False)

mkdir(bin_dir)
py_executable = join(bin_dir, os.path.basename(sys.executable))
if "Python.framework" in prefix:
Expand Down Expand Up @@ -1540,7 +1515,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
if IS_PYPY:
# make a symlink python --> pypy-c
python_executable = os.path.join(os.path.dirname(py_executable), "python")
if sys.platform in ("win32", "cygwin"):
if IS_WIN or IS_CYGWIN:
python_executable += ".exe"
logger.info("Also created executable %s", python_executable)
copyfile(py_executable, python_executable, symlink)
Expand Down Expand Up @@ -1699,7 +1674,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy


def install_activate(home_dir, bin_dir, prompt=None):
if IS_WIN or IS_JYTHON and getattr(os, "_name", None) == "nt":
if IS_WIN and getattr(os, "_name", None) == "nt":
files = {"activate.bat": ACTIVATE_BAT, "deactivate.bat": DEACTIVATE_BAT, "activate.ps1": ACTIVATE_PS}

# MSYS needs paths of the form /c/path/to/file
Expand Down Expand Up @@ -1743,7 +1718,7 @@ def install_files(home_dir, bin_dir, prompt, files):


def install_python_config(home_dir, bin_dir, prompt=None):
if sys.platform == "win32" or IS_JYTHON and getattr(os, "_name", None) == "nt":
if IS_WIN and getattr(os, "_name", None) == "nt":
files = {}
else:
files = {"python-config": PYTHON_CONFIG}
Expand Down

0 comments on commit 758f9c7

Please sign in to comment.