moat-src 0.8.11__tar.gz → 0.9.1__tar.gz

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.
Files changed (24) hide show
  1. {moat_src-0.8.11/src/moat_src.egg-info → moat_src-0.9.1}/PKG-INFO +1 -1
  2. {moat_src-0.8.11 → moat_src-0.9.1}/debian/changelog +24 -0
  3. {moat_src-0.8.11 → moat_src-0.9.1}/debian/control +1 -1
  4. {moat_src-0.8.11 → moat_src-0.9.1}/pyproject.toml +1 -1
  5. moat_src-0.9.1/src/moat/src/_cfg.yaml +2 -0
  6. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/_main.py +57 -90
  7. {moat_src-0.8.11 → moat_src-0.9.1/src/moat_src.egg-info}/PKG-INFO +1 -1
  8. moat_src-0.8.11/src/moat/src/_cfg.yaml +0 -2
  9. {moat_src-0.8.11 → moat_src-0.9.1}/LICENSE.txt +0 -0
  10. {moat_src-0.8.11 → moat_src-0.9.1}/Makefile +0 -0
  11. {moat_src-0.8.11 → moat_src-0.9.1}/debian/.gitignore +0 -0
  12. {moat_src-0.8.11 → moat_src-0.9.1}/debian/rules +0 -0
  13. {moat_src-0.8.11 → moat_src-0.9.1}/setup.cfg +0 -0
  14. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/__init__.py +0 -0
  15. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/_templates/moat/__init__.py +0 -0
  16. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/_templates/moat/_main.py +0 -0
  17. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/_templates/packaging/pyproject.default.yaml +0 -0
  18. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/_templates/packaging/pyproject.forced.yaml +0 -0
  19. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/inspect.py +0 -0
  20. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat/src/test.py +0 -0
  21. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat_src.egg-info/SOURCES.txt +0 -0
  22. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat_src.egg-info/dependency_links.txt +0 -0
  23. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat_src.egg-info/requires.txt +0 -0
  24. {moat_src-0.8.11 → moat_src-0.9.1}/src/moat_src.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moat-src
3
- Version: 0.8.11
3
+ Version: 0.9.1
4
4
  Summary: Tools for managing the MoaT sources
5
5
  Author-email: Matthias Urlichs <matthias@urlichs.de>
6
6
  Project-URL: homepage, https://m-o-a-t.org
@@ -1,3 +1,27 @@
1
+ moat-src (0.9.1-1) unstable; urgency=medium
2
+
3
+ * New release for 25.1.16
4
+
5
+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 12 May 2025 18:06:09 +0200
6
+
7
+ moat-src (0.9.0-2) unstable; urgency=medium
8
+
9
+ * New release for 25.1.14
10
+
11
+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 12 May 2025 17:39:09 +0200
12
+
13
+ moat-src (0.9.0-1) unstable; urgency=medium
14
+
15
+ * New release for 25.2.1
16
+
17
+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 12 May 2025 12:24:05 +0200
18
+
19
+ moat-src (0.8.11-2) unstable; urgency=medium
20
+
21
+ * New release for 25.2.1
22
+
23
+ -- Matthias Urlichs <matthias@urlichs.de> Mon, 12 May 2025 09:53:45 +0200
24
+
1
25
  moat-src (0.8.11-1) unstable; urgency=medium
2
26
 
3
27
  * New release for 25.2.1
@@ -12,7 +12,7 @@ Package: moat-src
12
12
  Architecture: all
13
13
  Depends: ${misc:Depends}, ${python3:Depends},
14
14
  python3-anyio (>= 2.0),
15
- moat-main,
15
+ moat,
16
16
  Recommends:
17
17
  moat-kv (>= 0.32),
18
18
  python3-trio (>= 0.17),
@@ -18,7 +18,7 @@ dependencies = [
18
18
  "gitpython",
19
19
  "packaging",
20
20
  ]
21
- version = "0.8.11"
21
+ version = "0.9.1"
22
22
  keywords = [ "MoaT",]
23
23
  requires-python = ">=3.8"
24
24
  name = "moat-src"
@@ -0,0 +1,2 @@
1
+ toplevel: "moat"
2
+ done: "/src/DONE"
@@ -9,6 +9,7 @@ import sys
9
9
  from collections import defaultdict, deque
10
10
  from configparser import RawConfigParser
11
11
  from pathlib import Path
12
+ from copy import deepcopy
12
13
 
13
14
  import asyncclick as click
14
15
  import git
@@ -27,32 +28,18 @@ ARCH = subprocess.check_output(["dpkg", "--print-architecture"]).decode("utf-8")
27
28
 
28
29
  def dash(n: str) -> str:
29
30
  """
30
- moat.foo.bar > foo-bar
31
- foo.bar > ext-foo-bar
31
+ moat.foo.bar > moat-foo-bar
32
+ foo.bar > foo-bar
32
33
  """
33
- if n in ("main", "moat"):
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:]
34
+ return n.replace(".", "-")
41
35
 
42
36
 
43
37
  def undash(n: str) -> str:
44
38
  """
45
- foo-bar > moat.foo.bar
46
- ext-foo-bar > foo.bar
39
+ moat-foo-bar > moat.foo.bar
40
+ foo-bar > foo.bar
47
41
  """
48
- if "." in n:
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("-", ".")
42
+ return n.replace("-", ".")
56
43
 
57
44
 
58
45
  class ChangedError(RuntimeError):
@@ -153,11 +140,7 @@ class Package(_Common):
153
140
 
154
141
  @property
155
142
  def mdash(self):
156
- d = dash(self.name)
157
- if d.startswith("ext-"):
158
- return d[4:]
159
- else:
160
- return "moat-" + d
143
+ return dash(self.name)
161
144
 
162
145
  def populate(self, path: Path, real=None):
163
146
  """
@@ -180,7 +163,7 @@ class Package(_Common):
180
163
  raise ValueError(f"No files in {self.name}?")
181
164
  p = Path("packaging") / self.dash / "src"
182
165
  with suppress(FileNotFoundError):
183
- rmtree(p / "moat")
166
+ rmtree(p)
184
167
  dest = p / self.path
185
168
  dest.mkdir(parents=True)
186
169
  for f in self.files:
@@ -206,7 +189,7 @@ class Package(_Common):
206
189
  lc = self.last_commit
207
190
  except AttributeError:
208
191
  return True
209
- for d in head.diff(self.last_commit):
192
+ for d in head.diff(self.last_commit, paths=self.path if main else Path("packaging")/self.dash):
210
193
  if (
211
194
  self._repo.repo_for(d.a_path, main) != self.name
212
195
  and self._repo.repo_for(d.b_path, main) != self.name
@@ -222,7 +205,11 @@ class Repo(git.Repo, _Common):
222
205
  moat_tag = None
223
206
  _last_tag = None
224
207
 
225
- def __init__(self, *a, **k):
208
+ toplevel:str
209
+
210
+ def __init__(self, toplevel:str, *a, **k):
211
+ self.toplevel = toplevel
212
+
226
213
  super().__init__(*a, **k)
227
214
  self._commit_tags = defaultdict(list)
228
215
  self._commit_topo = {}
@@ -238,11 +225,16 @@ class Repo(git.Repo, _Common):
238
225
  self.moat_name = "-".join(p.parts[mi:])
239
226
  with open("versions.yaml") as f:
240
227
  self.versions = yload(f, attr=True)
228
+ self.orig_versions = deepcopy(self.versions)
229
+
241
230
 
242
231
  def write_tags(self):
232
+ if self.versions == self.orig_versions:
233
+ return False
243
234
  with open("versions.yaml", "w") as f:
244
235
  yprint(self.versions, f)
245
236
  self.index.add("versions.yaml")
237
+ return True
246
238
 
247
239
  @property
248
240
  def last_tag(self) -> Tag | None:
@@ -299,37 +291,34 @@ class Repo(git.Repo, _Common):
299
291
  def _make_repos(self) -> dict:
300
292
  """Collect subrepos"""
301
293
  for fn in Path("packaging").iterdir():
302
- if fn.name == "main":
303
- continue
304
294
  if not fn.is_dir() or "." in fn.name:
305
295
  continue
306
296
  self._add_repo(str(fn.name))
307
297
 
308
- self._repos["main"].populate(Path("moat"))
298
+ self._repos[self.toplevel].populate(Path(self.toplevel))
309
299
 
310
300
  def repo_for(self, path: Path | str, main: bool | None) -> str:
311
301
  """
312
302
  Given a file path, returns the subrepo in question
313
303
  """
314
- sc = self._repos["main"]
304
+ sc = self._repos["moat"]
315
305
  path = Path(path)
316
306
 
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
307
  if main is not True and path.parts[0] == "packaging":
328
308
  try:
329
309
  return undash(path.parts[1])
330
310
  except IndexError:
331
311
  return None
332
312
 
313
+ name = path.parts[0]
314
+ if main is not False and name == self.toplevel:
315
+ for p in path.parts[1:]:
316
+ if p not in sc.subs:
317
+ break
318
+ name += "." + p
319
+ sc = sc.subs[p]
320
+ return name
321
+
333
322
  return None
334
323
 
335
324
  def commits(self, ref=None):
@@ -361,8 +350,9 @@ class Repo(git.Repo, _Common):
361
350
  if tag is None:
362
351
  tag = self.last_tag
363
352
  head = self._repo.head.commit
353
+ print("StartDiff B",self,tag,head,file=sys.stderr)
364
354
  for d in head.diff(tag):
365
- if self.repo_for(d.a_path, main) == "moat" and self.repo_for(d.b_path, main) == "moat":
355
+ if self.repo_for(d.a_path, main) == self.toplevel and self.repo_for(d.b_path, main) == self.toplevel:
366
356
  continue
367
357
  return True
368
358
  return False
@@ -521,21 +511,6 @@ def default_dict(a, b, c, cls=dict, repl=lambda x: x) -> dict:
521
511
  return mod
522
512
 
523
513
 
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
514
  def _mangle(proj, path, mangler):
540
515
  try:
541
516
  for k in path[:-1]:
@@ -582,11 +557,13 @@ def apply_hooks(repo, force=False):
582
557
 
583
558
  @cli.command
584
559
  @click.argument("part", type=str)
585
- def setup(part):
560
+ @click.pass_obj
561
+ def setup(obj, part):
586
562
  """
587
563
  Create a new MoaT subcommand.
588
564
  """
589
- repo = Repo(None)
565
+ cfg = obj.cfg
566
+ repo = Repo(cfg.src.toplevel, None)
590
567
  if "-" in part:
591
568
  part = undash(part)
592
569
 
@@ -714,11 +691,12 @@ def path_():
714
691
 
715
692
 
716
693
  @cli.command()
717
- def tags():
694
+ @click.pass_obj
695
+ def tags(obj):
718
696
  """
719
697
  List all tags
720
698
  """
721
- repo = Repo(None)
699
+ repo = Repo(obj.cfg.src.toplevel, None)
722
700
 
723
701
  for r in repo.parts:
724
702
  try:
@@ -742,7 +720,8 @@ def tags():
742
720
  @click.option("-q", "--query", "--show", "show", is_flag=True, help="Show the latest tag")
743
721
  @click.option("-f", "--force", "FORCE", is_flag=True, help="replace an existing tag")
744
722
  @click.option("-b", "--build", is_flag=True, help="set/increment the build number")
745
- def tag(run, minor, major, subtree, force, FORCE, show, build):
723
+ @click.pass_obj
724
+ def tag(obj, run, minor, major, subtree, force, FORCE, show, build):
746
725
  """
747
726
  Tag the repository (or a subtree).
748
727
 
@@ -763,7 +742,7 @@ def tag(run, minor, major, subtree, force, FORCE, show, build):
763
742
  if build and not subtree:
764
743
  raise click.UsageError("The main release number doesn't have a build")
765
744
 
766
- repo = Repo(None)
745
+ repo = Repo(obj.cfg.src.toplevel, None)
767
746
 
768
747
  if subtree:
769
748
  r = repo.part(subtree)
@@ -771,11 +750,11 @@ def tag(run, minor, major, subtree, force, FORCE, show, build):
771
750
  r = repo
772
751
 
773
752
  if show:
774
- tag = r.last_tag
753
+ tag = r.vers
775
754
  if r.has_changes():
776
- print(f"{tag} STALE")
755
+ print(f"{tag.tag}-{tag.pkg} STALE")
777
756
  else:
778
- print(tag)
757
+ print(f"{tag.tag}-{tag.pkg}")
779
758
  return
780
759
 
781
760
  if force:
@@ -797,10 +776,11 @@ def tag(run, minor, major, subtree, force, FORCE, show, build):
797
776
  pkg=1,
798
777
  rev=repo.head.commit.hexsha,
799
778
  )
779
+ print(f"{tag}-{sb.vers.pkg}")
800
780
  repo.write_tags()
801
781
  else:
802
782
  git.TagReference.create(repo, tag, force=FORCE)
803
- print(f"{tag}")
783
+ print(f"{tag}")
804
784
  else:
805
785
  print(f"{tag} DRY_RUN")
806
786
 
@@ -877,7 +857,7 @@ async def build(
877
857
  g_done = Path(g_done)
878
858
  else:
879
859
  g_done = Path("/tmp/nonexistent")
880
- repo = Repo(None)
860
+ repo = Repo(cfg.src.toplevel, None)
881
861
 
882
862
  tags = dict(version)
883
863
  skip = set()
@@ -915,10 +895,6 @@ async def build(
915
895
  continue
916
896
  name = name.stem
917
897
  name, vers, _ = name.split("_")
918
- if name.startswith("moat-"):
919
- name = name[5:]
920
- else:
921
- name = "ext-" + name
922
898
  debversion[name] = vers.rsplit("-", 1)[0]
923
899
 
924
900
  # Step 0: basic check
@@ -933,6 +909,8 @@ async def build(
933
909
  # Step 1: check for changed files since last tagging
934
910
  if autotag:
935
911
  for r in repos:
912
+ if r.name == "moat.src":
913
+ breakpoint()
936
914
  if r.has_changes(True):
937
915
  try:
938
916
  nt = r.next_tag()
@@ -980,7 +958,7 @@ async def build(
980
958
  fails = set()
981
959
  for p in parts:
982
960
  if not run_tests(p, *pytest_opts):
983
- fails.add(p.name)
961
+ fails.add(p)
984
962
  if fails:
985
963
  if not run:
986
964
  print("*** Tests failed:", *fails, file=sys.stderr)
@@ -1097,17 +1075,14 @@ async def build(
1097
1075
  continue
1098
1076
  tag = r.last_tag
1099
1077
  name = r.dash
1100
- if name.startswith("ext-"):
1101
- name = name[4:]
1102
- else:
1103
- name = "moat-" + r.dash
1104
1078
 
1105
1079
  targz = rd / "dist" / f"{r.under}-{tag}.tar.gz"
1106
1080
  done = rd / "dist" / f"{r.under}-{tag}.done"
1107
1081
 
1108
- if targz.is_file():
1109
- if not done.exists():
1110
- up.add(r)
1082
+ if done.exists():
1083
+ pass
1084
+ elif targz.is_file():
1085
+ up.add(r)
1111
1086
  else:
1112
1087
  try:
1113
1088
  subprocess.run(["python3", "-mbuild", "-snw"], cwd=rd, check=True)
@@ -1136,10 +1111,6 @@ async def build(
1136
1111
  continue
1137
1112
  tag = r.last_tag
1138
1113
  name = r.dash
1139
- if name.startswith("ext-"):
1140
- name = name[4:]
1141
- else:
1142
- name = "moat-" + r.dash
1143
1114
  targz = Path("dist") / f"{r.under}-{tag}.tar.gz"
1144
1115
  whl = Path("dist") / f"{r.under}-{tag}-py3-none-any.whl"
1145
1116
  try:
@@ -1191,11 +1162,7 @@ async def build(
1191
1162
 
1192
1163
  # Step 8: commit the result
1193
1164
  if run:
1194
- for r in repos:
1195
- r.vers.rev = repo.head.commit.hexsha
1196
- repo.write_tags()
1197
-
1198
- if not no_commit:
1165
+ if repo.write_tags() and not no_commit:
1199
1166
  repo.index.commit(f"Build version {forcetag}")
1200
1167
  git.TagReference.create(repo, forcetag)
1201
1168
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moat-src
3
- Version: 0.8.11
3
+ Version: 0.9.1
4
4
  Summary: Tools for managing the MoaT sources
5
5
  Author-email: Matthias Urlichs <matthias@urlichs.de>
6
6
  Project-URL: homepage, https://m-o-a-t.org
@@ -1,2 +0,0 @@
1
- src:
2
- done: "/src/DONE"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes