From 758f9c7f9a22a92acd385f59a8c005f0cae379eb Mon Sep 17 00:00:00 2001 From: Bernat Gabor Date: Sun, 5 May 2019 00:26:24 -0400 Subject: [PATCH] drop Jython support CI runs very long - can no longer maintain it and have very little usage --- azure-pipelines.yml | 3 -- azure-run-tox-env.yml | 37 ++++++----------------- docs/changelog/1354.feature.rst | 2 ++ tests/activation/test_activate_this.py | 5 ---- tests/conftest.py | 2 -- tests/test_cmdline.py | 2 -- tests/test_virtualenv.py | 2 -- tox.ini | 13 +++----- virtualenv.py | 41 +++++--------------------- 9 files changed, 23 insertions(+), 84 deletions(-) create mode 100644 docs/changelog/1354.feature.rst diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ed5625b45..6354e93b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 @@ -87,7 +85,6 @@ jobs: - linux_py27 - linux_pypy3 - linux_pypy - - linux_jython - macOS_py36 - macOS_py27 steps: diff --git a/azure-run-tox-env.yml b/azure-run-tox-env.yml index e0549ea71..75a40841d 100644 --- a/azure-run-tox-env.yml +++ b/azure-run-tox-env.yml @@ -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 @@ -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 @@ -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() @@ -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() diff --git a/docs/changelog/1354.feature.rst b/docs/changelog/1354.feature.rst new file mode 100644 index 000000000..86cd07f6d --- /dev/null +++ b/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. diff --git a/tests/activation/test_activate_this.py b/tests/activation/test_activate_this.py index efb25d0df..205594fe9 100644 --- a/tests/activation/test_activate_this.py +++ b/tests/activation/test_activate_this.py @@ -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" diff --git a/tests/conftest.py b/tests/conftest.py index 46a1336c8..2efd7dab1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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)], diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 7606efea6..814fd5268 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -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) diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py index a6a1630a6..da55118fc 100644 --- a/tests/test_virtualenv.py +++ b/tests/test_virtualenv.py @@ -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: diff --git a/tox.ini b/tox.ini index 4e6ec7fa9..c4150afe2 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [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 @@ -8,8 +8,6 @@ skip_missing_interpreters = true 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 @@ -17,14 +15,11 @@ 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; diff --git a/virtualenv.py b/virtualenv.py index 9ebcdc7fc..cd2bcc62b 100755 --- a/virtualenv.py +++ b/virtualenv.py @@ -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): @@ -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" @@ -79,8 +78,6 @@ if IS_PYPY: EXPECTED_EXE = "pypy" -elif IS_JYTHON: - EXPECTED_EXE = "jython" else: EXPECTED_EXE = "python" @@ -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 @@ -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")) @@ -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:", @@ -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, ): @@ -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") @@ -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 @@ -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: @@ -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) @@ -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 @@ -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}