beet-observer 0.7.1__py3-none-any.whl → 0.7.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beet_observer/__init__.py +1 -1
- beet_observer/data_pack.py +20 -21
- beet_observer/plugin.py +10 -7
- beet_observer/resource_pack.py +20 -21
- {beet_observer-0.7.1.dist-info → beet_observer-0.7.2.dist-info}/METADATA +1 -1
- beet_observer-0.7.2.dist-info/RECORD +8 -0
- beet_observer-0.7.1.dist-info/RECORD +0 -8
- {beet_observer-0.7.1.dist-info → beet_observer-0.7.2.dist-info}/LICENSE +0 -0
- {beet_observer-0.7.1.dist-info → beet_observer-0.7.2.dist-info}/WHEEL +0 -0
beet_observer/__init__.py
CHANGED
beet_observer/data_pack.py
CHANGED
@@ -10,10 +10,11 @@ def gen_dp_overlays(
|
|
10
10
|
"""
|
11
11
|
Generates overlays between two datapacks.
|
12
12
|
|
13
|
-
Keyword arguments
|
14
|
-
`ctx` -- the build context
|
15
|
-
`ctx_overlay` -- the overlay context
|
16
|
-
`overlay_dir` -- the directory of the overlay
|
13
|
+
Keyword arguments: \n
|
14
|
+
`ctx` -- the build context \n
|
15
|
+
`ctx_overlay` -- the overlay context \n
|
16
|
+
`overlay_dir` -- the directory of the overlay \n
|
17
|
+
`ignore` -- a list of overlays to ignore (existing overlays that should not be touched) \n
|
17
18
|
"""
|
18
19
|
# create list of all datapack file types
|
19
20
|
file_types: list[tuple[NamespaceProxy[Any], NamespaceProxy[Any]]] = [
|
@@ -108,7 +109,7 @@ def gen_dp_overlays(
|
|
108
109
|
]
|
109
110
|
# for each file type, check for required overlays
|
110
111
|
for registry, registry_overlay in file_types:
|
111
|
-
check_registry(ctx,
|
112
|
+
check_registry(ctx, overlay_dir, registry, registry_overlay)
|
112
113
|
|
113
114
|
# get pack.mcmeta overlay entries
|
114
115
|
mcmeta: dict[str, dict[str, list[dict[str, Any]]]] = ctx.data.mcmeta.data.copy()
|
@@ -156,7 +157,6 @@ def gen_dp_overlays(
|
|
156
157
|
|
157
158
|
def check_registry(
|
158
159
|
ctx: Context,
|
159
|
-
ctx_overlay: Context,
|
160
160
|
overlay_dir: str,
|
161
161
|
registry: NamespaceProxy[Any],
|
162
162
|
registry_overlay: NamespaceProxy[Any],
|
@@ -164,12 +164,11 @@ def check_registry(
|
|
164
164
|
"""
|
165
165
|
Generates overlays for each namespace proxy.
|
166
166
|
|
167
|
-
Keyword arguments
|
168
|
-
`ctx` -- the build context
|
169
|
-
`
|
170
|
-
`
|
171
|
-
`
|
172
|
-
`registry_overlay` -- the namespace proxy from the overlay context</br>
|
167
|
+
Keyword arguments: \n
|
168
|
+
`ctx` -- the build context \n
|
169
|
+
`overlay_dir` -- the directory of the overlay \n
|
170
|
+
`registry` -- the namespace proxy from the build context \n
|
171
|
+
`registry_overlay` -- the namespace proxy from the overlay context \n
|
173
172
|
"""
|
174
173
|
# check each file in the build pack
|
175
174
|
for name in list(registry):
|
@@ -198,15 +197,15 @@ def gen_registry_overlay(
|
|
198
197
|
type: str = "",
|
199
198
|
) -> None:
|
200
199
|
"""
|
201
|
-
Checks if two
|
202
|
-
|
203
|
-
Keyword arguments
|
204
|
-
`ctx` -- the build context
|
205
|
-
`overlay_dir` -- the directory of the generated overlay
|
206
|
-
`name` -- the name of the file
|
207
|
-
`registry` -- the namespace proxy from the build context
|
208
|
-
`registry_overlay` -- the namespace proxy from the overlay context
|
209
|
-
`type` -- either "deletion" or "addition" (default: `""`)
|
200
|
+
Checks if two files have the same contents and generate an overlay if they don't.
|
201
|
+
|
202
|
+
Keyword arguments: \n
|
203
|
+
`ctx` -- the build context \n
|
204
|
+
`overlay_dir` -- the directory of the generated overlay \n
|
205
|
+
`name` -- the name of the file \n
|
206
|
+
`registry` -- the namespace proxy from the build context \n
|
207
|
+
`registry_overlay` -- the namespace proxy from the overlay context \n
|
208
|
+
`type`(optional) -- either "deletion" or "addition" (default: `""`) \n
|
210
209
|
"""
|
211
210
|
if type == "deletion":
|
212
211
|
# move file from build pack to overlay in build pack
|
beet_observer/plugin.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
from beet import Context, run_beet
|
2
2
|
|
3
|
-
from .data_pack import
|
4
|
-
from .resource_pack import
|
3
|
+
from .data_pack import gen_dp_overlays
|
4
|
+
from .resource_pack import gen_rp_overlays
|
5
5
|
|
6
6
|
|
7
7
|
def beet_default(ctx: Context):
|
8
8
|
if "observer" not in ctx.meta:
|
9
9
|
return
|
10
10
|
|
11
|
-
#
|
11
|
+
# check cache
|
12
12
|
cache = ctx.cache["observer"]
|
13
13
|
cached_dp = False
|
14
14
|
cached_rp = False
|
@@ -45,9 +45,12 @@ def beet_default(ctx: Context):
|
|
45
45
|
"rp"
|
46
46
|
]
|
47
47
|
# save current overlays
|
48
|
-
|
48
|
+
save_dp: list[str] = []
|
49
|
+
save_rp: list[str] = []
|
49
50
|
for overlay in ctx.data.overlays:
|
50
|
-
|
51
|
+
save_dp.append(overlay)
|
52
|
+
for overlay in ctx.assets.overlays:
|
53
|
+
save_rp.append(overlay)
|
51
54
|
# loop through all overlays
|
52
55
|
for overlay in ctx.meta["observer"]["overlays"]:
|
53
56
|
# get pack
|
@@ -67,9 +70,9 @@ def beet_default(ctx: Context):
|
|
67
70
|
rp_dir = overlay["directory"]
|
68
71
|
# compare build pack and overlay pack
|
69
72
|
if not cached_dp and ctx.data:
|
70
|
-
gen_dp_overlays(ctx, ctx_overlay, dp_dir,
|
73
|
+
gen_dp_overlays(ctx, ctx_overlay, dp_dir, save_dp)
|
71
74
|
if not cached_rp and ctx.assets:
|
72
|
-
gen_rp_overlays(ctx, ctx_overlay, rp_dir,
|
75
|
+
gen_rp_overlays(ctx, ctx_overlay, rp_dir, save_rp)
|
73
76
|
|
74
77
|
# save to cache
|
75
78
|
if not cached_dp and ctx.data:
|
beet_observer/resource_pack.py
CHANGED
@@ -9,10 +9,11 @@ def gen_rp_overlays(
|
|
9
9
|
"""
|
10
10
|
Generates overlays between two resource packs.
|
11
11
|
|
12
|
-
Keyword arguments
|
13
|
-
`ctx` -- the build context
|
14
|
-
`ctx_overlay` -- the overlay context
|
15
|
-
`overlay_dir` -- the directory of the overlay
|
12
|
+
Keyword arguments: \n
|
13
|
+
`ctx` -- the build context \n
|
14
|
+
`ctx_overlay` -- the overlay context \n
|
15
|
+
`overlay_dir` -- the directory of the overlay \n
|
16
|
+
`ignore` -- a list of overlays to ignore (existing overlays that should not be touched) \n
|
16
17
|
"""
|
17
18
|
# create list of all resource pack file types
|
18
19
|
file_types: list[tuple[NamespaceProxy[Any], NamespaceProxy[Any]]] = [
|
@@ -36,7 +37,7 @@ def gen_rp_overlays(
|
|
36
37
|
]
|
37
38
|
# for each file type, check for required overlays
|
38
39
|
for registry, registry_overlay in file_types:
|
39
|
-
check_registry(ctx,
|
40
|
+
check_registry(ctx, overlay_dir, registry, registry_overlay)
|
40
41
|
|
41
42
|
# get pack.mcmeta overlay entries
|
42
43
|
mcmeta: dict[str, dict[str, list[dict[str, Any]]]] = ctx.assets.mcmeta.data.copy()
|
@@ -84,7 +85,6 @@ def gen_rp_overlays(
|
|
84
85
|
|
85
86
|
def check_registry(
|
86
87
|
ctx: Context,
|
87
|
-
ctx_overlay: Context,
|
88
88
|
overlay_dir: str,
|
89
89
|
registry: NamespaceProxy[Any],
|
90
90
|
registry_overlay: NamespaceProxy[Any],
|
@@ -92,12 +92,11 @@ def check_registry(
|
|
92
92
|
"""
|
93
93
|
Generates overlays for each namespace proxy.
|
94
94
|
|
95
|
-
Keyword arguments
|
96
|
-
`ctx` -- the build context
|
97
|
-
`
|
98
|
-
`
|
99
|
-
`
|
100
|
-
`registry_overlay` -- the namespace proxy from the overlay context</br>
|
95
|
+
Keyword arguments: \n
|
96
|
+
`ctx` -- the build context \n
|
97
|
+
`overlay_dir` -- the directory of the overlay \n
|
98
|
+
`registry` -- the namespace proxy from the build context \n
|
99
|
+
`registry_overlay` -- the namespace proxy from the overlay context \n
|
101
100
|
"""
|
102
101
|
# check each file in the build pack
|
103
102
|
for name in list(registry):
|
@@ -126,15 +125,15 @@ def gen_registry_overlay(
|
|
126
125
|
type: str = "",
|
127
126
|
) -> None:
|
128
127
|
"""
|
129
|
-
Checks if two
|
130
|
-
|
131
|
-
Keyword arguments
|
132
|
-
`ctx` -- the build context
|
133
|
-
`overlay_dir` -- the directory of the generated overlay
|
134
|
-
`name` -- the name of the file
|
135
|
-
`registry` -- the namespace proxy from the build context
|
136
|
-
`registry_overlay` -- the namespace proxy from the overlay context
|
137
|
-
`type` -- either "deletion" or "addition" (default: `""`)
|
128
|
+
Checks if two files have the same contents and generate an overlay if they don't.
|
129
|
+
|
130
|
+
Keyword arguments: \n
|
131
|
+
`ctx` -- the build context \n
|
132
|
+
`overlay_dir` -- the directory of the generated overlay \n
|
133
|
+
`name` -- the name of the file \n
|
134
|
+
`registry` -- the namespace proxy from the build context \n
|
135
|
+
`registry_overlay` -- the namespace proxy from the overlay context \n
|
136
|
+
`type`(optional) -- either "deletion" or "addition" (default: `""`) \n
|
138
137
|
"""
|
139
138
|
if type == "deletion":
|
140
139
|
# move file from build pack to overlay in build pack
|
@@ -0,0 +1,8 @@
|
|
1
|
+
beet_observer/__init__.py,sha256=JcF4rPyJxqAn0u-uUEv2tLL9azWoXI9PVD-uGE3sZnQ,45
|
2
|
+
beet_observer/data_pack.py,sha256=0qvnIwXlP_A_I1DAnvloW9ryaUZh2Qm1VF-Qux6IxBc,9973
|
3
|
+
beet_observer/plugin.py,sha256=NXLMkfsxxlnJbR51eM4TGOf1vCR30rNYSr6l4djqnT8,2973
|
4
|
+
beet_observer/resource_pack.py,sha256=hwFlwQiRUFg1V9Zy-U4gVUOvZxqEzyqHgoBdwzqoAXc,6211
|
5
|
+
beet_observer-0.7.2.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
|
6
|
+
beet_observer-0.7.2.dist-info/METADATA,sha256=KleELV6Buct3KDzBcBamAMwVbKhEec4wSgs6UmewNBo,674
|
7
|
+
beet_observer-0.7.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
8
|
+
beet_observer-0.7.2.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
beet_observer/__init__.py,sha256=1XpNKUm-Hk_yCgkuoqDBACiacdZ1uf9I3C1WAHMucuE,45
|
2
|
-
beet_observer/data_pack.py,sha256=YIkMDaR1j6FU-ukC5UibCaweRQ-TEvd_w1sZZTbE5Ww,9972
|
3
|
-
beet_observer/plugin.py,sha256=mtGBtJNCiUHkSGiAoRl7li0oIlZBQ-cuDS91bubDaPs,2835
|
4
|
-
beet_observer/resource_pack.py,sha256=anQw0EdCF780j9rVMM1ycQAqQzEFpg_8I_h6T5Xoguo,6210
|
5
|
-
beet_observer-0.7.1.dist-info/LICENSE,sha256=oBbP6j7sgG9darFSRZxV7iO8yPR1aZiDspSK3mcLpXI,1062
|
6
|
-
beet_observer-0.7.1.dist-info/METADATA,sha256=_c2AXX_DL1MmeoqYuYMHpg4xWWTkhKkRuwtlid4-2zc,674
|
7
|
-
beet_observer-0.7.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
8
|
-
beet_observer-0.7.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|