Skip to content

Commit 4aa1e8e

Browse files
authored
Revert "Add changelog to generate JSON metadata schema (#48)" (#51)
This reverts commit a609108.
1 parent a609108 commit 4aa1e8e

File tree

11 files changed

+13
-107
lines changed

11 files changed

+13
-107
lines changed

_validate/addonManifest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class AddonManifest(ConfigObj):
3131
# Long description with further information and instructions
3232
description = string(default=None)
3333
34-
# Document changes between the previous and the current versions.
35-
changelog = string(default=None)
36-
3734
# Name of the author or entity that created the add-on
3835
author = string()
3936
@@ -92,8 +89,8 @@ def __init__(self, input: str | TextIOBase, translatedInput: str | None = None):
9289
self._translatedConfig = None
9390
if translatedInput is not None:
9491
self._translatedConfig = ConfigObj(translatedInput, encoding="utf-8", default_encoding="utf-8")
95-
for key in ("summary", "description", "changelog"):
96-
val: str | None = self._translatedConfig.get(key) # type: ignore[reportUnknownMemberType]
92+
for key in ("summary", "description"):
93+
val: str = self._translatedConfig.get(key) # type: ignore[reportUnknownMemberType]
9794
if val:
9895
self[key] = val
9996

_validate/addonVersion_schema.json

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@
2828
"sourceURL": "https://github.com/nvaccess/addon-datastore/",
2929
"license": "GPL v2",
3030
"licenseURL": "https://github.com/nvaccess/addon-datastore/license.MD",
31-
"changelog": "New features",
3231
"translations": [
3332
{
3433
"language": "de",
3534
"displayName": "Mein Addon",
36-
"description": "erleichtert das Durchführen von xyz",
37-
"changelog": "Neue Funktionen"
35+
"description": "erleichtert das Durchführen von xyz"
3836
}
3937
],
4038
"reviewUrl": "https://github.com/nvaccess/addon-datastore/discussions/1942#discussioncomment-7453248",
@@ -230,16 +228,6 @@
230228
"title": "The URL of the license",
231229
"type": "string"
232230
},
233-
"changelog": {
234-
"$id": "#/properties/changelog",
235-
"default": "",
236-
"description": "Changes between the previous and the current version",
237-
"examples": [
238-
"New feature"
239-
],
240-
"title": "Add-on changelog (en)",
241-
"type": "string"
242-
},
243231
"legacy": {
244232
"$id": "#/properties/legacy",
245233
"default": false,
@@ -259,8 +247,7 @@
259247
{
260248
"language": "de",
261249
"displayName": "Mein Addon",
262-
"description": "erleichtert das Durchführen von xyz",
263-
"changelog": "Neue Funktionen"
250+
"description": "erleichtert das Durchführen von xyz"
264251
}
265252
]
266253
],
@@ -370,8 +357,7 @@
370357
{
371358
"language": "de",
372359
"displayName": "Mein Addon",
373-
"description": "erleichtert das Durchführen von xyz",
374-
"changelog": "Neue Funktionen"
360+
"description": "erleichtert das Durchführen von xyz"
375361
}
376362
],
377363
"required": [
@@ -407,15 +393,6 @@
407393
],
408394
"title": "The translated description",
409395
"type": "string"
410-
},
411-
"changelog": {
412-
"default": "",
413-
"description": "Translated description of changes between the previous and this add-on version",
414-
"examples": [
415-
"Neue Funktionen"
416-
],
417-
"title": "The translated changelog",
418-
"type": "string"
419396
}
420397
}
421398
}

_validate/createJson.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ class AddonData:
3232
sourceURL: str
3333
license: str
3434
homepage: str | None
35-
changelog: str | None
3635
licenseURL: str | None
3736
submissionTime: int
38-
translations: list[dict[str, str | None]]
37+
translations: list[dict[str, str]]
3938

4039

4140
def getSha256(addonPath: str) -> str:
@@ -109,31 +108,17 @@ def _createDataclassMatchingJsonSchema(
109108

110109
# Add optional fields
111110
homepage: str | None = manifest.get("url") # type: ignore[reportUnknownMemberType]
112-
if homepage == "None":
113-
# The config default is None
114-
# which is parsed by configobj as a string not a NoneType
111+
if not homepage or homepage == "None":
115112
homepage = None
116-
changelog: str | None = manifest.get("changelog") # type: ignore[reportUnknownMemberType]
117-
if changelog == "None":
118-
# The config default is None
119-
# which is parsed by configobj as a string not a NoneType
120-
changelog = None
121-
translations: list[dict[str, str | None]] = []
122-
for langCode, translatedManifest in getAddonManifestLocalizations(manifest):
123-
# Add optional translated changelog.
124-
translatedChangelog: str | None = translatedManifest.get("changelog") # type: ignore[reportUnknownMemberType]
125-
if translatedChangelog == "None":
126-
# The config default is None
127-
# which is parsed by configobj as a string not a NoneType
128-
translatedChangelog = None
129113

114+
translations: list[dict[str, str]] = []
115+
for langCode, translatedManifest in getAddonManifestLocalizations(manifest):
130116
try:
131117
translations.append(
132118
{
133119
"language": langCode,
134120
"displayName": cast(str, translatedManifest["summary"]),
135121
"description": cast(str, translatedManifest["description"]),
136-
"changelog": translatedChangelog,
137122
},
138123
)
139124
except KeyError as e:
@@ -156,7 +141,6 @@ def _createDataclassMatchingJsonSchema(
156141
sourceURL=sourceUrl,
157142
license=licenseName,
158143
homepage=homepage,
159-
changelog=changelog,
160144
licenseURL=licenseUrl,
161145
submissionTime=getCurrentTime(),
162146
translations=translations,

_validate/regenerateTranslations.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,13 @@ def regenerateJsonFile(filePath: str, errorFilePath: str | None) -> None:
2323
with open(errorFilePath, "w") as errorFile:
2424
errorFile.write(f"Validation Errors:\n{manifest.errors}")
2525
return
26-
changelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType]
27-
if changelog == "None":
28-
# The config default is None
29-
# which is parsed by configobj as a string not a NoneType
30-
changelog = None
26+
3127
for langCode, manifest in getAddonManifestLocalizations(manifest):
32-
translatedChangelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType]
33-
if translatedChangelog == "None":
34-
# The config default is None
35-
# which is parsed by configobj as a string not a NoneType
36-
translatedChangelog = None
3728
addonData["translations"].append(
3829
{
3930
"language": langCode,
4031
"displayName": manifest["summary"],
4132
"description": manifest["description"],
42-
"changelog": translatedChangelog,
4333
},
4434
)
4535

_validate/validate.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,6 @@ def checkDescriptionMatches(manifest: AddonManifest, submission: JsonObjT) -> Va
134134
)
135135

136136

137-
def checkChangelogMatches(manifest: AddonManifest, submission: JsonObjT) -> ValidationErrorGenerator:
138-
"""The submission changelog must match the *.nvda-addon manifest changelog field."""
139-
changelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType]
140-
if changelog == "None":
141-
# The config default is None which is parsed by configobj as a string not a NoneType
142-
changelog = None
143-
if changelog != submission.get("changelog"):
144-
yield (
145-
f"Submission 'changelog' must be set to '{manifest.get('changelog')}' " # type: ignore[reportUnknownMemberType]
146-
f"in json file instead of {submission.get('changelog')}"
147-
)
148-
149-
150137
def checkUrlMatchesHomepage(manifest: AddonManifest, submission: JsonObjT) -> ValidationErrorGenerator:
151138
"""The submission homepage must match the *.nvda-addon manifest url field."""
152139
manifestUrl = manifest.get("url") # type: ignore[reportUnknownMemberType]
@@ -345,7 +332,6 @@ def validateSubmission(submissionFilePath: str, verFilename: str) -> ValidationE
345332
manifest = getAddonManifest(addonDestPath)
346333
yield from checkSummaryMatchesDisplayName(manifest, submissionData)
347334
yield from checkDescriptionMatches(manifest, submissionData)
348-
yield from checkChangelogMatches(manifest, submissionData)
349335
yield from checkUrlMatchesHomepage(manifest, submissionData)
350336
yield from checkAddonId(manifest, submissionFilePath, submissionData)
351337
yield from checkMinNVDAVersionMatches(manifest, submissionData)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ reportMissingTypeStubs = false
6767

6868
[tool.uv]
6969
default-groups = "all"
70+
python-preference = "only-system"
7071
environments = ["sys_platform == 'win32'"]
7172
required-version = ">=0.8"
7273

tests/testData/addons/fake/13.0.0.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
},
99
"displayName": "mock addon",
1010
"description": "The description for the addon",
11-
"changelog": "Changes for this add-on version",
1211
"homepage": "https://nvaccess.org",
1312
"publisher": "Name of addon author or organisation",
1413
"minNVDAVersion": {
@@ -24,7 +23,7 @@
2423
"channel": "stable",
2524
"URL": "https://github.com/nvaccess/dont/use/this/address/fake.nvda-addon",
2625
"sha256-comment": "SHA for the fake.nvda-addon file",
27-
"sha256": "50a8011a807665bcb8fdd177c276fef3b3f7f754796c5990ebe14e80c28b14ef",
26+
"sha256": "e27fa778cb99f83ececeb0bc089033929eab5a2fa475ce63e68f50b03b6ab585",
2827
"sourceURL": "https://github.com/nvaccess/dont/use/this/address",
2928
"license": "GPL v2",
3029
"licenseURL": "https://www.gnu.org/licenses/gpl-2.0.html",

tests/testData/fake.nvda-addon

-57 Bytes
Binary file not shown.

tests/testData/manifest.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name = fake
22
summary = "mock addon"
33
description = """The description for the addon"""
4-
changelog = """Changes for this add-on version"""
54
author = "Name of addon author or organisation"
65
url = https://nvaccess.org
76
version = 13.0

tests/test_createJson.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ def test_validVersion(self):
9999
sourceURL="https://example.com",
100100
license="GPL v2",
101101
homepage="https://example.com",
102-
changelog="""Changes for this add-on version""",
103102
licenseURL="https://www.gnu.org/licenses/gpl-2.0.html",
104103
submissionTime=createJson.getCurrentTime(),
105104
translations=[],

0 commit comments

Comments
 (0)