Skip to content

Commit 003f591

Browse files
authored
Merge pull request #150 from desultory/dev
bup ver
2 parents 93253d4 + 9acd98d commit 003f591

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ugrd"
7-
version = "1.28.2"
7+
version = "1.29.0"
8+
89
authors = [
910
{ name="Desultory", email="[email protected]" },
1011
]

src/ugrd/base/core.py

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
__author__ = "desultory"
2-
__version__ = "3.11.3"
2+
__version__ = "3.11.4"
33

44
from pathlib import Path
55
from typing import Union
66

7-
from zenlib.util import contains, colorize
87
from zenlib.types import NoDupFlatList
8+
from zenlib.util import colorize, contains
9+
910

1011
def detect_tmpdir(self) -> None:
1112
"""Reads TMPDIR from the environment, sets it as the temporary directory."""
@@ -37,7 +38,7 @@ def generate_structure(self) -> None:
3738

3839

3940
def calculate_dependencies(self, binary: str) -> list[Path]:
40-
""" Calculates the dependencies of a binary using lddtree
41+
"""Calculates the dependencies of a binary using lddtree
4142
:param binary: The binary to calculate dependencies for
4243
:return: A list of dependency paths
4344
"""
@@ -54,7 +55,9 @@ def calculate_dependencies(self, binary: str) -> list[Path]:
5455
dependencies = run(["lddtree", "-l", str(binary_path)], capture_output=True)
5556

5657
if dependencies.returncode != 0:
57-
self.logger.warning("Unable to calculate dependencies for: %s" % colorize(binary, "red", bold=True, bright=True))
58+
self.logger.warning(
59+
"Unable to calculate dependencies for: %s" % colorize(binary, "red", bold=True, bright=True)
60+
)
5861
raise RuntimeError("Unable to resolve dependencies, error: %s" % dependencies.stderr.decode("utf-8"))
5962

6063
dependency_paths = []
@@ -202,7 +205,7 @@ def _process_out_file(self, out_file: str) -> None:
202205
self["out_dir"] = current_dir
203206
return
204207

205-
if "/" in out_file: # If the out_file contains a path, resolve it
208+
if "/" in out_file: # If the out_file contains a path, resolve it
206209
out_file = Path(out_file).resolve()
207210
self.logger.info("Resolved relative output path: %s" % out_file)
208211
else:
@@ -222,7 +225,7 @@ def _process_out_file(self, out_file: str) -> None:
222225

223226

224227
def _process_paths_multi(self, path: Union[Path, str]) -> None:
225-
""" Processes a path entry.
228+
"""Processes a path entry.
226229
Converts the input to a Path if it is not one.
227230
Checks if the path is absolute, and if so, converts it to a relative path.
228231
"""
@@ -278,10 +281,9 @@ def _validate_dependency(self, dependency: Union[Path, str]) -> None:
278281

279282

280283
def _process_dependencies_multi(self, dependency: Union[Path, str]) -> None:
281-
""" Processes dependencies.
284+
"""Processes dependencies.
282285
Converts the input to a Path if it is not one, checks if it exists.
283-
If the dependency is a symlink, resolve it and add it to the symlinks list.
284-
"""
286+
If the dependency is a symlink, resolve it and add it to the symlinks list."""
285287
dependency = _validate_dependency(self, dependency)
286288

287289
if dependency.is_dir():
@@ -315,7 +317,7 @@ def _process_opt_dependencies_multi(self, dependency: Union[Path, str]) -> None:
315317

316318

317319
def _process_xz_dependencies_multi(self, dependency: Union[Path, str]) -> None:
318-
""" Processes xz dependencies.
320+
"""Processes xz dependencies.
319321
Checks that the file is a xz file, and adds it to the xz dependencies list.
320322
!! Resolves symlinks implicitly !!
321323
"""
@@ -326,7 +328,7 @@ def _process_xz_dependencies_multi(self, dependency: Union[Path, str]) -> None:
326328

327329

328330
def _process_gz_dependencies_multi(self, dependency: Union[Path, str]) -> None:
329-
""" Processes gzip dependencies.
331+
"""Processes gzip dependencies.
330332
Checks that the file is a gz file, and adds it to the gz dependencies list.
331333
!! Resolves symlinks implicitly !!
332334
"""
@@ -349,9 +351,7 @@ def _process_build_logging(self, log_build: bool) -> None:
349351

350352

351353
def _process_copies_multi(self, name: str, parameters: dict) -> None:
352-
"""Processes a copy from the copies parameter
353-
Ensures the source and target are defined in the parameters.
354-
"""
354+
"""Processes a copy from the copies parameter. Ensures the source and target are defined in the parameters."""
355355
self.logger.log(5, "[%s] Processing copies: %s" % (name, parameters))
356356
if "source" not in parameters:
357357
raise ValueError("[%s] No source specified" % name)
@@ -363,9 +363,7 @@ def _process_copies_multi(self, name: str, parameters: dict) -> None:
363363

364364

365365
def _process_symlinks_multi(self, name: str, parameters: dict) -> None:
366-
"""Processes a symlink.
367-
Ensures the source and target are defined in the parameters.
368-
"""
366+
"""Processes a symlink. Ensures the source and target are defined in the parameters."""
369367
self.logger.log(5, "[%s] Processing symlink: %s" % (name, parameters))
370368
if "source" not in parameters:
371369
raise ValueError("[%s] No source specified" % name)
@@ -377,9 +375,7 @@ def _process_symlinks_multi(self, name: str, parameters: dict) -> None:
377375

378376

379377
def _process_nodes_multi(self, name: str, config: dict) -> None:
380-
"""Process a device node.
381-
Validates the major and minor are defined in the parameters.
382-
"""
378+
"""Process a device node. Ensures the major and minor are defined in the parameters."""
383379
if "major" not in config:
384380
raise ValueError("[%s] No major specified" % name)
385381
if "minor" not in config:
@@ -398,7 +394,7 @@ def _process_nodes_multi(self, name: str, config: dict) -> None:
398394

399395

400396
def _process_masks_multi(self, runlevel: str, function: str) -> None:
401-
"""Processes a mask definition."""
397+
"""Processes a mask definition. Masks are used to prevent functions from being run at a specific runlevel."""
402398
if runlevel not in self["masks"]:
403399
self.logger.debug("Creating new mask: %s" % runlevel)
404400
self["masks"][runlevel] = NoDupFlatList(logger=self.logger)
@@ -408,8 +404,7 @@ def _process_masks_multi(self, runlevel: str, function: str) -> None:
408404

409405
def _process_hostonly(self, hostonly: bool) -> None:
410406
"""Processes the hostonly parameter.
411-
If validation is enabled, and hostonly mode is set to disabled, disable validation and warn.
412-
"""
407+
If validation is enabled, and hostonly mode is set to disabled, disable validation and warn."""
413408
self.logger.debug("Processing hostonly: %s" % hostonly)
414409
self.data["hostonly"] = hostonly
415410
if not hostonly and self["validate"]:
@@ -419,8 +414,7 @@ def _process_hostonly(self, hostonly: bool) -> None:
419414

420415
def _process_validate(self, validate: bool) -> None:
421416
"""Processes the validate parameter.
422-
It should only be allowed if hostonly mode is enabled.
423-
"""
417+
Only allowed if hostonly mode is enabled."""
424418
self.logger.debug("Processing validate: %s" % validate)
425419
if not self["hostonly"] and validate:
426420
raise ValueError("Cannot enable validation when hostonly mode is disabled")

0 commit comments

Comments
 (0)