gripfetch-apt 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.
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""gripfetch-apt — thin sugar for the apt fetcher plugin.
|
|
2
|
+
|
|
3
|
+
`apt(package, version=None, **kw)` returns exactly the IR that
|
|
4
|
+
`gripsack.fetch.plugin_fetch("apt", ...)` produces — no side channels,
|
|
5
|
+
no extra keys. With gripsack installed you get its real `Fetch`
|
|
6
|
+
object; without it, a mirror of the same frozen dataclass so the
|
|
7
|
+
package works standalone for authoring and type-checking.
|
|
8
|
+
|
|
9
|
+
from gripfetch_apt import apt
|
|
10
|
+
|
|
11
|
+
module(
|
|
12
|
+
name="hello",
|
|
13
|
+
fetch=apt("hello", "2.10-3"),
|
|
14
|
+
)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from dataclasses import dataclass, field
|
|
20
|
+
from typing import Any, Optional
|
|
21
|
+
|
|
22
|
+
__all__ = ["apt", "Fetch"]
|
|
23
|
+
__version__ = "0.1.0"
|
|
24
|
+
|
|
25
|
+
try: # pragma: no cover - exercised only with gripsack installed
|
|
26
|
+
from gripsack.fetch import Fetch as _GsFetch
|
|
27
|
+
from gripsack.fetch import plugin_fetch as _gs_plugin_fetch
|
|
28
|
+
|
|
29
|
+
def apt(
|
|
30
|
+
package: str, version: Optional[str] = None, **kw: Any
|
|
31
|
+
) -> _GsFetch:
|
|
32
|
+
"""A Debian package fetched via the host's apt (`gripfetch-apt`).
|
|
33
|
+
|
|
34
|
+
`version` omitted → latest available (resolved at fetch time).
|
|
35
|
+
Extra kwargs pass through verbatim (e.g. `repos=[...]`).
|
|
36
|
+
"""
|
|
37
|
+
return _gs_plugin_fetch("apt", **_args(package, version, kw))
|
|
38
|
+
|
|
39
|
+
except ImportError:
|
|
40
|
+
from enum import Enum
|
|
41
|
+
|
|
42
|
+
class FetchKind(str, Enum):
|
|
43
|
+
"""Mirrors gripsack.fetch.FetchKind for standalone use."""
|
|
44
|
+
|
|
45
|
+
PLUGIN = "plugin"
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class Fetch:
|
|
49
|
+
"""A fetch spec — mirrors gripsack.fetch.Fetch exactly."""
|
|
50
|
+
|
|
51
|
+
kind: FetchKind
|
|
52
|
+
args: dict[str, Any] = field(default_factory=dict)
|
|
53
|
+
|
|
54
|
+
def to_ir(self) -> dict[str, Any]:
|
|
55
|
+
return {"kind": self.kind.value, **self.args}
|
|
56
|
+
|
|
57
|
+
def apt(package: str, version: Optional[str] = None, **kw: Any) -> Fetch:
|
|
58
|
+
"""A Debian package fetched via the host's apt (`gripfetch-apt`).
|
|
59
|
+
|
|
60
|
+
`version` omitted → latest available (resolved at fetch time).
|
|
61
|
+
Extra kwargs pass through verbatim (e.g. `repos=[...]`).
|
|
62
|
+
"""
|
|
63
|
+
return Fetch(
|
|
64
|
+
FetchKind.PLUGIN,
|
|
65
|
+
{"name": "apt", "args": _args(package, version, kw)},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _args(package: str, version: Optional[str], kw: dict[str, Any]) -> dict[str, Any]:
|
|
70
|
+
"""Build the plugin args: package always, version only when pinned."""
|
|
71
|
+
args: dict[str, Any] = {"package": package}
|
|
72
|
+
if version is not None:
|
|
73
|
+
args["version"] = version
|
|
74
|
+
for key, value in kw.items():
|
|
75
|
+
if value is not None:
|
|
76
|
+
args[key] = value
|
|
77
|
+
return args
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: gripfetch-apt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: gripsack sugar: fetch Debian packages through the gripfetch-apt plugin (wraps the host's apt)
|
|
5
|
+
Project-URL: Repository, https://github.com/gripsack-dev/gripfetch-apt
|
|
6
|
+
Author: gripsack-dev
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: apt,debian,gripfetch,gripsack
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# gripfetch-apt (python sugar)
|
|
21
|
+
|
|
22
|
+
Thin DSL helper for authoring gripsack modules that fetch Debian
|
|
23
|
+
packages through the [gripfetch-apt plugin](https://github.com/gripsack-dev/gripfetch-apt).
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from gripfetch_apt import apt
|
|
27
|
+
|
|
28
|
+
module(
|
|
29
|
+
name="hello",
|
|
30
|
+
fetch=apt("hello", "2.10-3"), # version optional → latest available
|
|
31
|
+
install={"bin/hello": symlink("~/.local/bin/hello")},
|
|
32
|
+
)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`apt(...)` returns exactly what `gripsack.fetch.plugin_fetch("apt", ...)`
|
|
36
|
+
returns — no side channels. The package works standalone (for authoring
|
|
37
|
+
and type-checking) even without gripsack installed: it then returns a
|
|
38
|
+
mirror of the same frozen `Fetch` dataclass.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
gripfetch_apt/__init__.py,sha256=ioqioNmGEqUouLzFIxVP-y3cBEMcBediqQaf1vR99FY,2525
|
|
2
|
+
gripfetch_apt-0.1.0.dist-info/METADATA,sha256=VyCMtPdgQjxB6VvdMXhJB4leRXW_rfbAgfpDakgKEdA,1432
|
|
3
|
+
gripfetch_apt-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
4
|
+
gripfetch_apt-0.1.0.dist-info/RECORD,,
|