-
Notifications
You must be signed in to change notification settings - Fork 3
Add ability to provide changelog for add-ons #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9d95d97
4a7f9b4
5427327
23e4bb4
3ece59f
1f5dc75
d9f3f49
f2efd30
b0754e6
9835dd8
07d493f
4dcd7df
b921d6f
ff43517
aaf2b85
8b1ed2a
38da96d
ecb8957
098a480
cbe5d18
c93e4a5
a0b53f8
a35e5db
3529858
c816603
288ea2f
40274dd
f776545
ebe905a
75d6e0d
bb03c83
9a044f7
cd3e0a4
0064120
d0af4bd
438f427
ffbfe0a
7fd4b0c
3385e8f
98f2703
92b193f
2d838ae
c000bff
89e3ba7
0003084
9e24496
0fbfa69
815226c
e915411
879e61b
efc4fc2
ba1ea07
bc652ab
9318884
6b7789c
f8fe187
18cc72c
caf598d
58a6fc4
9566693
e7f9414
ed2f0ed
8cc1dcd
639d095
58a88be
75eb537
b1d3fe0
d65f79f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,7 @@ class AddonData: | |
| sourceURL: str | ||
| license: str | ||
| homepage: str | None | ||
| changelog: str | None | ||
| licenseURL: str | None | ||
| submissionTime: int | ||
| translations: list[dict[str, str]] | ||
|
|
@@ -120,18 +121,32 @@ def _createDataclassMatchingJsonSchema( | |
| # Add optional fields | ||
| homepage: str | None = manifest.get("url") # type: ignore[reportUnknownMemberType] | ||
| if not homepage or homepage == "None": | ||
| # The config default is None | ||
| # which is parsed by configobj as a string not a NoneType | ||
|
Comment on lines
+124
to
+125
|
||
| homepage = None | ||
|
|
||
| changelog: str | None = manifest.get("changelog") # type: ignore[reportUnknownMemberType] | ||
| if changelog == "None": | ||
| # The config default is None | ||
| # which is parsed by configobj as a string not a NoneType | ||
| changelog = None | ||
| translations: list[dict[str, str]] = [] | ||
| for langCode, translatedManifest in getAddonManifestLocalizations(manifest): | ||
| # Add optional translated changelog. | ||
| translatedChangelog: str | None = translatedManifest.get("changelog") # type: ignore[reportUnknownMemberType] | ||
| if translatedChangelog == "None": | ||
| # The config default is None | ||
| # which is parsed by configobj as a string not a NoneType | ||
| translatedChangelog = None | ||
|
|
||
| try: | ||
| translations.append( | ||
| { | ||
| "language": langCode, | ||
| "displayName": cast(str, translatedManifest["summary"]), | ||
| "description": cast(str, translatedManifest["description"]), | ||
| }, | ||
| ) | ||
| translation: dict[str, str] = { | ||
| "language": langCode, | ||
| "displayName": cast(str, translatedManifest["summary"]), | ||
| "description": cast(str, translatedManifest["description"]), | ||
| } | ||
| if translatedChangelog is not None: | ||
| translation["changelog"] = translatedChangelog | ||
| translations.append(translation) | ||
| except KeyError as e: | ||
| raise KeyError(f"Translation for {langCode} missing required key '{e.args[0]}'.") from e | ||
|
|
||
|
|
@@ -152,6 +167,7 @@ def _createDataclassMatchingJsonSchema( | |
| sourceURL=sourceUrl, | ||
| license=licenseName, | ||
| homepage=homepage, | ||
| changelog=changelog, | ||
| licenseURL=licenseUrl, | ||
| submissionTime=getCurrentTime(), | ||
| translations=translations, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||||||||||||||||||||||||||||||
| import glob | ||||||||||||||||||||||||||||||||||
| import json | ||||||||||||||||||||||||||||||||||
| from urllib.request import urlretrieve | ||||||||||||||||||||||||||||||||||
| from typing import cast | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| from .manifestLoader import getAddonManifest, getAddonManifestLocalizations | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -23,15 +24,25 @@ def regenerateJsonFile(filePath: str, errorFilePath: str | None) -> None: | |||||||||||||||||||||||||||||||||
| with open(errorFilePath, "w") as errorFile: | ||||||||||||||||||||||||||||||||||
| errorFile.write(f"Validation Errors:\n{manifest.errors}") | ||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| changelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType] | ||||||||||||||||||||||||||||||||||
| if changelog == "None": | ||||||||||||||||||||||||||||||||||
| # The config default is None | ||||||||||||||||||||||||||||||||||
| # which is parsed by configobj as a string not a NoneType | ||||||||||||||||||||||||||||||||||
| changelog = None | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| changelog = None | |
| changelog = None | |
| # Add the main manifest's translation (default language) to translations | |
| addonData["translations"].append( | |
| { | |
| "language": manifest.get("language", "default"), | |
| "displayName": manifest["summary"], | |
| "description": manifest["description"], | |
| "changelog": changelog, | |
| }, | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, this should just be removed. It's not useful/needed to add this when regenerating files.
Only translations need to be regenerated
https://github.com/nvaccess/addon-datastore-validation/pull/52/files#r2512898348
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this code can be removed as per https://github.com/nvaccess/addon-datastore-validation/pull/52/files#r2512900158
| changelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType] | |
| if changelog == "None": | |
| # The config default is None | |
| # which is parsed by configobj as a string not a NoneType | |
| changelog = None |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -134,6 +134,19 @@ def checkDescriptionMatches(manifest: AddonManifest, submission: JsonObjT) -> Va | |||||||||
| ) | ||||||||||
|
|
||||||||||
|
|
||||||||||
| def checkChangelogMatches(manifest: AddonManifest, submission: JsonObjT) -> ValidationErrorGenerator: | ||||||||||
| """The submission changelog must match the *.nvda-addon manifest changelog field.""" | ||||||||||
| changelog = manifest.get("changelog") # type: ignore[reportUnknownMemberType] | ||||||||||
| if changelog == "None": | ||||||||||
| # The config default is None which is parsed by configobj as a string not a NoneType | ||||||||||
| changelog = None | ||||||||||
| if changelog != submission.get("changelog"): | ||||||||||
| yield ( | ||||||||||
| f"Submission 'changelog' must be set to '{changelog}' " | ||||||||||
| f"in json file instead of {submission.get('changelog')}" | ||||||||||
|
Comment on lines
+145
to
+146
|
||||||||||
| f"Submission 'changelog' must be set to '{changelog}' " | |
| f"in json file instead of {submission.get('changelog')}" | |
| f"Submission 'changelog' must be set to '{changelog}' in json file." | |
| f" Instead got: '{submission.get('changelog')}'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you change this too?
Uh oh!
There was an error while loading. Please reload this page.