pubdocrules 0.5.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.
- pubdoc/__init__.py +1 -0
- pubdoc/__main__.py +5 -0
- pubdoc/cli.py +800 -0
- pubdoc/compare.py +121 -0
- pubdoc/corpus.py +245 -0
- pubdoc/fonts/DejaVuSans-Bold.ttf +0 -0
- pubdoc/fonts/DejaVuSans.ttf +0 -0
- pubdoc/fonts/LICENCE-Ubuntu.txt +96 -0
- pubdoc/fonts/LICENSE-DejaVu.txt +78 -0
- pubdoc/fonts/LICENSE-Liberation.txt +130 -0
- pubdoc/fonts/LiberationSans-Bold.ttf +0 -0
- pubdoc/fonts/LiberationSans-BoldItalic.ttf +0 -0
- pubdoc/fonts/LiberationSans-Italic.ttf +0 -0
- pubdoc/fonts/LiberationSans-Regular.ttf +0 -0
- pubdoc/fonts/README.md +21 -0
- pubdoc/fonts/Ubuntu-R.ttf +0 -0
- pubdoc/projects.py +501 -0
- pubdoc/registry.py +54 -0
- pubdoc/schema/doc.schema.json +14 -0
- pubdoc/schema/project.schema.json +142 -0
- pubdoc/schema/pubdoc.schema.json +16 -0
- pubdoc/settings.py +66 -0
- pubdoc/storage.py +126 -0
- pubdoc/templates/annotations.mjs +116 -0
- pubdoc/templates/charged-ieee/template.typ +41 -0
- pubdoc/templates/charged-ieee/template.yml +28 -0
- pubdoc/templates/cv-sidebar/cv-sidebar.typ +113 -0
- pubdoc/templates/cv-sidebar/template.typ +11 -0
- pubdoc/templates/cv-sidebar/template.yml +23 -0
- pubdoc/templates/lapreprint-typst/LICENSE +21 -0
- pubdoc/templates/lapreprint-typst/frontmatter.typ +244 -0
- pubdoc/templates/lapreprint-typst/lapreprint.typ +314 -0
- pubdoc/templates/lapreprint-typst/template.typ +112 -0
- pubdoc/templates/lapreprint-typst/template.yml +82 -0
- pubdoc/templates/linkedin-text.mjs +127 -0
- pubdoc/templates/pub-plugin.mjs +117 -0
- pubdoc/versions.py +383 -0
- pubdocrules-0.5.0.dist-info/METADATA +355 -0
- pubdocrules-0.5.0.dist-info/RECORD +43 -0
- pubdocrules-0.5.0.dist-info/WHEEL +5 -0
- pubdocrules-0.5.0.dist-info/entry_points.txt +2 -0
- pubdocrules-0.5.0.dist-info/licenses/LICENSE +202 -0
- pubdocrules-0.5.0.dist-info/top_level.txt +1 -0
pubdoc/compare.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Whether two PDFs are the same document: the same number of pages, the
|
|
2
|
+
same text, and each page the same picture.
|
|
3
|
+
|
|
4
|
+
A rebuilt PDF is rarely the same bytes as one made months ago: the PDF
|
|
5
|
+
records when it was made, and font subsets and object order move with the
|
|
6
|
+
toolchain. What a reader sees is what has to match, so this compares that,
|
|
7
|
+
with poppler's pdfinfo, pdftotext and pdftoppm.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import shutil
|
|
13
|
+
import subprocess
|
|
14
|
+
import tempfile
|
|
15
|
+
from dataclasses import dataclass, field
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
DPI = 72
|
|
19
|
+
# A pixel differs when its grey level moves by more than this, out of 255:
|
|
20
|
+
# anti-aliasing noise stays under it, a moved glyph or a new colour does not.
|
|
21
|
+
THRESHOLD = 40
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CompareError(Exception):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class Report:
|
|
30
|
+
pages: tuple[int, int]
|
|
31
|
+
text_same: bool
|
|
32
|
+
text_diff: list[str] = field(default_factory=list)
|
|
33
|
+
pixels: list[int] = field(default_factory=list) # differing pixels, per page
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def same(self) -> bool:
|
|
37
|
+
return self.pages[0] == self.pages[1] and self.text_same and not any(self.pixels)
|
|
38
|
+
|
|
39
|
+
def lines(self) -> list[str]:
|
|
40
|
+
out = [f"pages: {self.pages[0]} and {self.pages[1]}"
|
|
41
|
+
+ ("" if self.pages[0] == self.pages[1] else ": they differ")]
|
|
42
|
+
out.append("text: the same" if self.text_same else "text: differs")
|
|
43
|
+
out += [f" {line}" for line in self.text_diff[:40]]
|
|
44
|
+
for page, count in enumerate(self.pixels, 1):
|
|
45
|
+
if count:
|
|
46
|
+
out.append(f"page {page}: {count} pixel(s) differ at {DPI} dpi")
|
|
47
|
+
if self.pixels and not any(self.pixels):
|
|
48
|
+
out.append(f"pixels: every page the same at {DPI} dpi")
|
|
49
|
+
out.append("the same" if self.same else "they differ")
|
|
50
|
+
return out
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def tool(name: str) -> str:
|
|
54
|
+
found = shutil.which(name)
|
|
55
|
+
if not found:
|
|
56
|
+
raise CompareError(f"no '{name}' on PATH; install poppler (apt install poppler-utils)")
|
|
57
|
+
return found
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def run(*argv: str) -> str:
|
|
61
|
+
done = subprocess.run(argv, capture_output=True, text=True)
|
|
62
|
+
if done.returncode != 0:
|
|
63
|
+
raise CompareError(f"{Path(argv[0]).name} failed on {argv[-1]}: {done.stderr.strip()}")
|
|
64
|
+
return done.stdout
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def page_count(pdf: Path) -> int:
|
|
68
|
+
for line in run(tool("pdfinfo"), str(pdf)).splitlines():
|
|
69
|
+
if line.startswith("Pages:"):
|
|
70
|
+
return int(line.split()[1])
|
|
71
|
+
raise CompareError(f"pdfinfo gives no page count for {pdf}")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def words(pdf: Path) -> list[str]:
|
|
75
|
+
return run(tool("pdftotext"), str(pdf), "-").split()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def pages(pdf: Path, out: Path) -> list[bytes]:
|
|
79
|
+
"""Each page as a greyscale PGM's pixels."""
|
|
80
|
+
subprocess.run([tool("pdftoppm"), "-r", str(DPI), "-gray", str(pdf), str(out / "page")],
|
|
81
|
+
check=True, capture_output=True)
|
|
82
|
+
return [pgm(path) for path in sorted(out.glob("page*.pgm"), key=lambda p: int(p.stem.split("-")[-1]))]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def pgm(path: Path) -> bytes:
|
|
86
|
+
data = path.read_bytes()
|
|
87
|
+
# P5 <width> <height> <max>\n<pixels>
|
|
88
|
+
head, fields = 0, []
|
|
89
|
+
while len(fields) < 4:
|
|
90
|
+
while data[head:head + 1].isspace():
|
|
91
|
+
head += 1
|
|
92
|
+
end = head
|
|
93
|
+
while not data[end:end + 1].isspace():
|
|
94
|
+
end += 1
|
|
95
|
+
fields.append(data[head:end])
|
|
96
|
+
head = end
|
|
97
|
+
return fields[1] + b"x" + fields[2] + b":" + data[head + 1:]
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def differing(a: bytes, b: bytes) -> int:
|
|
101
|
+
size_a, _, pixels_a = a.partition(b":")
|
|
102
|
+
size_b, _, pixels_b = b.partition(b":")
|
|
103
|
+
if size_a != size_b:
|
|
104
|
+
return max(len(pixels_a), len(pixels_b))
|
|
105
|
+
return sum(1 for x, y in zip(pixels_a, pixels_b, strict=True) if abs(x - y) > THRESHOLD)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def compare(a: Path, b: Path) -> Report:
|
|
109
|
+
import difflib
|
|
110
|
+
counts = (page_count(a), page_count(b))
|
|
111
|
+
words_a, words_b = words(a), words(b)
|
|
112
|
+
diff = [line for line in difflib.unified_diff(words_a, words_b, "first", "second", n=2, lineterm="")
|
|
113
|
+
if not line.startswith(("---", "+++"))]
|
|
114
|
+
report = Report(counts, words_a == words_b, diff)
|
|
115
|
+
with tempfile.TemporaryDirectory(prefix="pubdoc-compare-") as scratch:
|
|
116
|
+
first, second = Path(scratch) / "a", Path(scratch) / "b"
|
|
117
|
+
first.mkdir()
|
|
118
|
+
second.mkdir()
|
|
119
|
+
pa, pb = pages(a, first), pages(b, second)
|
|
120
|
+
report.pixels = [differing(x, y) for x, y in zip(pa, pb, strict=False)]
|
|
121
|
+
return report
|
pubdoc/corpus.py
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"""`pubdoc corpus init`: the corpus a repository's (or a project's) versions
|
|
2
|
+
are signed in, and its key, made once and backed up; or rebuilt around a
|
|
3
|
+
key put back from its backup.
|
|
4
|
+
|
|
5
|
+
pubdoc corpus init [PROJECT] [--bitwarden-project ID] [--backup-name NAME] [--no-backup]
|
|
6
|
+
|
|
7
|
+
The corpus is the one the settings name (settings.py): a project's own when
|
|
8
|
+
its project.yml names one, else the repository's. Each step is done only
|
|
9
|
+
when it is not done yet, so running it again changes nothing:
|
|
10
|
+
|
|
11
|
+
1. With no key on this machine and no corpus.key in the config: `pub corpus
|
|
12
|
+
init` makes the corpus (corpus.json, and the store .publet/), `pub sign
|
|
13
|
+
--generate-key --principal=human` its key, and corpus.key in the config
|
|
14
|
+
(pubdoc.yml, or the project's project.yml when it names its own corpus)
|
|
15
|
+
then names the key `pubdoc verify` trusts.
|
|
16
|
+
2. With corpus.key in the config and no key on this machine: it stops. The
|
|
17
|
+
key is restored with `pubsec signing-key restore`, never made again, or
|
|
18
|
+
the key the config trusts would sign nothing.
|
|
19
|
+
3. With a key on this machine and no store around it (one just restored):
|
|
20
|
+
`pub sign --restore-key` rebuilds the store's key object from it, and it
|
|
21
|
+
must come out as the key corpus.key names.
|
|
22
|
+
4. pubrules.json's signing_keys declares the key file, under NAME in the
|
|
23
|
+
Bitwarden project ID, where it does not yet (both are needed only then),
|
|
24
|
+
and .gitignore keeps the store out of git.
|
|
25
|
+
5. `pubsec signing-key backup` backs every declared key up, asking for a
|
|
26
|
+
Bitwarden token at a hidden prompt: pubsec's pinned wheel, fetched and
|
|
27
|
+
checked against its sha256 first (uvx does not check a URL's #sha256=).
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from __future__ import annotations
|
|
31
|
+
|
|
32
|
+
import hashlib
|
|
33
|
+
import json
|
|
34
|
+
import os
|
|
35
|
+
import shutil
|
|
36
|
+
import subprocess
|
|
37
|
+
import tempfile
|
|
38
|
+
import urllib.request
|
|
39
|
+
from pathlib import Path
|
|
40
|
+
|
|
41
|
+
from . import projects, settings, versions
|
|
42
|
+
|
|
43
|
+
PUBSEC_WHEEL = "https://github.com/Sustenaut/pubsec/releases/download/v0.3.1/pubsec-0.3.1-py3-none-any.whl"
|
|
44
|
+
PUBSEC_SHA256 = "e1f5fd270a6af71821a8b41287987ae18ba3af19bb9858c2003a9301805ae967"
|
|
45
|
+
STORE = ".publet"
|
|
46
|
+
KEY_FILE = "signing.key"
|
|
47
|
+
RULES = "pubrules.json"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CorpusError(Exception):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def author(corpus: Path) -> str | None:
|
|
55
|
+
config = corpus / STORE / "config"
|
|
56
|
+
if not config.is_file():
|
|
57
|
+
return None
|
|
58
|
+
for line in config.read_text(encoding="utf-8").splitlines():
|
|
59
|
+
if line.startswith("author="):
|
|
60
|
+
return line.split("=", 1)[1].strip()
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def config_file(root: Path, project: projects.Project | None) -> Path:
|
|
65
|
+
"""Where corpus.key belongs: the project's project.yml when it names its
|
|
66
|
+
own corpus, else the repository's pubdoc.yml."""
|
|
67
|
+
if project and "corpus" in project.config:
|
|
68
|
+
return project.file
|
|
69
|
+
return root / settings.ROOT_FILE
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def inside(root: Path, file: Path) -> str:
|
|
73
|
+
"""`file`, resolved, refused unless it lies in the repository at `root`:
|
|
74
|
+
corpus init writes nothing anywhere else, and reads and writes the path
|
|
75
|
+
this returns, never the one it was given."""
|
|
76
|
+
base = os.path.realpath(root)
|
|
77
|
+
target = os.path.realpath(file)
|
|
78
|
+
if not target.startswith(base + os.sep):
|
|
79
|
+
raise CorpusError(f"{file} is outside the repository at {root}; nothing written")
|
|
80
|
+
return target
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _read(target: str) -> str:
|
|
84
|
+
if not os.path.isfile(target):
|
|
85
|
+
return ""
|
|
86
|
+
with open(target, encoding="utf-8") as f:
|
|
87
|
+
return f.read()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _write(target: str, text: str) -> None:
|
|
91
|
+
with open(target, "w", encoding="utf-8") as f:
|
|
92
|
+
f.write(text)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def write_key(root: Path, file: Path, corpus_path: str, key: str) -> None:
|
|
96
|
+
"""Name `key` as corpus.key in `file`, keeping its other lines (comments
|
|
97
|
+
included): a `corpus:` line in flow style gains or changes its key; a
|
|
98
|
+
file without one gains one."""
|
|
99
|
+
target = inside(root, file)
|
|
100
|
+
text = _read(target)
|
|
101
|
+
lines = text.splitlines()
|
|
102
|
+
for i, line in enumerate(lines):
|
|
103
|
+
if line.startswith("corpus:"):
|
|
104
|
+
body = line[len("corpus:"):].strip()
|
|
105
|
+
if not (body.startswith("{") and body.endswith("}")):
|
|
106
|
+
raise CorpusError(f"{projects.shown(file)}: its corpus: is not one line, "
|
|
107
|
+
f"{{path: ..}}; add key: {key} to it yourself")
|
|
108
|
+
fields = [f.strip() for f in body[1:-1].split(",") if f.strip() and not f.strip().startswith("key:")]
|
|
109
|
+
lines[i] = f"corpus: {{{', '.join([*fields, f'key: {key}'])}}}"
|
|
110
|
+
break
|
|
111
|
+
else:
|
|
112
|
+
lines.append(f"corpus: {{path: {corpus_path}, key: {key}}}")
|
|
113
|
+
_write(target, "\n".join(lines) + "\n")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def declare(root: Path, key_path: str, name: str | None, project_id: str | None) -> str | None:
|
|
117
|
+
"""The Bitwarden name pubrules.json's signing_keys gives the key at
|
|
118
|
+
`key_path`, declaring it when it is not declared yet."""
|
|
119
|
+
rules = inside(root, root / RULES)
|
|
120
|
+
if not os.path.isfile(rules):
|
|
121
|
+
return None
|
|
122
|
+
text = _read(rules)
|
|
123
|
+
config = json.loads(text)
|
|
124
|
+
for entry in config.get("signing_keys") or []:
|
|
125
|
+
if entry.get("path") == key_path:
|
|
126
|
+
return entry["bitwarden"]["name"]
|
|
127
|
+
if not (name and project_id):
|
|
128
|
+
raise CorpusError(f"{RULES} does not declare {key_path} in signing_keys: give --bitwarden-project "
|
|
129
|
+
"(the Bitwarden project's id) and --backup-name (the secret's name) to declare it")
|
|
130
|
+
entry = json.dumps({"path": key_path, "bitwarden": {"project": {"id": project_id}, "name": name}})
|
|
131
|
+
if '"signing_keys": [' in text:
|
|
132
|
+
text = text.replace('"signing_keys": [', f'"signing_keys": [\n {entry},', 1)
|
|
133
|
+
else:
|
|
134
|
+
config["signing_keys"] = [json.loads(entry)]
|
|
135
|
+
text = json.dumps(config, indent=2) + "\n"
|
|
136
|
+
json.loads(text) # still JSON
|
|
137
|
+
_write(rules, text)
|
|
138
|
+
return name
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def ignore(root: Path, store: str) -> bool:
|
|
142
|
+
gitignore = inside(root, root / ".gitignore")
|
|
143
|
+
text = _read(gitignore)
|
|
144
|
+
line = f"/{store}/"
|
|
145
|
+
if line in text.splitlines():
|
|
146
|
+
return False
|
|
147
|
+
gap = "" if not text or text.endswith("\n") else "\n"
|
|
148
|
+
_write(gitignore, f"{text}{gap}# A corpus's signing key and store: only on the approver's machine.\n"
|
|
149
|
+
f"{line}\n")
|
|
150
|
+
return True
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def pubsec(root: Path, *args: str) -> int:
|
|
154
|
+
"""Run pubsec's pinned wheel, checked by its sha256; $PUBDOC_PUBSEC names
|
|
155
|
+
another pubsec to run instead."""
|
|
156
|
+
if os.environ.get("PUBDOC_PUBSEC"):
|
|
157
|
+
return subprocess.call([os.environ["PUBDOC_PUBSEC"], *args], cwd=root)
|
|
158
|
+
uvx = shutil.which("uvx")
|
|
159
|
+
if not uvx:
|
|
160
|
+
raise CorpusError("pubsec runs with uv: curl -LsSf https://astral.sh/uv/install.sh | sh")
|
|
161
|
+
with tempfile.TemporaryDirectory(prefix="pubdoc-pubsec-") as scratch:
|
|
162
|
+
wheel = Path(scratch) / PUBSEC_WHEEL.rsplit("/", 1)[1]
|
|
163
|
+
with urllib.request.urlopen(PUBSEC_WHEEL, timeout=120) as answer:
|
|
164
|
+
wheel.write_bytes(answer.read())
|
|
165
|
+
if hashlib.sha256(wheel.read_bytes()).hexdigest() != PUBSEC_SHA256:
|
|
166
|
+
raise CorpusError(f"{wheel.name} is not the pubsec wheel pubdoc pins")
|
|
167
|
+
return subprocess.call([uvx, "--from", str(wheel), "pubsec", *args], cwd=root)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def init(project: projects.Project | None, root: Path, backup_name: str | None,
|
|
171
|
+
bitwarden_project: str | None, backup: bool) -> list[str]:
|
|
172
|
+
"""Make or complete the corpus; what was done, line by line."""
|
|
173
|
+
conf = settings.of(project) if project else root_settings(root)
|
|
174
|
+
# The corpus is made, and pub run in it, only inside the repository.
|
|
175
|
+
corpus, trusted = Path(inside(root, conf.corpus)), conf.key
|
|
176
|
+
key_file = corpus / STORE / KEY_FILE
|
|
177
|
+
key_path = os.path.relpath(key_file, root)
|
|
178
|
+
file = config_file(root, project)
|
|
179
|
+
done: list[str] = []
|
|
180
|
+
versions.require_pub()
|
|
181
|
+
if not key_file.is_file():
|
|
182
|
+
if trusted:
|
|
183
|
+
name = declare(root, key_path, None, None) if (root / RULES).is_file() else None
|
|
184
|
+
raise CorpusError(
|
|
185
|
+
f"{projects.shown(file)} trusts {trusted}, and {projects.shown(key_file)} is not on this "
|
|
186
|
+
f"machine: restore it, never make another: pubsec signing-key restore {name or '<its name>'}, "
|
|
187
|
+
"then run this again")
|
|
188
|
+
corpus.mkdir(parents=True, exist_ok=True)
|
|
189
|
+
if not (corpus / "corpus.json").is_file():
|
|
190
|
+
versions.run_pub(corpus, "corpus", "init")
|
|
191
|
+
done.append(f"made the corpus {projects.shown(corpus)}")
|
|
192
|
+
versions.run_pub(corpus, "sign", "--generate-key", "--principal=human")
|
|
193
|
+
key = author(corpus)
|
|
194
|
+
if not (key and key.startswith("pub:sha2-256:")):
|
|
195
|
+
raise CorpusError(f"pub made a key, and {projects.shown(corpus / STORE / 'config')} names none")
|
|
196
|
+
write_key(root, file, os.path.relpath(corpus, file.parent), key)
|
|
197
|
+
done.append(f"made its key {key}, trusted in {projects.shown(file)}")
|
|
198
|
+
else:
|
|
199
|
+
before = author(corpus)
|
|
200
|
+
if not (trusted and before == trusted):
|
|
201
|
+
# A key put back from its backup: the store around it is rebuilt
|
|
202
|
+
# (pub init's placeholder author included), and must come out as
|
|
203
|
+
# the key the config trusts.
|
|
204
|
+
if not (corpus / STORE / "config").is_file():
|
|
205
|
+
versions.run_pub(corpus, "init")
|
|
206
|
+
args = ["sign", "--restore-key", "--principal=human"]
|
|
207
|
+
if trusted:
|
|
208
|
+
args.append(f"--expect={trusted}")
|
|
209
|
+
try:
|
|
210
|
+
versions.run_pub(corpus, *args)
|
|
211
|
+
except versions.VersionError as e:
|
|
212
|
+
if "--restore-key" in str(e) and "unknown argument" in str(e):
|
|
213
|
+
raise CorpusError("rebuilding the store around a restored key needs pub 0.4.1 or later "
|
|
214
|
+
"(pub sign --restore-key)") from None
|
|
215
|
+
raise
|
|
216
|
+
key = author(corpus)
|
|
217
|
+
if key != before:
|
|
218
|
+
done.append(f"rebuilt the store around {projects.shown(key_file)}: {key}")
|
|
219
|
+
if not trusted:
|
|
220
|
+
write_key(root, file, os.path.relpath(corpus, file.parent), key)
|
|
221
|
+
done.append(f"trusted {key} in {projects.shown(file)}")
|
|
222
|
+
elif key != trusted:
|
|
223
|
+
raise CorpusError(f"{projects.shown(key_file)} is the key {key}, and {projects.shown(file)} "
|
|
224
|
+
f"trusts {trusted}")
|
|
225
|
+
name = declare(root, key_path, backup_name, bitwarden_project) if (root / RULES).is_file() else None
|
|
226
|
+
if name:
|
|
227
|
+
done.append(f"{RULES} declares {key_path} as {name}")
|
|
228
|
+
if ignore(root, os.path.relpath(corpus / STORE, root)):
|
|
229
|
+
done.append(f"ignored {os.path.relpath(corpus / STORE, root)}/ in .gitignore")
|
|
230
|
+
if backup and name:
|
|
231
|
+
if pubsec(root, "signing-key", "backup") != 0:
|
|
232
|
+
raise CorpusError("pubsec signing-key backup failed; the key is not backed up yet")
|
|
233
|
+
done.append(f"backed up as {name}")
|
|
234
|
+
return done
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def root_settings(root: Path) -> settings.Settings:
|
|
238
|
+
"""The repository's own settings, from its pubdoc.yml alone."""
|
|
239
|
+
base = settings.root_config(root, [])
|
|
240
|
+
storage = base.get("storage", {})
|
|
241
|
+
corpus = base.get("corpus", {})
|
|
242
|
+
return settings.Settings(root=root, tenant=storage.get("tenant"),
|
|
243
|
+
storage_url=storage.get("url", settings.STORAGE_URL).rstrip("/"),
|
|
244
|
+
corpus=(root / corpus.get("path", "corpus")).resolve(), key=corpus.get("key"))
|
|
245
|
+
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
-------------------------------
|
|
2
|
+
UBUNTU FONT LICENCE Version 1.0
|
|
3
|
+
-------------------------------
|
|
4
|
+
|
|
5
|
+
PREAMBLE
|
|
6
|
+
This licence allows the licensed fonts to be used, studied, modified and
|
|
7
|
+
redistributed freely. The fonts, including any derivative works, can be
|
|
8
|
+
bundled, embedded, and redistributed provided the terms of this licence
|
|
9
|
+
are met. The fonts and derivatives, however, cannot be released under
|
|
10
|
+
any other licence. The requirement for fonts to remain under this
|
|
11
|
+
licence does not require any document created using the fonts or their
|
|
12
|
+
derivatives to be published under this licence, as long as the primary
|
|
13
|
+
purpose of the document is not to be a vehicle for the distribution of
|
|
14
|
+
the fonts.
|
|
15
|
+
|
|
16
|
+
DEFINITIONS
|
|
17
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
18
|
+
Holder(s) under this licence and clearly marked as such. This may
|
|
19
|
+
include source files, build scripts and documentation.
|
|
20
|
+
|
|
21
|
+
"Original Version" refers to the collection of Font Software components
|
|
22
|
+
as received under this licence.
|
|
23
|
+
|
|
24
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
25
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
26
|
+
Original Version, by changing formats or by porting the Font Software to
|
|
27
|
+
a new environment.
|
|
28
|
+
|
|
29
|
+
"Copyright Holder(s)" refers to all individuals and companies who have a
|
|
30
|
+
copyright ownership of the Font Software.
|
|
31
|
+
|
|
32
|
+
"Substantially Changed" refers to Modified Versions which can be easily
|
|
33
|
+
identified as dissimilar to the Font Software by users of the Font
|
|
34
|
+
Software comparing the Original Version with the Modified Version.
|
|
35
|
+
|
|
36
|
+
To "Propagate" a work means to do anything with it that, without
|
|
37
|
+
permission, would make you directly or secondarily liable for
|
|
38
|
+
infringement under applicable copyright law, except executing it on a
|
|
39
|
+
computer or modifying a private copy. Propagation includes copying,
|
|
40
|
+
distribution (with or without modification and with or without charging
|
|
41
|
+
a redistribution fee), making available to the public, and in some
|
|
42
|
+
countries other activities as well.
|
|
43
|
+
|
|
44
|
+
PERMISSION & CONDITIONS
|
|
45
|
+
This licence does not grant any rights under trademark law and all such
|
|
46
|
+
rights are reserved.
|
|
47
|
+
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
49
|
+
copy of the Font Software, to propagate the Font Software, subject to
|
|
50
|
+
the below conditions:
|
|
51
|
+
|
|
52
|
+
1) Each copy of the Font Software must contain the above copyright
|
|
53
|
+
notice and this licence. These can be included either as stand-alone
|
|
54
|
+
text files, human-readable headers or in the appropriate machine-
|
|
55
|
+
readable metadata fields within text or binary files as long as those
|
|
56
|
+
fields can be easily viewed by the user.
|
|
57
|
+
|
|
58
|
+
2) The font name complies with the following:
|
|
59
|
+
(a) The Original Version must retain its name, unmodified.
|
|
60
|
+
(b) Modified Versions which are Substantially Changed must be renamed to
|
|
61
|
+
avoid use of the name of the Original Version or similar names entirely.
|
|
62
|
+
(c) Modified Versions which are not Substantially Changed must be
|
|
63
|
+
renamed to both (i) retain the name of the Original Version and (ii) add
|
|
64
|
+
additional naming elements to distinguish the Modified Version from the
|
|
65
|
+
Original Version. The name of such Modified Versions must be the name of
|
|
66
|
+
the Original Version, with "derivative X" where X represents the name of
|
|
67
|
+
the new work, appended to that name.
|
|
68
|
+
|
|
69
|
+
3) The name(s) of the Copyright Holder(s) and any contributor to the
|
|
70
|
+
Font Software shall not be used to promote, endorse or advertise any
|
|
71
|
+
Modified Version, except (i) as required by this licence, (ii) to
|
|
72
|
+
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
|
|
73
|
+
their explicit written permission.
|
|
74
|
+
|
|
75
|
+
4) The Font Software, modified or unmodified, in part or in whole, must
|
|
76
|
+
be distributed entirely under this licence, and must not be distributed
|
|
77
|
+
under any other licence. The requirement for fonts to remain under this
|
|
78
|
+
licence does not affect any document created using the Font Software,
|
|
79
|
+
except any version of the Font Software extracted from a document
|
|
80
|
+
created using the Font Software may only be distributed under this
|
|
81
|
+
licence.
|
|
82
|
+
|
|
83
|
+
TERMINATION
|
|
84
|
+
This licence becomes null and void if any of the above conditions are
|
|
85
|
+
not met.
|
|
86
|
+
|
|
87
|
+
DISCLAIMER
|
|
88
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
89
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
90
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
91
|
+
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
92
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
93
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
94
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
95
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
96
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
2
|
+
Upstream-Name: DejaVu fonts
|
|
3
|
+
Upstream-Author: Stepan Roh <src@users.sourceforge.net> (original author),
|
|
4
|
+
see /usr/share/doc/fonts-dejavu-core/AUTHORS for full list
|
|
5
|
+
Source: https://dejavu-fonts.github.io/
|
|
6
|
+
|
|
7
|
+
Files: *
|
|
8
|
+
Copyright: Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved.
|
|
9
|
+
Bitstream Vera is a trademark of Bitstream, Inc.
|
|
10
|
+
DejaVu changes are in public domain.
|
|
11
|
+
License: bitstream-vera
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of the fonts accompanying this license ("Fonts") and associated
|
|
14
|
+
documentation files (the "Font Software"), to reproduce and distribute the
|
|
15
|
+
Font Software, including without limitation the rights to use, copy, merge,
|
|
16
|
+
publish, distribute, and/or sell copies of the Font Software, and to permit
|
|
17
|
+
persons to whom the Font Software is furnished to do so, subject to the
|
|
18
|
+
following conditions:
|
|
19
|
+
.
|
|
20
|
+
The above copyright and trademark notices and this permission notice shall
|
|
21
|
+
be included in all copies of one or more of the Font Software typefaces.
|
|
22
|
+
.
|
|
23
|
+
The Font Software may be modified, altered, or added to, and in particular
|
|
24
|
+
the designs of glyphs or characters in the Fonts may be modified and
|
|
25
|
+
additional glyphs or characters may be added to the Fonts, only if the fonts
|
|
26
|
+
are renamed to names not containing either the words "Bitstream" or the word
|
|
27
|
+
"Vera".
|
|
28
|
+
.
|
|
29
|
+
This License becomes null and void to the extent applicable to Fonts or Font
|
|
30
|
+
Software that has been modified and is distributed under the "Bitstream
|
|
31
|
+
Vera" names.
|
|
32
|
+
.
|
|
33
|
+
The Font Software may be sold as part of a larger software package but no
|
|
34
|
+
copy of one or more of the Font Software typefaces may be sold by itself.
|
|
35
|
+
.
|
|
36
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
37
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
|
39
|
+
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
|
40
|
+
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
|
41
|
+
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
|
42
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
43
|
+
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
|
44
|
+
FONT SOFTWARE.
|
|
45
|
+
.
|
|
46
|
+
Except as contained in this notice, the names of Gnome, the Gnome
|
|
47
|
+
Foundation, and Bitstream Inc., shall not be used in advertising or
|
|
48
|
+
otherwise to promote the sale, use or other dealings in this Font Software
|
|
49
|
+
without prior written authorization from the Gnome Foundation or Bitstream
|
|
50
|
+
Inc., respectively. For further information, contact: fonts at gnome dot
|
|
51
|
+
org.
|
|
52
|
+
|
|
53
|
+
Files: debian/*
|
|
54
|
+
Copyright: (C) 2005-2006 Peter Cernak <pce@users.sourceforge.net>
|
|
55
|
+
(C) 2006-2011 Davide Viti <zinosat@tiscali.it>
|
|
56
|
+
(C) 2011-2013 Christian Perrier <bubulle@debian.org>
|
|
57
|
+
(C) 2013 Fabian Greffrath <fabian+debian@greffrath.com>
|
|
58
|
+
License: GPL-2+
|
|
59
|
+
This program is free software; you can redistribute it
|
|
60
|
+
and/or modify it under the terms of the GNU General Public
|
|
61
|
+
License as published by the Free Software Foundation; either
|
|
62
|
+
version 2 of the License, or (at your option) any later
|
|
63
|
+
version.
|
|
64
|
+
.
|
|
65
|
+
This program is distributed in the hope that it will be
|
|
66
|
+
useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
67
|
+
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
68
|
+
PURPOSE. See the GNU General Public License for more
|
|
69
|
+
details.
|
|
70
|
+
.
|
|
71
|
+
You should have received a copy of the GNU General Public
|
|
72
|
+
License along with this package; if not, write to the Free
|
|
73
|
+
Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
74
|
+
Boston, MA 02110-1301 USA
|
|
75
|
+
.
|
|
76
|
+
On Debian systems, the full text of the GNU General Public
|
|
77
|
+
License version 2 can be found in the file
|
|
78
|
+
/usr/share/common-licenses/GPL-2'.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
2
|
+
Upstream-Name: Liberation Fonts
|
|
3
|
+
Source: https://github.com/liberationfonts
|
|
4
|
+
|
|
5
|
+
Files: *
|
|
6
|
+
Copyright:
|
|
7
|
+
Digitized data copyright (c) 2010 Google Corporation with Reserved Font Arimo, Tinos and Cousine.
|
|
8
|
+
Copyright (c) 2012 Red Hat, Inc. with Reserved Font Name Liberation.
|
|
9
|
+
License: SIL-OFL-1.1
|
|
10
|
+
This Font Software is licensed under the SIL Open Font License,
|
|
11
|
+
Version 1.1.
|
|
12
|
+
.
|
|
13
|
+
This license is copied below, and is also available with a FAQ at:
|
|
14
|
+
http://scripts.sil.org/OFL
|
|
15
|
+
.
|
|
16
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
17
|
+
.
|
|
18
|
+
PREAMBLE The goals of the Open Font License (OFL) are to stimulate
|
|
19
|
+
worldwide development of collaborative font projects, to support the font
|
|
20
|
+
creation efforts of academic and linguistic communities, and to provide
|
|
21
|
+
a free and open framework in which fonts may be shared and improved in
|
|
22
|
+
partnership with others.
|
|
23
|
+
.
|
|
24
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
25
|
+
redistributed freely as long as they are not sold by themselves.
|
|
26
|
+
The fonts, including any derivative works, can be bundled, embedded,
|
|
27
|
+
redistributed and/or sold with any software provided that any reserved
|
|
28
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
29
|
+
however, cannot be released under any other type of license. The
|
|
30
|
+
requirement for fonts to remain under this license does not apply to
|
|
31
|
+
any document created using the fonts or their derivatives.
|
|
32
|
+
.
|
|
33
|
+
.
|
|
34
|
+
.
|
|
35
|
+
DEFINITIONS
|
|
36
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
37
|
+
Holder(s) under this license and clearly marked as such.
|
|
38
|
+
This may include source files, build scripts and documentation.
|
|
39
|
+
.
|
|
40
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
41
|
+
copyright statement(s).
|
|
42
|
+
.
|
|
43
|
+
"Original Version" refers to the collection of Font Software components
|
|
44
|
+
as distributed by the Copyright Holder(s).
|
|
45
|
+
.
|
|
46
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
47
|
+
or substituting ? in part or in whole ?
|
|
48
|
+
any of the components of the Original Version, by changing formats or
|
|
49
|
+
by porting the Font Software to a new environment.
|
|
50
|
+
.
|
|
51
|
+
"Author" refers to any designer, engineer, programmer, technical writer
|
|
52
|
+
or other person who contributed to the Font Software.
|
|
53
|
+
.
|
|
54
|
+
.
|
|
55
|
+
PERMISSION & CONDITIONS
|
|
56
|
+
.
|
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
58
|
+
copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
59
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
60
|
+
Software, subject to the following conditions:
|
|
61
|
+
.
|
|
62
|
+
1) Neither the Font Software nor any of its individual components,in
|
|
63
|
+
Original or Modified Versions, may be sold by itself.
|
|
64
|
+
.
|
|
65
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
66
|
+
redistributed and/or sold with any software, provided that each copy
|
|
67
|
+
contains the above copyright notice and this license. These can be
|
|
68
|
+
included either as stand-alone text files, human-readable headers or
|
|
69
|
+
in the appropriate machine-readable metadata fields within text or
|
|
70
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
71
|
+
.
|
|
72
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
73
|
+
Name(s) unless explicit written permission is granted by the
|
|
74
|
+
corresponding Copyright Holder. This restriction only applies to the
|
|
75
|
+
primary font name as presented to the users.
|
|
76
|
+
.
|
|
77
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
78
|
+
Software shall not be used to promote, endorse or advertise any
|
|
79
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
80
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
81
|
+
permission.
|
|
82
|
+
.
|
|
83
|
+
5) The Font Software, modified or unmodified, in part or in whole, must
|
|
84
|
+
be distributed entirely under this license, and must not be distributed
|
|
85
|
+
under any other license. The requirement for fonts to remain under
|
|
86
|
+
this license does not apply to any document created using the Font
|
|
87
|
+
Software.
|
|
88
|
+
.
|
|
89
|
+
.
|
|
90
|
+
.
|
|
91
|
+
TERMINATION
|
|
92
|
+
This license becomes null and void if any of the above conditions are not met.
|
|
93
|
+
.
|
|
94
|
+
.
|
|
95
|
+
.
|
|
96
|
+
DISCLAIMER
|
|
97
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
98
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
99
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
100
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
101
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
102
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
103
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
104
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
|
|
105
|
+
DEALINGS IN THE FONT SOFTWARE.
|
|
106
|
+
.
|
|
107
|
+
|
|
108
|
+
Files: debian/*
|
|
109
|
+
Copyright:
|
|
110
|
+
2008 Alan Baghumian <alan@technotux.org>
|
|
111
|
+
2008-2018 Holger Levsen <holger@debian.org>
|
|
112
|
+
2009-2012 Christian Perrier <bubulle@debian.org>
|
|
113
|
+
2011-2023 Fabian Greffrath <fabian@debian.org>
|
|
114
|
+
2018 Rene Engelhard <rene@debian.org>
|
|
115
|
+
License: GPL-2+
|
|
116
|
+
This package is free software; you can redistribute it and/or modify
|
|
117
|
+
it under the terms of the GNU General Public License as published by
|
|
118
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
119
|
+
(at your option) any later version.
|
|
120
|
+
.
|
|
121
|
+
This package is distributed in the hope that it will be useful,
|
|
122
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
123
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
124
|
+
GNU General Public License for more details.
|
|
125
|
+
.
|
|
126
|
+
You should have received a copy of the GNU General Public License
|
|
127
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>
|
|
128
|
+
.
|
|
129
|
+
On Debian systems, the complete text of the GNU General
|
|
130
|
+
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
|
Binary file
|
|
Binary file
|