Apache Lucene open-source search software
Apply minimal fix for ruff rule PATH103 using Path.resolve (#14711)
Mariahc28e2702b1cf
diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.pyindex ace8f405384..f258f2b3b6b 100755--- a/dev-tools/scripts/buildAndPushRelease.py+++ b/dev-tools/scripts/buildAndPushRelease.py@@ -238,7 +238,7 @@ def pushLocal(version: str, root: str, rcNum: int, localDir: str):run("chmod -R a+rX-w .")print(" done!")- return "file://%s/%s" % (os.path.abspath(localDir), dir)+ return "file://%s/%s" % (Path(localDir).resolve(), dir)def read_version(_path: str):diff --git a/dev-tools/scripts/pyproject.toml b/dev-tools/scripts/pyproject.tomlindex c69cdff888c..b2a91acb00f 100644--- a/dev-tools/scripts/pyproject.toml+++ b/dev-tools/scripts/pyproject.toml@@ -95,7 +95,6 @@ ignore = ["PLW0602", # using global for variable but no assignment is done"PLW0603", # using global statement to update variable is discouraged"PLW2901", # loop variable overwritten by assignment target- "PTH100", # os.path.abspath should be replaced by Path.resolve"PTH104", # os.rename should be replaced by Path.rename"PTH107", # os.remove shoudl be replaced by Path.unlink"PTH109", # os.getcwd should be replaced by Path.cwddiff --git a/dev-tools/scripts/releaseWizard.py b/dev-tools/scripts/releaseWizard.pyindex e7a8edead17..eb2a772ba77 100755--- a/dev-tools/scripts/releaseWizard.py+++ b/dev-tools/scripts/releaseWizard.py@@ -1283,7 +1283,7 @@ def main():if root.startswith("~/"):release_root = os.path.expanduser(root)else:- release_root = os.path.abspath(root)+ release_root = str(Path(root).resolve())if not os.path.exists(release_root):try:print("Creating release root %s" % release_root)@@ -1306,7 +1306,7 @@ def main():y = yaml.load(open(os.path.join(script_path, "releaseWizard.yaml")), Loader=yaml.Loader)templates = y.get("templates")todo_list = y.get("groups")- state = ReleaseState(release_root, release_version, getScriptVersion())+ state = ReleaseState(str(release_root), release_version, getScriptVersion())state.init_todos(bootstrap_todos(todo_list))state.load()except Exception as e:@@ -1352,7 +1352,7 @@ def main():sys.path.append(os.path.dirname(__file__))-current_git_root = os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(__file__)), os.path.pardir, os.path.pardir))+current_git_root: str = str(Path(os.path.join(Path(os.path.dirname(__file__)).resolve(), os.path.pardir, os.path.pardir)).resolve())dry_run = Falsediff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.pyindex 28ee7ae0875..db83de1125e 100644--- a/dev-tools/scripts/scriptutil.py+++ b/dev-tools/scripts/scriptutil.py@@ -22,6 +22,7 @@ import timeimport urllib.requestfrom collections.abc import Callablefrom enum import Enum+from pathlib import Pathfrom re import Match, Patternfrom typing import Self, override@@ -188,7 +189,7 @@ version_prop_re = re.compile(r'baseVersion\s*=\s*([\'"])(.*)\1')def find_current_version():script_path = os.path.dirname(os.path.realpath(__file__))- top_level_dir = os.path.join(os.path.abspath("%s/" % script_path), os.path.pardir, os.path.pardir)+ top_level_dir = os.path.join(Path("%s/" % script_path).resolve(), os.path.pardir, os.path.pardir)match = version_prop_re.search(open("%s/build.gradle" % top_level_dir).read())assert matchreturn match.group(2).strip()diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex cf4c41ed616..4948a80514b 100755--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -447,7 +447,7 @@ def run(command: str, logFile: str):if cygwin:command = cygwinifyPaths(command)if os.system("%s > %s 2>&1" % (command, logFile)):- logPath = os.path.abspath(logFile)+ logPath: str = str(Path(logFile).resolve())print('\ncommand "%s" failed:' % command)printFileContents(logFile)raise RuntimeError('command "%s" failed; see log file %s' % (command, logPath))@@ -1023,7 +1023,7 @@ def parse_config():c.java = make_java_config(parser, c.test_alternative_java)if c.tmp_dir:- c.tmp_dir = os.path.abspath(c.tmp_dir)+ c.tmp_dir = str(Path(c.tmp_dir).resolve())else:tmp = "/tmp/smoke_lucene_%s_%s" % (c.version, c.revision)c.tmp_dir = tmp