plowman 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plowman/__init__.py +0 -0
- plowman/__main__.py +9 -0
- plowman/__version__.py +1 -0
- plowman/commands/__init__.py +0 -0
- plowman/commands/base.py +22 -0
- plowman/commands/sow.py +37 -0
- plowman/lib/__init__.py +0 -0
- plowman/lib/cli.py +44 -0
- plowman/lib/constants.py +4 -0
- plowman/lib/exceptions.py +10 -0
- plowman/py.typed +0 -0
- plowman-0.1.0.dist-info/LICENSE.md +11 -0
- plowman-0.1.0.dist-info/METADATA +64 -0
- plowman-0.1.0.dist-info/RECORD +16 -0
- plowman-0.1.0.dist-info/WHEEL +4 -0
- plowman-0.1.0.dist-info/entry_points.txt +2 -0
plowman/__init__.py
ADDED
|
File without changes
|
plowman/__main__.py
ADDED
plowman/__version__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
File without changes
|
plowman/commands/base.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from dj_settings.settings import ConfigParser
|
|
4
|
+
|
|
5
|
+
from plowman.lib.constants import CONFIG_PATH
|
|
6
|
+
from plowman.lib.exceptions import MissingConfigError
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseCommand:
|
|
10
|
+
__slots__ = ("config",)
|
|
11
|
+
|
|
12
|
+
def __init__(self) -> None:
|
|
13
|
+
self.config = self._get_config()
|
|
14
|
+
|
|
15
|
+
def _get_config(self) -> dict[Path, list[str]]:
|
|
16
|
+
if not CONFIG_PATH.exists():
|
|
17
|
+
raise MissingConfigError
|
|
18
|
+
config = ConfigParser([CONFIG_PATH]).data["config"]
|
|
19
|
+
return {Path(path): granaries for path, granaries in config.items()}
|
|
20
|
+
|
|
21
|
+
def run(self) -> None:
|
|
22
|
+
raise NotImplementedError
|
plowman/commands/sow.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import filecmp
|
|
4
|
+
import shutil
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
from plowman.commands.base import BaseCommand
|
|
8
|
+
from plowman.lib.constants import HOME
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SowCommand(BaseCommand):
|
|
15
|
+
__slots__ = ("verbosity",)
|
|
16
|
+
|
|
17
|
+
def __init__(self, verbosity: int) -> None:
|
|
18
|
+
super().__init__()
|
|
19
|
+
self.verbosity = verbosity
|
|
20
|
+
|
|
21
|
+
def sow_granary(self, granary_path: Path) -> None:
|
|
22
|
+
for file in granary_path.rglob("*"):
|
|
23
|
+
if file.is_dir():
|
|
24
|
+
continue
|
|
25
|
+
farm = HOME.joinpath(file.relative_to(granary_path)).parent
|
|
26
|
+
farm.mkdir(exist_ok=True, parents=True)
|
|
27
|
+
target = farm.joinpath(file.name)
|
|
28
|
+
if target.exists() and filecmp.cmp(file, target, shallow=False):
|
|
29
|
+
continue
|
|
30
|
+
|
|
31
|
+
target.unlink(missing_ok=True)
|
|
32
|
+
shutil.copy2(file, target)
|
|
33
|
+
|
|
34
|
+
def run(self) -> None:
|
|
35
|
+
for path, granaries in self.config.items():
|
|
36
|
+
for granary in granaries:
|
|
37
|
+
self.sow_granary(path.joinpath(granary))
|
plowman/lib/__init__.py
ADDED
|
File without changes
|
plowman/lib/cli.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from argparse import ArgumentParser
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
from plowman.__version__ import __version__
|
|
7
|
+
|
|
8
|
+
sys.tracebacklimit = 0
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True, slots=True)
|
|
12
|
+
class PlowmanArgs:
|
|
13
|
+
subcommand: Literal["sow"]
|
|
14
|
+
verbosity: int
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def parse_args() -> PlowmanArgs:
|
|
18
|
+
parser = ArgumentParser(prog="plowman", description="Dotfile farm manager")
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"-V",
|
|
21
|
+
"--version",
|
|
22
|
+
action="version",
|
|
23
|
+
version=f"%(prog)s {__version__}",
|
|
24
|
+
help="print the version and exit",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
parent_parser = ArgumentParser(add_help=False)
|
|
28
|
+
parent_parser.add_argument(
|
|
29
|
+
"-v",
|
|
30
|
+
"--verbose",
|
|
31
|
+
action="count",
|
|
32
|
+
default=0,
|
|
33
|
+
dest="verbosity",
|
|
34
|
+
help="increase the level of verbosity",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
subparsers = parser.add_subparsers(dest="subcommand", required=True)
|
|
38
|
+
subparsers.add_parser("sow", parents=[parent_parser])
|
|
39
|
+
|
|
40
|
+
args = parser.parse_args()
|
|
41
|
+
if args.verbosity > 0:
|
|
42
|
+
sys.tracebacklimit = 1000
|
|
43
|
+
|
|
44
|
+
return PlowmanArgs(subcommand=args.subcommand, verbosity=args.verbosity)
|
plowman/lib/constants.py
ADDED
plowman/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Stephanos Kuma.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: plowman
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dotfile farm manager
|
|
5
|
+
Home-page: https://plowman.readthedocs.io/en/stable/
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Keywords: dotfiles
|
|
8
|
+
Author: Stephanos Kuma
|
|
9
|
+
Author-email: "Stephanos Kuma" <stephanos@kuma.ai>
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Classifier: Development Status :: 1 - Planning
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Requires-Dist: dj-settings (~=8.0)
|
|
17
|
+
Requires-Dist: jinja2 (~=3.1)
|
|
18
|
+
Requires-Dist: pyutilkit (~=0.10)
|
|
19
|
+
Project-URL: Documentation, https://plowman.readthedocs.io/en/stable/
|
|
20
|
+
Project-URL: Repository, https://github.com/spapanik/plowman/
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# plowman: Dotfile farm manager
|
|
24
|
+
|
|
25
|
+
[![build][build_badge]][build_url]
|
|
26
|
+
[![lint][lint_badge]][lint_url]
|
|
27
|
+
[![tests][tests_badge]][tests_url]
|
|
28
|
+
[![license][licence_badge]][licence_url]
|
|
29
|
+
[![codecov][codecov_badge]][codecov_url]
|
|
30
|
+
[![readthedocs][readthedocs_badge]][readthedocs_url]
|
|
31
|
+
[![pypi][pypi_badge]][pypi_url]
|
|
32
|
+
[![downloads][pepy_badge]][pepy_url]
|
|
33
|
+
[![build automation: yam][yam_badge]][yam_url]
|
|
34
|
+
[![Lint: ruff][ruff_badge]][ruff_url]
|
|
35
|
+
|
|
36
|
+
Long project description and tldr goes here
|
|
37
|
+
|
|
38
|
+
## Links
|
|
39
|
+
|
|
40
|
+
- [Documentation]
|
|
41
|
+
- [Changelog]
|
|
42
|
+
|
|
43
|
+
[build_badge]: https://github.com/spapanik/plowman/actions/workflows/build.yml/badge.svg
|
|
44
|
+
[build_url]: https://github.com/spapanik/plowman/actions/workflows/build.yml
|
|
45
|
+
[lint_badge]: https://github.com/spapanik/plowman/actions/workflows/lint.yml/badge.svg
|
|
46
|
+
[lint_url]: https://github.com/spapanik/plowman/actions/workflows/lint.yml
|
|
47
|
+
[tests_badge]: https://github.com/spapanik/plowman/actions/workflows/tests.yml/badge.svg
|
|
48
|
+
[tests_url]: https://github.com/spapanik/plowman/actions/workflows/tests.yml
|
|
49
|
+
[licence_badge]: https://img.shields.io/pypi/l/plowman
|
|
50
|
+
[licence_url]: https://plowman.readthedocs.io/en/stable/LICENSE/
|
|
51
|
+
[codecov_badge]: https://codecov.io/github/spapanik/plowman/graph/badge.svg?token=Q20F84BW72
|
|
52
|
+
[codecov_url]: https://codecov.io/github/spapanik/plowman
|
|
53
|
+
[readthedocs_badge]: https://readthedocs.org/projects/plowman/badge/?version=latest
|
|
54
|
+
[readthedocs_url]: https://plowman.readthedocs.io/en/latest/
|
|
55
|
+
[pypi_badge]: https://img.shields.io/pypi/v/plowman
|
|
56
|
+
[pypi_url]: https://pypi.org/project/plowman
|
|
57
|
+
[pepy_badge]: https://pepy.tech/badge/plowman
|
|
58
|
+
[pepy_url]: https://pepy.tech/project/plowman
|
|
59
|
+
[yam_badge]: https://img.shields.io/badge/build%20automation-yamk-success
|
|
60
|
+
[yam_url]: https://github.com/spapanik/yamk
|
|
61
|
+
[ruff_badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json
|
|
62
|
+
[ruff_url]: https://github.com/charliermarsh/ruff
|
|
63
|
+
[Documentation]: https://plowman.readthedocs.io/en/stable/
|
|
64
|
+
[Changelog]: https://plowman.readthedocs.io/en/stable/CHANGELOG/
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
plowman/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
plowman/__main__.py,sha256=U6oZBXZhtXsxTEAndKlhNk-GEtdvpya71jhnxBvC1VM,231
|
|
3
|
+
plowman/__version__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
4
|
+
plowman/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
plowman/commands/base.py,sha256=1OkKbnvB3aHvoBIWFyiN0tV9QPGrwQsQGCAlFqDegE8,622
|
|
6
|
+
plowman/commands/sow.py,sha256=ceOLdfzRe2-Zp8-VHT-8daZoe4KA018TYaQbFFMBge8,1093
|
|
7
|
+
plowman/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
plowman/lib/cli.py,sha256=y2h-yAH2_NURZa0Jk1Phk6YVWlqlCFW8d24cldPX0Es,1122
|
|
9
|
+
plowman/lib/constants.py,sha256=caDelNNB5lDm2n1hxm6WLg86pmkZCF6mJtl1M87NpWk,110
|
|
10
|
+
plowman/lib/exceptions.py,sha256=6LvHxm1i2qur9VnTtA4Fo0Sq8wBGgz_s8Tw_SSUMzjE,296
|
|
11
|
+
plowman/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
plowman-0.1.0.dist-info/LICENSE.md,sha256=spE8YN0RkVV39W0xn085Vk-1TysPf7myCqB6TIVFE-g,1489
|
|
13
|
+
plowman-0.1.0.dist-info/METADATA,sha256=pnvdfNun-78T73vQWesSAu1h-_qadr0StUrT_Cy2FSM,2823
|
|
14
|
+
plowman-0.1.0.dist-info/WHEEL,sha256=Iz12iiVSGmHuLoY4XkvtUO9B2JIi3YsiUiFNEwahzBc,88
|
|
15
|
+
plowman-0.1.0.dist-info/entry_points.txt,sha256=QdNhuC6Fn-ma5NTwd-sitpflWHnOvrhMp6cLTa8_WA8,44
|
|
16
|
+
plowman-0.1.0.dist-info/RECORD,,
|