Skip to content

Commit f888d06

Browse files
committed
use more absolute
1 parent 3d3d601 commit f888d06

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

bin/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@
9393
SEED_DEPENDENCY_RETRIES: Final[int] = 10
9494

9595
# The root directory of the BAPCtools repository.
96-
TOOLS_ROOT: Final[Path] = Path(__file__).resolve().parent.parent
96+
TOOLS_ROOT: Final[Path] = Path(__file__).absolute().parent.parent
9797

9898
# The directory from which BAPCtools is invoked.
99-
current_working_directory: Final[Path] = Path.cwd().resolve()
99+
current_working_directory: Final[Path] = Path.cwd().absolute()
100100

101101
# Add third_party/ to the $PATH for checktestdata.
102102
os.environ["PATH"] += os.pathsep + str(TOOLS_ROOT / "third_party")

bin/problem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class Problem:
341341

342342
def __init__(self, path: Path, tmpdir: Path, label: Optional[str] = None):
343343
# The problem name/shortname, which is the name of the directory and used as a display name.
344-
self.name = path.resolve().name
344+
self.name = path.name
345345
# The Path of the problem directory.
346346
self.path = path
347347
self.tmpdir: Path = tmpdir / self.name

bin/skel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ def git(*args):
290290
error("not inside git")
291291
return
292292

293-
git_root_path = Path(git("rev-parse", "--show-toplevel").strip()).resolve()
293+
git_root_path = Path(git("rev-parse", "--show-toplevel").strip()).absolute()
294294

295295
def problem_source_dir(problem: Problem) -> Path:
296-
return problem.path.resolve().relative_to(git_root_path)
296+
return problem.path.absolute().relative_to(git_root_path)
297297

298298
if config.args.latest_bt:
299299
header_yml = (config.TOOLS_ROOT / "skel/gitlab_ci/header_latest_bt.yaml").read_text()
@@ -302,7 +302,7 @@ def problem_source_dir(problem: Problem) -> Path:
302302
print(header_yml)
303303

304304
contest_yml = (config.TOOLS_ROOT / "skel/gitlab_ci/contest.yaml").read_text()
305-
contest_path = Path(".").resolve().relative_to(git_root_path)
305+
contest_path = Path(".").absolute().relative_to(git_root_path)
306306
changes = "".join(
307307
f" - {problem_source_dir(problem)}/{pdf_type.path().parent}/**/*\n"
308308
for problem in problems

bin/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def is_problem_directory(path):
8787
level: Optional[Literal["problem", "problemset"]] = None
8888
if config.args.contest:
8989
# TODO #102: replace cast with typed Namespace field
90-
contest = cast(Path, config.args.contest).resolve()
90+
contest = cast(Path, config.args.contest).absolute()
9191
os.chdir(contest)
9292
level = "problemset"
9393
if config.args.problem:
9494
# TODO #102: replace cast with typed Namespace field
95-
problem = cast(Path, config.args.problem).resolve()
95+
problem = cast(Path, config.args.problem).absolute()
9696
level = "problem"
9797
os.chdir(problem.parent)
9898
elif is_problem_directory(Path(".")):

bin/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ def copytree_and_substitute(
11281128
pass
11291129
elif preserve_symlinks and os.path.islink(src):
11301130
shutil.copy(src, dst, follow_symlinks=False)
1131-
elif os.path.islink(src) and src.resolve().is_relative_to(base):
1131+
elif os.path.islink(src) and src.absolute().is_relative_to(base.absolute()):
11321132
shutil.copy(src, dst, follow_symlinks=False)
11331133
elif os.path.isdir(src):
11341134
names = os.listdir(src)

0 commit comments

Comments
 (0)