diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2019-05-05 10:06:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-05 10:06:43 -0400 |
commit | f0ce306920ba48248b31da46281758ebb9459d59 (patch) | |
tree | bcf852ad9a0069a1abf62ce170c437a2e457fde2 | |
parent | 5e3a70c365f62cfb0f39dc4851d2104efc76c02f (diff) | |
parent | 81904e40071667157b97e16e2b8a844027e23d86 (diff) | |
download | virtualenv-f0ce306920ba48248b31da46281758ebb9459d59.tar.gz |
drop Jython supportCI runs very long - can no longer maintain it and have very little usage (#1354)
drop Jython supportCI runs very long - can no longer maintain it and have very little usage
-rw-r--r-- | azure-pipelines.yml | 3 | ||||
-rw-r--r-- | azure-run-tox-env.yml | 37 | ||||
-rw-r--r-- | docs/changelog/1354.feature.rst | 3 | ||||
-rw-r--r-- | tests/activation/test_activate_this.py | 5 | ||||
-rw-r--r-- | tests/activation/test_prompts.py | 27 | ||||
-rw-r--r-- | tests/conftest.py | 2 | ||||
-rw-r--r-- | tests/test_cmdline.py | 2 | ||||
-rw-r--r-- | tests/test_virtualenv.py | 2 | ||||
-rw-r--r-- | tox.ini | 13 | ||||
-rwxr-xr-x | virtualenv.py | 41 |
10 files changed, 37 insertions, 98 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ed5625b..6354e93 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -34,8 +34,6 @@ jobs: 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 parameters: {tox: pypy3, python: pypy3, os: linux} @@ -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 e0549ea..75a4084 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 0000000..3cfbd4c --- /dev/null +++ b/docs/changelog/1354.feature.rst @@ -0,0 +1,3 @@ +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. If there are Jython +developers reach out to us to see how we can add back support. diff --git a/tests/activation/test_activate_this.py b/tests/activation/test_activate_this.py index efb25d0..205594f 100644 --- a/tests/activation/test_activate_this.py +++ b/tests/activation/test_activate_this.py @@ -21,17 +21,12 @@ import subprocess 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/activation/test_prompts.py b/tests/activation/test_prompts.py index 8db4662..a1c8615 100644 --- a/tests/activation/test_prompts.py +++ b/tests/activation/test_prompts.py @@ -22,7 +22,7 @@ VIRTUAL_ENV_DISABLE_PROMPT = "VIRTUAL_ENV_DISABLE_PROMPT" ENV_DEFAULT = "env" # This can be anything -ENV_CUSTOM = "env_custom" +ENV_CUSTOM = "envy" # Standard prefix, surround the env name in parentheses and separate by a space PREFIX_DEFAULT = "({}) ".format(ENV_DEFAULT) @@ -197,7 +197,8 @@ class XonshInfo(ShellInfo): "$PROMPT_FIELDS['env_prefix'] = '('; $PROMPT_FIELDS['env_postfix'] = ') '" ) - def platform_check_skip(self): + @staticmethod + def platform_check_skip(): if IS_WIN: return "Provisioning xonsh on windows is unreliable" @@ -223,7 +224,7 @@ class CmdInfo(ShellInfo): class PoshInfo(ShellInfo): - name = "posh" + name = "powershell" avail_cmd = "powershell 'echo foo'" execute_cmd = "powershell -File " prompt_cmd = "prompt" @@ -237,7 +238,7 @@ class PoshInfo(ShellInfo): return self.platform_incompat_msg.format(sys.platform) -SHELLINFO_LIST = [BashInfo(), FishInfo(), CshInfo(), XonshInfo(), CmdInfo(), PoshInfo()] +SHELL_INFO_LIST = [BashInfo(), FishInfo(), CshInfo(), XonshInfo(), CmdInfo(), PoshInfo()] @pytest.fixture(scope="module") @@ -265,8 +266,8 @@ def posh_execute_enabled(tmp_path_factory): @pytest.fixture(scope="module") def shell_avail(posh_execute_enabled): """Generate mapping of ShellInfo.name strings to bools of shell availability.""" - retvals = {si.name: subprocess.call(si.avail_cmd, shell=True) for si in SHELLINFO_LIST} - avails = {si.name: retvals[si.name] == 0 for si in SHELLINFO_LIST} + retvals = {si.name: subprocess.call(si.avail_cmd, shell=True) for si in SHELL_INFO_LIST} + avails = {si.name: retvals[si.name] == 0 for si in SHELL_INFO_LIST} # Extra check for whether powershell scripts are enabled avails[PoshInfo().name] = avails[PoshInfo().name] and posh_execute_enabled @@ -323,11 +324,8 @@ def clean_env(): return clean_env -SHELLINFO_LIST = [BashInfo(), FishInfo(), CshInfo(), XonshInfo(), CmdInfo(), PoshInfo()] - - -@pytest.mark.parametrize("shell_info", SHELLINFO_LIST, ids=(lambda si: si.name)) -@pytest.mark.parametrize("env", [ENV_DEFAULT, ENV_CUSTOM]) +@pytest.mark.parametrize("shell_info", SHELL_INFO_LIST, ids=[i.name for i in SHELL_INFO_LIST]) +@pytest.mark.parametrize("env", [ENV_DEFAULT, ENV_CUSTOM], ids=["default", "custom"]) @pytest.mark.parametrize(("value", "disable"), [("", False), ("0", True), ("1", True)]) def test_suppressed_prompt(shell_info, shell_avail, env, value, disable, get_work_root, clean_env): """Confirm non-empty VIRTUAL_ENV_DISABLE_PROMPT suppresses prompt changes on activate.""" @@ -337,8 +335,9 @@ def test_suppressed_prompt(shell_info, shell_avail, env, value, disable, get_wor if not IS_INSIDE_CI and not shell_avail[shell_info.name]: pytest.skip( - "Shell '{}' not provisioned".format(shell_info.name) - + (" - is Powershell script execution disabled?" if shell_info == PoshInfo() else "") + "Shell '{}' not provisioned{}".format( + shell_info.name, " - is Powershell script execution disabled?" if shell_info == PoshInfo() else "" + ) ) script_name = SCRIPT_TEMPLATE.format(shell_info.name, "suppress", env, shell_info.testscript_extension) @@ -382,7 +381,7 @@ def test_suppressed_prompt(shell_info, shell_avail, env, value, disable, get_wor assert (lines[1] == lines[2]) == disable, lines -@pytest.mark.parametrize("shell_info", SHELLINFO_LIST, ids=(lambda si: si.name)) +@pytest.mark.parametrize("shell_info", SHELL_INFO_LIST, ids=[i.name for i in SHELL_INFO_LIST]) @pytest.mark.parametrize(["env", "prefix"], [(ENV_DEFAULT, PREFIX_DEFAULT), (ENV_CUSTOM, PREFIX_CUSTOM)]) def test_activated_prompt(shell_info, shell_avail, env, prefix, get_work_root, clean_env): """Confirm prompt modification behavior with and without --prompt specified.""" diff --git a/tests/conftest.py b/tests/conftest.py index 46a1336..2efd7da 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 7606efe..814fd52 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -11,8 +11,6 @@ import virtualenv 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 a6a1630..da55118 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: @@ -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 9ebcdc7..3c4c59a 100755 --- a/virtualenv.py +++ b/virtualenv.py @@ -44,7 +44,7 @@ except ImportError: # 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 @@ except NameError: 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 @@ DEFAULT_CONFIG_FILE = os.path.join(DEFAULT_STORAGE_DIR, "virtualenv.ini") if IS_PYPY: EXPECTED_EXE = "pypy" -elif IS_JYTHON: - EXPECTED_EXE = "jython" else: EXPECTED_EXE = "python" @@ -745,7 +742,7 @@ def main(): 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 _install_wheel_with_search_dir(download, project_names, py_executable, searc 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 _install_wheel_with_search_dir(download, project_names, py_executable, searc 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: 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: files = {} else: files = {"python-config": PYTHON_CONFIG} |