moat-src 0.8.11__py3-none-any.whl → 0.9.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.
- moat/src/_cfg.yaml +2 -2
- moat/src/_main.py +38 -77
- {moat_src-0.8.11.dist-info → moat_src-0.9.0.dist-info}/METADATA +1 -1
- {moat_src-0.8.11.dist-info → moat_src-0.9.0.dist-info}/RECORD +7 -7
- {moat_src-0.8.11.dist-info → moat_src-0.9.0.dist-info}/WHEEL +0 -0
- {moat_src-0.8.11.dist-info → moat_src-0.9.0.dist-info}/licenses/LICENSE.txt +0 -0
- {moat_src-0.8.11.dist-info → moat_src-0.9.0.dist-info}/top_level.txt +0 -0
moat/src/_cfg.yaml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
toplevel: "moat"
|
2
|
+
done: "/src/DONE"
|
moat/src/_main.py
CHANGED
@@ -27,32 +27,18 @@ ARCH = subprocess.check_output(["dpkg", "--print-architecture"]).decode("utf-8")
|
|
27
27
|
|
28
28
|
def dash(n: str) -> str:
|
29
29
|
"""
|
30
|
-
moat.foo.bar > foo-bar
|
31
|
-
foo.bar >
|
30
|
+
moat.foo.bar > moat-foo-bar
|
31
|
+
foo.bar > foo-bar
|
32
32
|
"""
|
33
|
-
|
34
|
-
return "main"
|
35
|
-
if "." not in n: # also applies to single-name packages
|
36
|
-
return n
|
37
|
-
|
38
|
-
if not n.startswith("moat."):
|
39
|
-
return "ext-" + n.replace("-", ".")
|
40
|
-
return n.replace(".", "-")[5:]
|
33
|
+
return n.replace(".", "-")
|
41
34
|
|
42
35
|
|
43
36
|
def undash(n: str) -> str:
|
44
37
|
"""
|
45
|
-
foo-bar > moat.foo.bar
|
46
|
-
|
38
|
+
moat-foo-bar > moat.foo.bar
|
39
|
+
foo-bar > foo.bar
|
47
40
|
"""
|
48
|
-
|
49
|
-
return n
|
50
|
-
|
51
|
-
if n in ("main", "moat"):
|
52
|
-
return "moat"
|
53
|
-
if n.startswith("ext-"):
|
54
|
-
return n.replace("-", ".")[4:]
|
55
|
-
return "moat." + n.replace("-", ".")
|
41
|
+
return n.replace("-", ".")
|
56
42
|
|
57
43
|
|
58
44
|
class ChangedError(RuntimeError):
|
@@ -153,11 +139,7 @@ class Package(_Common):
|
|
153
139
|
|
154
140
|
@property
|
155
141
|
def mdash(self):
|
156
|
-
|
157
|
-
if d.startswith("ext-"):
|
158
|
-
return d[4:]
|
159
|
-
else:
|
160
|
-
return "moat-" + d
|
142
|
+
return dash(self.name)
|
161
143
|
|
162
144
|
def populate(self, path: Path, real=None):
|
163
145
|
"""
|
@@ -180,7 +162,7 @@ class Package(_Common):
|
|
180
162
|
raise ValueError(f"No files in {self.name}?")
|
181
163
|
p = Path("packaging") / self.dash / "src"
|
182
164
|
with suppress(FileNotFoundError):
|
183
|
-
rmtree(p
|
165
|
+
rmtree(p)
|
184
166
|
dest = p / self.path
|
185
167
|
dest.mkdir(parents=True)
|
186
168
|
for f in self.files:
|
@@ -206,7 +188,7 @@ class Package(_Common):
|
|
206
188
|
lc = self.last_commit
|
207
189
|
except AttributeError:
|
208
190
|
return True
|
209
|
-
for d in head.diff(self.last_commit):
|
191
|
+
for d in head.diff(self.last_commit, paths=Path("packaging")/self.dash if main else self.path):
|
210
192
|
if (
|
211
193
|
self._repo.repo_for(d.a_path, main) != self.name
|
212
194
|
and self._repo.repo_for(d.b_path, main) != self.name
|
@@ -222,7 +204,11 @@ class Repo(git.Repo, _Common):
|
|
222
204
|
moat_tag = None
|
223
205
|
_last_tag = None
|
224
206
|
|
225
|
-
|
207
|
+
toplevel:str
|
208
|
+
|
209
|
+
def __init__(self, toplevel:str, *a, **k):
|
210
|
+
self.toplevel = toplevel
|
211
|
+
|
226
212
|
super().__init__(*a, **k)
|
227
213
|
self._commit_tags = defaultdict(list)
|
228
214
|
self._commit_topo = {}
|
@@ -299,37 +285,34 @@ class Repo(git.Repo, _Common):
|
|
299
285
|
def _make_repos(self) -> dict:
|
300
286
|
"""Collect subrepos"""
|
301
287
|
for fn in Path("packaging").iterdir():
|
302
|
-
if fn.name == "main":
|
303
|
-
continue
|
304
288
|
if not fn.is_dir() or "." in fn.name:
|
305
289
|
continue
|
306
290
|
self._add_repo(str(fn.name))
|
307
291
|
|
308
|
-
self._repos[
|
292
|
+
self._repos[self.toplevel].populate(Path(self.toplevel))
|
309
293
|
|
310
294
|
def repo_for(self, path: Path | str, main: bool | None) -> str:
|
311
295
|
"""
|
312
296
|
Given a file path, returns the subrepo in question
|
313
297
|
"""
|
314
|
-
sc = self._repos["
|
298
|
+
sc = self._repos["moat"]
|
315
299
|
path = Path(path)
|
316
300
|
|
317
|
-
if main is not False and path.parts[0] == "moat":
|
318
|
-
name = "moat"
|
319
|
-
for p in path.parts[1:]:
|
320
|
-
if p in sc.subs:
|
321
|
-
name += "." + p
|
322
|
-
sc = sc.subs[p]
|
323
|
-
else:
|
324
|
-
break
|
325
|
-
return name
|
326
|
-
|
327
301
|
if main is not True and path.parts[0] == "packaging":
|
328
302
|
try:
|
329
303
|
return undash(path.parts[1])
|
330
304
|
except IndexError:
|
331
305
|
return None
|
332
306
|
|
307
|
+
name = path.parts[0]
|
308
|
+
if main is not False and name == self.toplevel:
|
309
|
+
for p in path.parts[1:]:
|
310
|
+
if p not in sc.subs:
|
311
|
+
break
|
312
|
+
name += "." + p
|
313
|
+
sc = sc.subs[p]
|
314
|
+
return name
|
315
|
+
|
333
316
|
return None
|
334
317
|
|
335
318
|
def commits(self, ref=None):
|
@@ -361,8 +344,9 @@ class Repo(git.Repo, _Common):
|
|
361
344
|
if tag is None:
|
362
345
|
tag = self.last_tag
|
363
346
|
head = self._repo.head.commit
|
347
|
+
print("StartDiff B",self,tag,head,file=sys.stderr)
|
364
348
|
for d in head.diff(tag):
|
365
|
-
if self.repo_for(d.a_path, main) ==
|
349
|
+
if self.repo_for(d.a_path, main) == self.toplevel and self.repo_for(d.b_path, main) == self.toplevel:
|
366
350
|
continue
|
367
351
|
return True
|
368
352
|
return False
|
@@ -521,21 +505,6 @@ def default_dict(a, b, c, cls=dict, repl=lambda x: x) -> dict:
|
|
521
505
|
return mod
|
522
506
|
|
523
507
|
|
524
|
-
def is_clean(repo: Repo, skip: bool = True) -> bool:
|
525
|
-
"""Check if this repository is clean."""
|
526
|
-
skips = " Skipping." if skip else ""
|
527
|
-
if repo.head.is_detached:
|
528
|
-
print(f"{repo.working_dir}: detached.{skips}")
|
529
|
-
return False
|
530
|
-
if repo.head.ref.name not in {"main", "moat"}:
|
531
|
-
print(f"{repo.working_dir}: on branch {repo.head.ref.name}.{skips}")
|
532
|
-
return False
|
533
|
-
elif repo.is_dirty(index=True, working_tree=True, untracked_files=True, submodules=False):
|
534
|
-
print(f"{repo.working_dir}: Dirty.{skips}")
|
535
|
-
return False
|
536
|
-
return True
|
537
|
-
|
538
|
-
|
539
508
|
def _mangle(proj, path, mangler):
|
540
509
|
try:
|
541
510
|
for k in path[:-1]:
|
@@ -582,11 +551,13 @@ def apply_hooks(repo, force=False):
|
|
582
551
|
|
583
552
|
@cli.command
|
584
553
|
@click.argument("part", type=str)
|
585
|
-
|
554
|
+
@click.pass_obj
|
555
|
+
def setup(obj, part):
|
586
556
|
"""
|
587
557
|
Create a new MoaT subcommand.
|
588
558
|
"""
|
589
|
-
|
559
|
+
cfg = obj.cfg
|
560
|
+
repo = Repo(cfg.src.toplevel, None)
|
590
561
|
if "-" in part:
|
591
562
|
part = undash(part)
|
592
563
|
|
@@ -714,11 +685,12 @@ def path_():
|
|
714
685
|
|
715
686
|
|
716
687
|
@cli.command()
|
717
|
-
|
688
|
+
@click.pass_obj
|
689
|
+
def tags(obj):
|
718
690
|
"""
|
719
691
|
List all tags
|
720
692
|
"""
|
721
|
-
repo = Repo(None)
|
693
|
+
repo = Repo(obj.cfg.src.toplevel, None)
|
722
694
|
|
723
695
|
for r in repo.parts:
|
724
696
|
try:
|
@@ -742,7 +714,8 @@ def tags():
|
|
742
714
|
@click.option("-q", "--query", "--show", "show", is_flag=True, help="Show the latest tag")
|
743
715
|
@click.option("-f", "--force", "FORCE", is_flag=True, help="replace an existing tag")
|
744
716
|
@click.option("-b", "--build", is_flag=True, help="set/increment the build number")
|
745
|
-
|
717
|
+
@click.pass_obj
|
718
|
+
def tag(obj, run, minor, major, subtree, force, FORCE, show, build):
|
746
719
|
"""
|
747
720
|
Tag the repository (or a subtree).
|
748
721
|
|
@@ -763,7 +736,7 @@ def tag(run, minor, major, subtree, force, FORCE, show, build):
|
|
763
736
|
if build and not subtree:
|
764
737
|
raise click.UsageError("The main release number doesn't have a build")
|
765
738
|
|
766
|
-
repo = Repo(None)
|
739
|
+
repo = Repo(obj.cfg.src.toplevel, None)
|
767
740
|
|
768
741
|
if subtree:
|
769
742
|
r = repo.part(subtree)
|
@@ -877,7 +850,7 @@ async def build(
|
|
877
850
|
g_done = Path(g_done)
|
878
851
|
else:
|
879
852
|
g_done = Path("/tmp/nonexistent")
|
880
|
-
repo = Repo(None)
|
853
|
+
repo = Repo(cfg.src.toplevel, None)
|
881
854
|
|
882
855
|
tags = dict(version)
|
883
856
|
skip = set()
|
@@ -915,10 +888,6 @@ async def build(
|
|
915
888
|
continue
|
916
889
|
name = name.stem
|
917
890
|
name, vers, _ = name.split("_")
|
918
|
-
if name.startswith("moat-"):
|
919
|
-
name = name[5:]
|
920
|
-
else:
|
921
|
-
name = "ext-" + name
|
922
891
|
debversion[name] = vers.rsplit("-", 1)[0]
|
923
892
|
|
924
893
|
# Step 0: basic check
|
@@ -1097,10 +1066,6 @@ async def build(
|
|
1097
1066
|
continue
|
1098
1067
|
tag = r.last_tag
|
1099
1068
|
name = r.dash
|
1100
|
-
if name.startswith("ext-"):
|
1101
|
-
name = name[4:]
|
1102
|
-
else:
|
1103
|
-
name = "moat-" + r.dash
|
1104
1069
|
|
1105
1070
|
targz = rd / "dist" / f"{r.under}-{tag}.tar.gz"
|
1106
1071
|
done = rd / "dist" / f"{r.under}-{tag}.done"
|
@@ -1136,10 +1101,6 @@ async def build(
|
|
1136
1101
|
continue
|
1137
1102
|
tag = r.last_tag
|
1138
1103
|
name = r.dash
|
1139
|
-
if name.startswith("ext-"):
|
1140
|
-
name = name[4:]
|
1141
|
-
else:
|
1142
|
-
name = "moat-" + r.dash
|
1143
1104
|
targz = Path("dist") / f"{r.under}-{tag}.tar.gz"
|
1144
1105
|
whl = Path("dist") / f"{r.under}-{tag}-py3-none-any.whl"
|
1145
1106
|
try:
|
@@ -1,14 +1,14 @@
|
|
1
1
|
moat/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
moat/src/_cfg.yaml,sha256=
|
3
|
-
moat/src/_main.py,sha256=
|
2
|
+
moat/src/_cfg.yaml,sha256=bXRcamFBn1VCc7MhGBiWK5ciq4qw6iXyZzRJWvs_m0Q,35
|
3
|
+
moat/src/_main.py,sha256=sWI450D4sZzPXs3vXE_444kx8_4vKThSJru6a1qu_kY,34903
|
4
4
|
moat/src/inspect.py,sha256=rUU-FQyQoQP8LJCebbtdL6lgzz9KPH7KGSq11kD4nmU,1489
|
5
5
|
moat/src/test.py,sha256=rA-YV_VDwtfBk-bzIEa31fk9GHl6V8f4HTXejLoAAbk,2187
|
6
6
|
moat/src/_templates/moat/__init__.py,sha256=ZBoFcXbv35djD599Vo_PKTqDjvQXYYXTcPUs5RcQZrs,101
|
7
7
|
moat/src/_templates/moat/_main.py,sha256=8gLupAmWb5T6wLkQYTi99V1nyaS8cAIccwxHet2ydFw,321
|
8
8
|
moat/src/_templates/packaging/pyproject.default.yaml,sha256=nHUa7dQhe8QpDH9Gbmjflf3BI3ECk2cuXArf0oPCgeg,2801
|
9
9
|
moat/src/_templates/packaging/pyproject.forced.yaml,sha256=djfcy3hgfoIgrn2pRrxDWTyN3EEsA1y5NhkzYrGjgNY,1427
|
10
|
-
moat_src-0.
|
11
|
-
moat_src-0.
|
12
|
-
moat_src-0.
|
13
|
-
moat_src-0.
|
14
|
-
moat_src-0.
|
10
|
+
moat_src-0.9.0.dist-info/licenses/LICENSE.txt,sha256=L5vKJLVOg5t0CEEPpW9-O_0vzbP0PEjEF06tLvnIDuk,541
|
11
|
+
moat_src-0.9.0.dist-info/METADATA,sha256=KZCUXs_GJPXgI9SSg88i4hErM5wiL_sjcHPukyixhjw,733
|
12
|
+
moat_src-0.9.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
13
|
+
moat_src-0.9.0.dist-info/top_level.txt,sha256=pcs9fl5w5AB5GVi4SvBqIVmFrkRwQkVw_dEvW0Q0cSA,5
|
14
|
+
moat_src-0.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|