mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
datasette install --upgrade option, closes #945
This commit is contained in:
parent
b21ed237ab
commit
69033c6ec4
3 changed files with 27 additions and 3 deletions
|
|
@ -235,9 +235,16 @@ def package(
|
|||
|
||||
@cli.command()
|
||||
@click.argument("packages", nargs=-1, required=True)
|
||||
def install(packages):
|
||||
@click.option(
|
||||
"-U", "--upgrade", is_flag=True, help="Upgrade packages to latest version"
|
||||
)
|
||||
def install(packages, upgrade):
|
||||
"Install Python packages - e.g. Datasette plugins - into the same environment as Datasette"
|
||||
sys.argv = ["pip", "install"] + list(packages)
|
||||
args = ["pip", "install"]
|
||||
if upgrade:
|
||||
args += ["--upgrade"]
|
||||
args += list(packages)
|
||||
sys.argv = args
|
||||
run_module("pip", run_name="__main__")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue