From 47a9aca0e705c7f493bbea0724b56333652d2982 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Tue, 29 Jan 2019 23:52:31 +0530 Subject: [PATCH] fix: importing reload caused issues in python2 --- bench/app.py | 8 +++++--- bench/commands/update.py | 11 +++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bench/app.py b/bench/app.py index ae57cb7c..2ff048b7 100755 --- a/bench/app.py +++ b/bench/app.py @@ -379,12 +379,14 @@ def switch_branch(branch, apps=None, bench_path='.', upgrade=False, check_upgrad print("Successfully switched branches for:\n" + "\n".join(switched_apps)) if version_upgrade[0] and upgrade: - if sys.version_info >= (3, 4): - from importlib import reload - reload(utils) update_requirements() update_node_packages() pre_upgrade(version_upgrade[1], version_upgrade[2]) + if sys.version_info >= (3, 4): ++ import importlib + importlib.reload(utils) + else: + reload(utils) backup_all_sites() patch_sites() build_assets() diff --git a/bench/commands/update.py b/bench/commands/update.py index db0f478d..94f85983 100755 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -77,13 +77,16 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False update_node_packages(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): - if sys.version_info >= (3, 4): - from importlib import reload pre_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) import bench.utils, bench.app print('Reloading bench...') - reload(bench.utils) - reload(bench.app) + if sys.version_info >= (3, 4): ++ import importlib + importlib.reload(bench.utils) + importlib.reload(bench.app) + else: + reload(bench.utils) + reload(bench.app) if patch: if not no_backup: