Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Exit bench init early if Frappe or other apps installed incorrectly #1083

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion bench/app.py
Expand Up @@ -174,7 +174,13 @@ def install_app(app, bench_path=".", verbose=False, no_cache=False, restart_benc
app_path = os.path.join(bench_path, "apps", app)
cache_flag = "--no-cache-dir" if no_cache else ""

exec_cmd("{pip} install {quiet} -U -e {app} {no_cache}".format(pip=pip_path, quiet=quiet_flag, app=app_path, no_cache=cache_flag))
pip_install_code = exec_cmd(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ceefour Indentation error

"{pip} install {quiet} -U -e {app} {no_cache}".format(
pip=pip_path, quiet=quiet_flag, app=app_path, no_cache=cache_flag
)
)
if pip_install_code:
sys.exit(pip_install_code)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a screenshot of how this would execute now, after this change?


if os.path.exists(os.path.join(app_path, 'package.json')):
exec_cmd("yarn install", cwd=app_path)
Expand Down
2 changes: 2 additions & 0 deletions bench/utils.py
Expand Up @@ -305,6 +305,7 @@ def setup_app(app):


def exec_cmd(cmd, cwd='.'):
"""Executes cmd with cwd via subprocess.call and returns the process exit code"""
import shlex
print("{0}$ {1}{2}".format(color.silver, cmd, color.nc))
cwd_info = "cd {0} && ".format(cwd) if cwd != "." else ""
Expand All @@ -314,6 +315,7 @@ def exec_cmd(cmd, cwd='.'):
return_code = subprocess.call(cmd, cwd=cwd, universal_newlines=True)
if return_code:
logger.warning("{0} executed with exit code {1}".format(cmd_log, return_code))
return return_code


def which(executable, raise_err = False):
Expand Down