Skip to content

Commit e506982

Browse files
mzuennimpsijm
authored andcommitted
use more absolute
1 parent ccc23b9 commit e506982

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
@@ -92,10 +92,10 @@
9292
SEED_DEPENDENCY_RETRIES: Final[int] = 10
9393

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

9797
# The directory from which BAPCtools is invoked.
98-
current_working_directory: Final[Path] = Path.cwd().resolve()
98+
current_working_directory: Final[Path] = Path.cwd().absolute()
9999

100100
# Add third_party/ to the $PATH for checktestdata.
101101
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
@@ -323,7 +323,7 @@ class Problem:
323323

324324
def __init__(self, path: Path, tmpdir: Path, label: Optional[str] = None):
325325
# The problem name/shortname, which is the name of the directory and used as a display name.
326-
self.name = path.resolve().name
326+
self.name = path.name
327327
# The Path of the problem directory.
328328
self.path = path
329329
self.tmpdir: Path = tmpdir / self.name

bin/skel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ def copy_skel_dir(problems: list[Problem]) -> None:
270270

271271
# NOTE: This is one of few places that prints to stdout instead of stderr.
272272
def create_gitlab_jobs(contest: str, problems: list[Problem]) -> None:
273-
git_root_path = Path(os.popen("git rev-parse --show-toplevel").read().strip()).resolve()
273+
git_root_path = Path(os.popen("git rev-parse --show-toplevel").read().strip()).absolute()
274274

275275
def problem_source_dir(problem: Problem) -> Path:
276-
return problem.path.resolve().relative_to(git_root_path)
276+
return problem.path.absolute().relative_to(git_root_path)
277277

278278
if config.args.latest_bt:
279279
header_yml = (config.TOOLS_ROOT / "skel/gitlab_ci/header_latest_bt.yaml").read_text()
@@ -282,7 +282,7 @@ def problem_source_dir(problem: Problem) -> Path:
282282
print(header_yml)
283283

284284
contest_yml = (config.TOOLS_ROOT / "skel/gitlab_ci/contest.yaml").read_text()
285-
contest_path = Path(".").resolve().relative_to(git_root_path)
285+
contest_path = Path(".").absolute().relative_to(git_root_path)
286286
changes = "".join(
287287
f" - {problem_source_dir(problem)}/{pdf_type.path().parent}/**/*\n"
288288
for problem in problems

bin/tools.py

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

bin/util.py

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

0 commit comments

Comments
 (0)