提交 75b57060 authored 作者: Ben Mares's avatar Ben Mares

Misc. ruff updates to versioneer.py

上级 ca0a1b60
...@@ -316,7 +316,7 @@ import re ...@@ -316,7 +316,7 @@ import re
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
from typing import Callable from collections.abc import Callable
import functools import functools
have_tomllib = True have_tomllib = True
...@@ -443,9 +443,9 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, ...@@ -443,9 +443,9 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
for command in commands: for command in commands:
try: try:
dispcmd = str([command] + args) dispcmd = str([command, *args])
# remember shell=False, so use git.cmd on windows, not just git # remember shell=False, so use git.cmd on windows, not just git
process = subprocess.Popen([command] + args, cwd=cwd, env=env, process = subprocess.Popen([command, *args], cwd=cwd, env=env,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=(subprocess.PIPE if hide_stderr stderr=(subprocess.PIPE if hide_stderr
else None), **popen_kwargs) else None), **popen_kwargs)
...@@ -1392,7 +1392,7 @@ def do_vcs_install(versionfile_source, ipy): ...@@ -1392,7 +1392,7 @@ def do_vcs_install(versionfile_source, ipy):
with open(".gitattributes", "a+") as fobj: with open(".gitattributes", "a+") as fobj:
fobj.write(f"{versionfile_source} export-subst\n") fobj.write(f"{versionfile_source} export-subst\n")
files.append(".gitattributes") files.append(".gitattributes")
run_command(GITS, ["add", "--"] + files) run_command(GITS, ["add", "--", *files])
def versions_from_parentdir(parentdir_prefix, root, verbose): def versions_from_parentdir(parentdir_prefix, root, verbose):
...@@ -2106,7 +2106,7 @@ def do_setup(): ...@@ -2106,7 +2106,7 @@ def do_setup():
cfg = get_config_from_root(root) cfg = get_config_from_root(root)
except (OSError, configparser.NoSectionError, except (OSError, configparser.NoSectionError,
configparser.NoOptionError) as e: configparser.NoOptionError) as e:
if isinstance(e, (OSError, configparser.NoSectionError)): if isinstance(e, OSError | configparser.NoSectionError):
print("Adding sample versioneer config to setup.cfg", print("Adding sample versioneer config to setup.cfg",
file=sys.stderr) file=sys.stderr)
with open(os.path.join(root, "setup.cfg"), "a") as f: with open(os.path.join(root, "setup.cfg"), "a") as f:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论