moat-src 0.5.2__py3-none-any.whl → 0.6.1__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,12 @@
1
+ #!/bin/sh
2
+
3
+ set -x
4
+ ## pre-commit hook to catch editing in "deb" branch without modifying the changelog
5
+ B="$(git rev-parse --abbrev-ref HEAD)"
6
+ if test "$B" = "deb" || test "$B" = "debian" ; then
7
+ S="$(git status -s -- debian/changelog | head -c2 | sed -e 's/ //g')"
8
+ if test "$S" != "A" && test "$S" != "M" ; then
9
+ echo "You can't commit to Debian without a changelog entry."
10
+ exit 1
11
+ fi
12
+ fi
moat/src/_main.py CHANGED
@@ -49,8 +49,12 @@ class Repo(git.Repo):
49
49
  try:
50
50
  res = self._subrepo_cache[r.path]
51
51
  except KeyError:
52
- p = Path(self.working_dir) / r.path
53
- self._subrepo_cache[r.path] = res = Repo(p)
52
+ try:
53
+ p = Path(self.working_dir) / r.path
54
+ self._subrepo_cache[r.path] = res = Repo(p)
55
+ except git.exc.InvalidGitRepositoryError:
56
+ logger.info("%s: invalid, skipping.", p)
57
+ continue
54
58
  res.submod = r
55
59
  if recurse:
56
60
  yield from res.subrepos(depth=depth)
@@ -265,6 +269,28 @@ def encomma(proj, path):
265
269
  """list > comma-delimited string"""
266
270
  _mangle(proj, path, lambda x: ",".join(x)) # pylint: disable=unnecessary-lambda
267
271
 
272
+ def apply_hooks(repo, force=False):
273
+ h = Path(repo.git_dir)/"hooks"
274
+ drop = set()
275
+ seen = set()
276
+ for f in h.iterdir():
277
+ if f.suffix == ".sample":
278
+ drop.add(f)
279
+ continue
280
+ seen.add(f.name)
281
+ for f in drop:
282
+ f.unlink()
283
+
284
+ pt = (Path(__file__).parent / "_hooks")
285
+ for f in pt.iterdir():
286
+ if not force:
287
+ if f.name in seen:
288
+ continue
289
+ t = h/f.name
290
+ d = f.read_text()
291
+ t.write_text(d)
292
+ t.chmod(0o755)
293
+
268
294
 
269
295
  def apply_templates(repo):
270
296
  """
@@ -429,6 +455,8 @@ By default, changes amend the HEAD commit if the text didn't change.
429
455
  @click.option("-D", "--no-dirty", is_flag=True, help="don't check for dirtiness (DANGER)")
430
456
  @click.option("-C", "--no-commit", is_flag=True, help="don't commit")
431
457
  @click.option("-s", "--skip", type=str, multiple=True, help="skip this repo")
458
+ @click.option("--hooks", is_flag=True, help="only update hooks")
459
+ @click.option("--HOOKS", "fhooks", is_flag=True, help="force-update hooks")
432
460
  @click.option(
433
461
  "-m",
434
462
  "--message",
@@ -437,7 +465,7 @@ By default, changes amend the HEAD commit if the text didn't change.
437
465
  default="Update from MoaT template",
438
466
  )
439
467
  @click.option("-o", "--only", type=str, multiple=True, help="affect only this repo")
440
- async def setup(no_dirty, no_commit, skip, only, message, amend, no_amend):
468
+ async def setup(no_dirty, no_commit, skip, only, message, amend, no_amend, hooks, fhooks):
441
469
  """
442
470
  Set up projects using templates.
443
471
 
@@ -451,6 +479,11 @@ async def setup(no_dirty, no_commit, skip, only, message, amend, no_amend):
451
479
  repos = (x for x in repo.subrepos(depth=True) if x.moat_name[5:] not in skip)
452
480
 
453
481
  for r in repos:
482
+ apply_hooks(r, fhooks)
483
+ if hooks or fhooks:
484
+ print(r.working_dir)
485
+ continue
486
+
454
487
  if not is_clean(r, not no_dirty):
455
488
  if not no_dirty:
456
489
  continue
@@ -459,7 +492,7 @@ async def setup(no_dirty, no_commit, skip, only, message, amend, no_amend):
459
492
  if proj.is_file():
460
493
  apply_templates(r)
461
494
  else:
462
- logger.info("%s: no pyproject.toml file. Skipping.")
495
+ logger.info("%s: no pyproject.toml file. Skipping.", r.working_dir)
463
496
  continue
464
497
 
465
498
  if no_commit:
@@ -797,5 +830,5 @@ async def build(version, no_test, no_commit, no_dirty, cache):
797
830
  add_repr(tomlkit.items.String)
798
831
  add_repr(tomlkit.items.Integer)
799
832
  add_repr(tomlkit.items.Bool, bool)
800
- add_repr(tomlkit.items.MutableMapping)
801
- add_repr(tomlkit.items.MutableSequence)
833
+ add_repr(tomlkit.items.AbstractTable)
834
+ add_repr(tomlkit.items.Array)
@@ -1,7 +1,7 @@
1
1
  # Makefile snippet for some standard Python stuff
2
2
 
3
3
  PACKAGE ?= $(notdir $(shell pwd))
4
- PYPI ?= $(PACKAGE)
4
+ PYPI ?= $(subst -,_,${PACKAGE})
5
5
 
6
6
  PATH := /usr/share/sphinx/scripts/python3:${PATH}
7
7
  export PYTHONPATH := $(PYTHONPATH)$(if $(PYTHONPATH),:)$(shell pwd)
@@ -97,7 +97,7 @@ pypi: tagged
97
97
  fi
98
98
  twine upload \
99
99
  dist/${PYPI}-$(shell git describe --tags --exact-match).tar.gz \
100
- dist/$(subst -,_,${PYPI})-$(shell git describe --tags --exact-match)-py3-none-any.whl
100
+ dist/${PYPI}-$(shell git describe --tags --exact-match)-py3-none-any.whl
101
101
 
102
102
  upload: pypi
103
103
  git push --tags
@@ -31,71 +31,72 @@ tool:
31
31
  ini_options:
32
32
  log_cli_level: DEBUG
33
33
  ruff:
34
- select:
35
- - ALL
36
- ignore:
37
- - ANN
38
- - PTH
39
- - PERF
40
- - D105
41
- - D107
42
- - A003
43
- - S101
44
- - RUF001
45
- - RUF002
46
- - PLW1514
47
- - D2
48
- - D3
49
- - D4
50
- - T2
51
- - FBT
52
- - TRY003
53
- - EM10
54
- - PLR
55
- - C
56
- - RET50
57
- - TD
58
- - FIX
59
- - N
60
- - ERA
61
- - BLE001
34
+ lint:
35
+ select:
36
+ - ALL
37
+ ignore:
38
+ - ANN
39
+ - PTH
40
+ - PERF
41
+ - D105
42
+ - D107
43
+ - A003
44
+ - S101
45
+ - RUF001
46
+ - RUF002
47
+ - PLW1514
48
+ - D2
49
+ - D3
50
+ - D4
51
+ - T2
52
+ - FBT
53
+ - TRY003
54
+ - EM10
55
+ - PLR
56
+ - C
57
+ - RET50
58
+ - TD
59
+ - FIX
60
+ - N
61
+ - ERA
62
+ - BLE001
63
+ explicit-preview-rules: true
64
+ flake8-comprehensions:
65
+ allow-dict-calls-with-keyword-arguments: true
66
+ flake8-builtins:
67
+ builtins-ignorelist:
68
+ - id
69
+ - help
70
+ isort:
71
+ no-lines-before:
72
+ - future
73
+ required-imports:
74
+ - "from __future__ import annotations"
75
+ section-order:
76
+ - future
77
+ - typing
78
+ - standard-library
79
+ - first-party
80
+ - upy
81
+ - moat
82
+ - local-folder
83
+ - third-party
84
+ extra-standard-library:
85
+ - pytest
86
+ - anyio
87
+ force-to-top:
88
+ - moat.util
89
+ sections:
90
+ moat:
91
+ - moat
92
+ upy:
93
+ - micropython
94
+ - machine
95
+ - esp
96
+ typing:
97
+ - typing
62
98
  preview: true
63
- explicit-preview-rules: true
64
99
  line-length: 99
65
- flake8-comprehensions:
66
- allow-dict-calls-with-keyword-arguments: true
67
- flake8-builtins:
68
- builtins-ignorelist:
69
- - id
70
- - help
71
- isort:
72
- no-lines-before:
73
- - future
74
- required-imports:
75
- - "from __future__ import annotations"
76
- section-order:
77
- - future
78
- - typing
79
- - standard-library
80
- - first-party
81
- - upy
82
- - moat
83
- - local-folder
84
- - third-party
85
- extra-standard-library:
86
- - pytest
87
- - anyio
88
- force-to-top:
89
- - moat.util
90
- sections:
91
- moat:
92
- - moat
93
- upy:
94
- - micropython
95
- - machine
96
- - esp
97
- typing:
98
- - typing
99
100
  black:
100
101
  line-length: 99
101
102
  flake8:
moat/src/test.py CHANGED
@@ -53,10 +53,9 @@ async def run(*args, expect_exit=0, do_stdout=True):
53
53
  assert expect_exit == 0
54
54
  return res
55
55
  finally:
56
- if res is None:
57
- res = attrdict()
58
56
  if do_stdout:
59
- res.stdout = out.getvalue()
57
+ if res is not None:
58
+ res.stdout = out.getvalue()
60
59
  CFG["_stdout"] = sys.stdout
61
60
 
62
61
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moat-src
3
- Version: 0.5.2
3
+ Version: 0.6.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
@@ -15,9 +15,9 @@ Classifier: License :: OSI Approved
15
15
  Classifier: Development Status :: 4 - Beta
16
16
  Requires-Python: >=3.8
17
17
  Description-Content-Type: text/x-rst
18
- Requires-Dist: anyio (~=3.0)
18
+ Requires-Dist: anyio~=3.0
19
19
  Requires-Dist: asyncclick
20
20
  Requires-Dist: gitpython
21
21
  Requires-Dist: packaging
22
- Requires-Dist: tomlkit (~=0.11)
22
+ Requires-Dist: tomlkit~=0.12
23
23
 
@@ -1,16 +1,17 @@
1
1
  moat/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- moat/src/_main.py,sha256=F_lZOP0pTSD_iPb01LHfeyqaobPjpYkWxSKtJo_rqVI,24501
2
+ moat/src/_main.py,sha256=mIWguSJeHJtS46ndtWZCvHXIK34rXFZKTeRj35QdmnY,25486
3
3
  moat/src/inspect.py,sha256=Rb5x7Qgyb7W1UpGRTPMHB-XLy6J9yZ4Iw4sOhATrOHA,1452
4
- moat/src/test.py,sha256=VB0ZG5svsIJHGtANRYg9KIK4NQHDfkm25t7dJWgfTGc,2166
4
+ moat/src/test.py,sha256=7jOUUwgrbtPS3clwiUgf6sIS7Kb1Yv3XcpZc-hajBP0,2149
5
+ moat/src/_hooks/pre-commit,sha256=_2IeAh-Gq5YjHtA08TBYAMbrDslNSRue59a1Y6mykns,412
5
6
  moat/src/_templates/LICENSE.txt,sha256=X6cpfPmXmOftxOF5o9xedKUWPzU69OiCRrOW1CmRBjs,528
6
7
  moat/src/_templates/Makefile,sha256=fdTxSrMJbQO02XTRatmM-QA6iibYw_il4UrNff0Nkss,268
7
8
  moat/src/_templates/gitignore,sha256=F1dVTKg7mLHLp--Z-KBwU-HyyPOGm-uN0qfS_yK8vz0,436
8
- moat/src/_templates/pyproject.default.yaml,sha256=0ImapzFaJhs-dJXngnGpk--hPDeUAsDk_EXALWJBjvE,2665
9
+ moat/src/_templates/pyproject.default.yaml,sha256=nHUa7dQhe8QpDH9Gbmjflf3BI3ECk2cuXArf0oPCgeg,2801
9
10
  moat/src/_templates/pyproject.forced.yaml,sha256=djfcy3hgfoIgrn2pRrxDWTyN3EEsA1y5NhkzYrGjgNY,1427
10
11
  moat/src/_templates/test_basic_py,sha256=Lr5dq8C04DiRabA0rCURsZdcc2mVAUGPzjLU6iR8LTE,174
11
- moat/src/_templates/make/py,sha256=UbEujNqUNcMTzPfO4nKkJtu6JfvyBnQBe6S-m-GFf3E,2722
12
+ moat/src/_templates/make/py,sha256=on54GbUWeOBkUmCKGWBAIuEJUGgUE6HM3Ty6KXmRpGs,2722
12
13
  moat/src/_templates/moat/__init__.py,sha256=DDN1IA3oN2R1OTIhJCNOOSCpfbqXIByh2WUNYDFcuzw,105
13
- moat_src-0.5.2.dist-info/METADATA,sha256=mNaA_yIMlZmaUlCdbDqQoQGfTUbFjdNbVQyI7KKJjZo,732
14
- moat_src-0.5.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
15
- moat_src-0.5.2.dist-info/top_level.txt,sha256=pcs9fl5w5AB5GVi4SvBqIVmFrkRwQkVw_dEvW0Q0cSA,5
16
- moat_src-0.5.2.dist-info/RECORD,,
14
+ moat_src-0.6.1.dist-info/METADATA,sha256=fj5qvfPsgVhT5Oqpk4C0nyyyP4-N7ZD2ylueOSfXblE,726
15
+ moat_src-0.6.1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
16
+ moat_src-0.6.1.dist-info/top_level.txt,sha256=pcs9fl5w5AB5GVi4SvBqIVmFrkRwQkVw_dEvW0Q0cSA,5
17
+ moat_src-0.6.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5