From 306749b6a4c696709fcc3858cae6f8d1aa86a761 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Sun, 1 Jun 2025 17:21:09 +0200 Subject: [PATCH] Fix issue. --- pyproject.toml | 3 --- src/pytask_latex/compilation_steps.py | 5 +--- src/pytask_latex/path.py | 37 --------------------------- 3 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 src/pytask_latex/path.py diff --git a/pyproject.toml b/pyproject.toml index 3db50d2..c6211ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,9 +39,6 @@ typing = [ [project.entry-points.pytask] pytask_latex = "pytask_latex.plugin" -[tool.rye] -managed = true - [tool.hatch.build.hooks.vcs] version-file = "src/pytask_latex/_version.py" diff --git a/src/pytask_latex/compilation_steps.py b/src/pytask_latex/compilation_steps.py index f8cbc5e..6101905 100644 --- a/src/pytask_latex/compilation_steps.py +++ b/src/pytask_latex/compilation_steps.py @@ -18,7 +18,6 @@ def compilation_step(path_to_tex: Path, path_to_document: Path): from typing import Any from typing import Callable -from pytask_latex.path import relative_to from pytask_latex.utils import to_list if TYPE_CHECKING: @@ -38,9 +37,7 @@ def latexmk( def run_latexmk(path_to_tex: Path, path_to_document: Path) -> None: job_name_opt = [f"--jobname={path_to_document.stem}"] - out_dir_opt = [ - f"--output-directory={relative_to(path_to_tex, path_to_document.parent)}" - ] + out_dir_opt = [f"--output-directory={path_to_document.parent.as_posix()}"] cmd = ["latexmk", *options, *job_name_opt, *out_dir_opt, path_to_tex.as_posix()] subprocess.run(cmd, check=True) # noqa: S603 diff --git a/src/pytask_latex/path.py b/src/pytask_latex/path.py deleted file mode 100644 index 332920f..0000000 --- a/src/pytask_latex/path.py +++ /dev/null @@ -1,37 +0,0 @@ -"""Contains functions related to handling paths.""" - -from __future__ import annotations - -import os -from pathlib import Path - - -def relative_to(path: Path, relative_to_: Path) -> str: - """Create a relative path from one path to another as a string. - - The output folder needs to be declared as a relative path to the directory where - the latex source lies. - - 1. It must be relative because bibtex / biber, which is necessary for - bibliographies, does not accept full paths as a safety measure. - 2. Due to the ``--cd`` flag, latexmk will change the directory to the one where the - source files are. Thus, relative to the latex sources. - - See this `discussion on Github - `_ - for additional information. - - Example - ------- - >>> import sys - >>> from pathlib import Path - >>> if sys.platform == "win32": - ... p = Path("C:/Users/user/documents/file.tex") - ... else: - ... p = Path("/home/user/documents/file.tex") - >>> out = p.parents[2].joinpath("bld", "docs") - >>> relative_to(p, out) - '../../bld/docs' - - """ - return Path(os.path.relpath(relative_to_, path.parent)).as_posix()