2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-09 08:30:39 +00:00

feat: bench pip *

Directly install/update/remove packages from your env using bench pip
commands. Pretty much just like using pip

To check help don't add the --help flag, use the -h flag instead, use the pip help command. For example, checking help for pip install can be done by

    bench pip help install
    bench pip install -h
This commit is contained in:
Gavin D'souza 2020-02-06 15:03:29 +05:30
parent 50ef73933c
commit f0596c5928
2 changed files with 13 additions and 1 deletions

View File

@ -31,11 +31,12 @@ def bench_command(bench_path='.'):
setup_logging(bench_path=bench_path)
from bench.commands.make import init, get_app, new_app, remove_app
from bench.commands.make import init, get_app, new_app, remove_app, pip
bench_command.add_command(init)
bench_command.add_command(get_app)
bench_command.add_command(new_app)
bench_command.add_command(remove_app)
bench_command.add_command(pip)
from bench.commands.update import update, retry_upgrade, switch_to_branch, switch_to_master, switch_to_develop

View File

@ -93,3 +93,14 @@ def include_app_for_update(app_name):
"Include app from updating"
from bench.app import remove_from_excluded_apps_txt
remove_from_excluded_apps_txt(app_name)
@click.command('pip', context_settings={"ignore_unknown_options": True}, help="For pip help use `bench pip help [COMMAND]` or `bench pip [COMMAND] -h`")
@click.argument('args', nargs=-1)
@click.pass_context
def pip(ctx, args):
"Run pip commands in bench env"
import os
from bench.utils import get_env_cmd
env_pip = get_env_cmd('pip')
os.execv(env_pip, (env_pip,) + args)