anki/python/update.py

37 lines
643 B
Python
Raw Normal View History

2021-04-13 10:45:05 +02:00
# Copyright: Ankitects Pty Ltd and contributors
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
2020-11-02 11:39:42 +01:00
import os
2021-04-14 10:22:02 +02:00
import sys
2020-11-02 11:39:42 +01:00
import click
from piptools.scripts import compile
2020-11-02 11:39:42 +01:00
@click.group()
def cli():
pass
2020-11-02 11:39:42 +01:00
cli.add_command(compile.cli, "compile")
print("Updating deps...")
os.chdir(os.getenv("BUILD_WORKING_DIRECTORY"))
if pkg := os.getenv("PACKAGE"):
upgrade_args = ["--upgrade-package", pkg]
else:
upgrade_args = ["--upgrade"]
sys.argv[1:] = [
"compile",
"--allow-unsafe",
*upgrade_args,
"--no-header",
"--strip-extras",
2021-11-05 06:02:48 +01:00
"--generate-hashes",
"requirements.in",
]
2020-11-02 11:39:42 +01:00
cli()