X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/e401b6bb1e1c0ed534bba59d9dc908caf7ba898c..f3b1a3b9d2fc6de8f0845399cb80d8bdfd6400fd:/action/main.py?ds=inline diff --git a/action/main.py b/action/main.py index d14b10f..ff9d411 100644 --- a/action/main.py +++ b/action/main.py @@ -2,21 +2,27 @@ import os import shlex import sys from pathlib import Path -from subprocess import run, PIPE, STDOUT +from subprocess import PIPE, STDOUT, run ACTION_PATH = Path(os.environ["GITHUB_ACTION_PATH"]) ENV_PATH = ACTION_PATH / ".black-env" ENV_BIN = ENV_PATH / ("Scripts" if sys.platform == "win32" else "bin") OPTIONS = os.getenv("INPUT_OPTIONS", default="") SRC = os.getenv("INPUT_SRC", default="") +JUPYTER = os.getenv("INPUT_JUPYTER") == "true" BLACK_ARGS = os.getenv("INPUT_BLACK_ARGS", default="") VERSION = os.getenv("INPUT_VERSION", default="") run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True) -req = "black[colorama]" -if VERSION: - req += f"=={VERSION}" +version_specifier = VERSION +if VERSION and VERSION[0] in "0123456789": + version_specifier = f"=={VERSION}" +if JUPYTER: + extra_deps = "[colorama,jupyter]" +else: + extra_deps = "[colorama]" +req = f"black{extra_deps}{version_specifier}" pip_proc = run( [str(ENV_BIN / "python"), "-m", "pip", "install", req], stdout=PIPE,