]> git.madduck.net Git - etc/vim.git/blobdiff - action/main.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Bump furo from 2023.7.26 to 2023.8.19 in /docs + sphinx to 7.2.3 (#3848)
[etc/vim.git] / action / main.py
index 23c3a652194f20049eec3183f93067443b594507..c0af3930dbbe6f31745e941712e81df3ddb2cae3 100644 (file)
@@ -1,5 +1,6 @@
 import os
 import shlex
 import os
 import shlex
+import shutil
 import sys
 from pathlib import Path
 from subprocess import PIPE, STDOUT, run
 import sys
 from pathlib import Path
 from subprocess import PIPE, STDOUT, run
@@ -32,7 +33,7 @@ else:
                 describe_name = line[len("describe-name: ") :].rstrip()
                 break
     if not describe_name:
                 describe_name = line[len("describe-name: ") :].rstrip()
                 break
     if not describe_name:
-        print("::error::Failed to detect action version.", flush=True)
+        print("::error::Failed to detect action version.", file=sys.stderr, flush=True)
         sys.exit(1)
     # expected format is one of:
     # - 23.1.0
         sys.exit(1)
     # expected format is one of:
     # - 23.1.0
@@ -53,15 +54,26 @@ pip_proc = run(
 )
 if pip_proc.returncode:
     print(pip_proc.stdout)
 )
 if pip_proc.returncode:
     print(pip_proc.stdout)
-    print("::error::Failed to install Black.", flush=True)
+    print("::error::Failed to install Black.", file=sys.stderr, flush=True)
     sys.exit(pip_proc.returncode)
 
 
 base_cmd = [str(ENV_BIN / "black")]
 if BLACK_ARGS:
     # TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.
     sys.exit(pip_proc.returncode)
 
 
 base_cmd = [str(ENV_BIN / "black")]
 if BLACK_ARGS:
     # TODO: remove after a while since this is deprecated in favour of SRC + OPTIONS.
-    proc = run([*base_cmd, *shlex.split(BLACK_ARGS)])
+    proc = run(
+        [*base_cmd, *shlex.split(BLACK_ARGS)],
+        stdout=PIPE,
+        stderr=STDOUT,
+        encoding="utf-8",
+    )
 else:
 else:
-    proc = run([*base_cmd, *shlex.split(OPTIONS), *shlex.split(SRC)])
-
+    proc = run(
+        [*base_cmd, *shlex.split(OPTIONS), *shlex.split(SRC)],
+        stdout=PIPE,
+        stderr=STDOUT,
+        encoding="utf-8",
+    )
+shutil.rmtree(ENV_PATH, ignore_errors=True)
+print(proc.stdout)
 sys.exit(proc.returncode)
 sys.exit(proc.returncode)