diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e21cd6981..63284f7c8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,11 +16,11 @@ repos: hooks: - id: add-trailing-comma - repo: https://github.com/asottile/pyupgrade - rev: v2.4.4 + rev: v2.6.1 hooks: - id: pyupgrade - repo: https://github.com/asottile/seed-isort-config - rev: v2.1.1 + rev: v2.2.0 hooks: - id: seed-isort-config args: [--application-directories, '.:src'] @@ -50,7 +50,7 @@ repos: - id: setup-cfg-fmt args: [--min-py3-version, "3.4"] - repo: https://gitlab.com/pycqa/flake8 - rev: "3.8.2" + rev: "3.8.3" hooks: - id: flake8 additional_dependencies: ["flake8-bugbear == 20.1.4"] diff --git a/docs/user_guide.rst b/docs/user_guide.rst index e1d9b846a..dd82bc45b 100644 --- a/docs/user_guide.rst +++ b/docs/user_guide.rst @@ -144,7 +144,7 @@ What qualifies as bundled wheel? The following three sets together: end users might not be able to upgrade virtualenv at the same speed. Therefore, a user might request to upgrade the list of embedded wheels by invoking virtualenv with the :option:`upgrade-embed-wheels` flag. This operation will trigger automatically, as a background process, if no upgrade has been performed in the last 14 days and upgrade the - embedded wheels if they have been our for more than 28 days. This 28 days period should guarantee end users are not + embedded wheels if they have been out for more than 28 days. This 28 days period should guarantee end users are not pulling in automatically releases that have known bugs within. This automatic behaviour might be disabled via the :option:`no-periodic-update` configuration flag/option. To acquire the release date of a package virtualenv will perform the following: diff --git a/src/virtualenv/seed/wheels/periodic_update.py b/src/virtualenv/seed/wheels/periodic_update.py index 1090dbb2a..8d900f068 100644 --- a/src/virtualenv/seed/wheels/periodic_update.py +++ b/src/virtualenv/seed/wheels/periodic_update.py @@ -42,7 +42,7 @@ def periodic_update(distribution, for_py_version, wheel, search_dirs, app_data, u_log = UpdateLog.from_app_data(app_data, distribution, for_py_version) for _, group in groupby(u_log.versions, key=lambda v: v.wheel.version_tuple[0:2]): version = next(group) # use only latest patch version per minor, earlier assumed to be buggy - if wheel is not None and version.filename.name == wheel.name: + if wheel is not None and Path(version.filename).name == wheel.name: break if u_log.periodic is False or version.use(now): updated_wheel = Wheel(app_data.house / version.filename) diff --git a/tests/unit/seed/wheels/test_periodic_update.py b/tests/unit/seed/wheels/test_periodic_update.py index d49199205..d41f0d77e 100644 --- a/tests/unit/seed/wheels/test_periodic_update.py +++ b/tests/unit/seed/wheels/test_periodic_update.py @@ -1,11 +1,12 @@ from __future__ import absolute_import, unicode_literals from datetime import datetime, timedelta -from itertools import zip_longest + +from six.moves import zip_longest from virtualenv import cli_run from virtualenv.seed.wheels.embed import BUNDLE_SUPPORT, get_embed_wheel -from virtualenv.seed.wheels.periodic_update import NewVersion, manual_upgrade, UpdateLog, periodic_update +from virtualenv.seed.wheels.periodic_update import NewVersion, UpdateLog, manual_upgrade, periodic_update def test_manual_upgrade(session_app_data, caplog, mocker, for_py_version): @@ -75,7 +76,7 @@ def test_periodic_update_latest_per_patch(mocker, session_app_data, for_py_versi versions=[ NewVersion(wheel_path(current, (0, 1, 2)), completed, now - timedelta(days=1)), NewVersion(wheel_path(current, (0, 1, 1)), completed, now - timedelta(days=30)), - NewVersion(filename=current.path, found_date=completed, release_date=now - timedelta(days=2)), + NewVersion(filename=str(current.path), found_date=completed, release_date=now - timedelta(days=2)), ], periodic=True, ) @@ -88,4 +89,4 @@ def test_periodic_update_latest_per_patch(mocker, session_app_data, for_py_versi def wheel_path(wheel, of): new_version = ".".join(str(i) for i in (tuple(sum(x) for x in zip_longest(wheel.version_tuple, of, fillvalue=0)))) new_name = wheel.name.replace(wheel.version, new_version) - return wheel.path.parent / new_name + return str(wheel.path.parent / new_name)