Skip to content

Commit 111dfd4

Browse files
committed
PR Feedback
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
1 parent dbb6347 commit 111dfd4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/virtualenv/seed/wheels/periodic_update.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def periodic_update(distribution, of_version, for_py_version, wheel, search_dirs
4242

4343
now = datetime.now()
4444

45+
def _update_wheel(ver):
46+
updated_wheel = Wheel(app_data.house / ver.filename)
47+
logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel)
48+
return updated_wheel
49+
4550
u_log = UpdateLog.from_app_data(app_data, distribution, for_py_version)
4651
u_log_older_than_hour = now - u_log.completed > timedelta(hours=1) if u_log.completed is not None else False
4752
if of_version is None:
@@ -50,16 +55,12 @@ def periodic_update(distribution, of_version, for_py_version, wheel, search_dirs
5055
if wheel is not None and Path(version.filename).name == wheel.name:
5156
break
5257
if u_log.periodic is False or (u_log_older_than_hour and version.use(now)):
53-
updated_wheel = Wheel(app_data.house / version.filename)
54-
logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel)
55-
wheel = updated_wheel
58+
wheel = _update_wheel(version)
5659
break
5760
elif u_log.periodic is False or u_log_older_than_hour:
5861
for version in u_log.versions:
5962
if version.wheel.version == of_version:
60-
updated_wheel = Wheel(app_data.house / version.filename)
61-
logging.debug("using %supdated wheel %s", "periodically " if updated_wheel else "", updated_wheel)
62-
wheel = updated_wheel
63+
wheel = _update_wheel(version)
6364
break
6465

6566
return wheel

0 commit comments

Comments
 (0)