Skip to content

Commit 423d3a1

Browse files
committed
assume any "out_file" with a / in it should not be under a tmpdir
previously, ./ had to be explictly passed for the out_dir to be updated, and the tmpdir not be used. This broke running make install from the /usr/src/linux dir, as it passes a path like arch/boot/initrd which then got interpreted to be a new out_dir, under the tmpdir. Signed-off-by: Zen <[email protected]>
1 parent 7eccb32 commit 423d3a1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ugrd/base/core.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "3.11.0"
2+
__version__ = "3.11.1"
33

44
from pathlib import Path
55
from typing import Union
@@ -192,7 +192,7 @@ def _process_out_file(self, out_file: str) -> None:
192192
"""Processes the out_file.
193193
194194
If set to the current directory, resolves and sets the out_dir to the current directory.
195-
If it starts with './', resolves it to the current directory.
195+
If a '/' is present, resolves the path and sets the out_dir to the parent directory.
196196
If out_file is a directory, sets the out_dir to the directory, stops processing.
197197
198198
If it's an absolute path, sets the out_dir to the parent directory.
@@ -205,10 +205,9 @@ def _process_out_file(self, out_file: str) -> None:
205205
self["out_dir"] = current_dir
206206
return
207207

208-
if out_file.startswith("./"):
209-
cwd = Path(".").resolve()
210-
self.logger.info("Resolved relative out_file path: %s" % cwd)
211-
out_file = cwd / out_file[2:]
208+
if "/" in out_file: # If the out_file contains a path, resolve it
209+
out_file = Path(out_file).resolve()
210+
self.logger.info("Resolved relative output path: %s" % out_file)
212211
else:
213212
out_file = Path(out_file)
214213

@@ -217,7 +216,7 @@ def _process_out_file(self, out_file: str) -> None:
217216
self["out_dir"] = out_file
218217
return
219218

220-
if out_file.parent.is_dir() and str(out_file.parent) != ".":
219+
if str(out_file.parent) != ".": # If the parent isn't the curent dir, set the out_dir to the parent
221220
self["out_dir"] = out_file.parent
222221
self.logger.info("Resolved out_dir to: %s" % self["out_dir"])
223222
out_file = out_file.name

0 commit comments

Comments
 (0)