Skip to content

Commit

Permalink
fix: install one app at a time, frappe first
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Nov 29, 2022
1 parent 61e0f4a commit 4f0193c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions bench/utils/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,23 @@ def migrate_env(python, backup=False):
shutil.move(dest, target)

# Create virtualenv using specified python
venv_creation, packages_setup = 1, 1
def _install_app(app):
app_path = f"-e {os.path.join('apps', app)}"
exec_cmd(f"{pvenv}/bin/python -m pip install --upgrade {app_path}")

try:
logger.log(f"Setting up a New Virtual {python} Environment")
venv_creation = exec_cmd(f"{virtualenv} --python {python} {pvenv}")
exec_cmd(f"{virtualenv} --python {python} {pvenv}")

apps = " ".join([f"-e {os.path.join('apps', app)}" for app in bench.apps])
packages_setup = exec_cmd(f"{pvenv}/bin/python -m pip install --upgrade {apps}")
# Install frappe first
_install_app("frappe")
for app in bench.apps:
if str(app) != "frappe":
_install_app(app)

logger.log(f"Migration Successful to {python}")
except Exception:
if venv_creation or packages_setup:
logger.warning("Migration Error", exc_info=True)
logger.warning("Python env migration Error", exc_info=True)
raise


Expand Down

0 comments on commit 4f0193c

Please sign in to comment.