diff options
author | Bernát Gábor <gaborjbernat@gmail.com> | 2021-12-29 10:53:20 +0000 |
---|---|---|
committer | Bernát Gábor <gaborjbernat@gmail.com> | 2021-12-29 10:53:20 +0000 |
commit | 111dfd48d252edd8654fcc09a59f5bd5de9ce9fd (patch) | |
tree | f031c14b06cdea3eb1167421323c4ed60dd6c588 | |
parent | dbb6347e23ab30196d05fc3f0102a704b80d7a49 (diff) | |
download | virtualenv-111dfd48d252edd8654fcc09a59f5bd5de9ce9fd.tar.gz |
PR Feedback
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
-rw-r--r-- | src/virtualenv/seed/wheels/periodic_update.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/virtualenv/seed/wheels/periodic_update.py b/src/virtualenv/seed/wheels/periodic_update.py index 33a85a7..3ea764e 100644 --- a/src/virtualenv/seed/wheels/periodic_update.py +++ b/src/virtualenv/seed/wheels/periodic_update.py @@ -42,6 +42,11 @@ def periodic_update(distribution, of_version, for_py_version, wheel, search_dirs now = datetime.now() + def _update_wheel(ver): + updated_wheel = Wheel(app_data.house / ver.filename) + logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel) + return updated_wheel + u_log = UpdateLog.from_app_data(app_data, distribution, for_py_version) u_log_older_than_hour = now - u_log.completed > timedelta(hours=1) if u_log.completed is not None else False if of_version is None: @@ -50,16 +55,12 @@ def periodic_update(distribution, of_version, for_py_version, wheel, search_dirs if wheel is not None and Path(version.filename).name == wheel.name: break if u_log.periodic is False or (u_log_older_than_hour and version.use(now)): - updated_wheel = Wheel(app_data.house / version.filename) - logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel) - wheel = updated_wheel + wheel = _update_wheel(version) break elif u_log.periodic is False or u_log_older_than_hour: for version in u_log.versions: if version.wheel.version == of_version: - updated_wheel = Wheel(app_data.house / version.filename) - logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel) - wheel = updated_wheel + wheel = _update_wheel(version) break return wheel |