From 77d5af574a6e310bb7ad07501707d9d050794aba Mon Sep 17 00:00:00 2001 From: Vaughn Kottler Date: Thu, 20 Apr 2023 20:09:58 -0500 Subject: [PATCH] 1.1.1 - Fix some minor bugs --- README.md | 4 ++-- local/variables/package.yaml | 2 +- pyproject.toml | 2 +- rcmpy/__init__.py | 4 ++-- rcmpy/environment/template.py | 5 ++++- rcmpy/state/__init__.py | 11 +++++++++-- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 927dbd5..eee1519 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ ===================================== generator=datazen version=3.1.2 - hash=d6cd0e307dd25044b7eb3a7adaf13b33 + hash=e17a2a1feecf3316dd227e4ef69c4351 ===================================== --> -# rcmpy ([1.1.0](https://pypi.org/project/rcmpy/)) +# rcmpy ([1.1.1](https://pypi.org/project/rcmpy/)) [![python](https://img.shields.io/pypi/pyversions/rcmpy.svg)](https://pypi.org/project/rcmpy/) ![Build Status](https://github.com/vkottler/rcmpy/workflows/Python%20Package/badge.svg) diff --git a/local/variables/package.yaml b/local/variables/package.yaml index 753387c..1de4416 100644 --- a/local/variables/package.yaml +++ b/local/variables/package.yaml @@ -1,5 +1,5 @@ --- major: 1 minor: 1 -patch: 0 +patch: 1 entry: rcmpy diff --git a/pyproject.toml b/pyproject.toml index 141579e..0ace383 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__" [project] name = "rcmpy" -version = "1.1.0" +version = "1.1.1" description = "A configuration-file management system." readme = "README.md" requires-python = ">=3.7" diff --git a/rcmpy/__init__.py b/rcmpy/__init__.py index 8fd1da4..70bdd8a 100644 --- a/rcmpy/__init__.py +++ b/rcmpy/__init__.py @@ -1,7 +1,7 @@ # ===================================== # generator=datazen # version=3.1.2 -# hash=db6b75d059437ccfb73620d52efc9103 +# hash=8cf27e726efd71565b56531e6b4da766 # ===================================== """ @@ -10,4 +10,4 @@ DESCRIPTION = "A configuration-file management system." PKG_NAME = "rcmpy" -VERSION = "1.1.0" +VERSION = "1.1.1" diff --git a/rcmpy/environment/template.py b/rcmpy/environment/template.py index 674f9ed..e76b1d7 100644 --- a/rcmpy/environment/template.py +++ b/rcmpy/environment/template.py @@ -92,7 +92,10 @@ def _init_templates(self, template_names: Set[str]) -> bool: that may be relevant to some task. """ - candidates = self.state.root_directories("templates") + # The variant's template directory takes precedence. + candidates = self.state.root_directories( + "templates", common_first=False + ) # Prefer variant templates, if the variant template-directory # exists. diff --git a/rcmpy/state/__init__.py b/rcmpy/state/__init__.py index 2c7af25..b015b0e 100644 --- a/rcmpy/state/__init__.py +++ b/rcmpy/state/__init__.py @@ -86,7 +86,9 @@ def update_manifest(self, data: Dict[str, Any]) -> None: self.manifest_new = self.manifest != data self.manifest = data - def root_directories(self, subdir: str) -> List[Path]: + def root_directories( + self, subdir: str, common_first: bool = True + ) -> List[Path]: """ Get up to a pair of directories from some sub-directory of the current root. @@ -96,7 +98,10 @@ def root_directories(self, subdir: str) -> List[Path]: candidates = [root.joinpath("common")] if self.variant: - candidates.insert(0, root.joinpath(self.variant)) + if common_first: + candidates.append(root.joinpath(self.variant)) + else: + candidates.insert(0, root.joinpath(self.variant)) return [x for x in candidates if x.is_dir()] @@ -124,6 +129,7 @@ def preprocessor(stream: DataStream) -> DataStream: expect_overwrite=True, preprocessor=preprocessor, ).data, + expect_overwrite=True, logger=self.logger, ) @@ -147,6 +153,7 @@ def _load_variables(self) -> None: includes_key="includes", expect_overwrite=True, ).data, + expect_overwrite=True, logger=self.logger, )