Skip to content
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

Allow add-on API version strings to exclude Minor, defaulting to 0. #9331

Merged
merged 5 commits into from Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions developerGuide.t2t
Expand Up @@ -669,13 +669,13 @@ Otherwise, the add-on will not install.
- url: A URL where this add-on, further info and upgrades can be found.
- docFileName: The name of the main documentation file for this add-on; e.g. readme.html. See the [Add-on Documentation #AddonDoc] section for more details.
- minimumNVDAVersion: The minimum required version of NVDA for this add-on to be installed or enabled.
- e.g "2019.1.0"
- Must be a three part version string I.E. Year.Minor.Minor. Two part version strings ("2019.1") will not pass validation.
- e.g "2019.1.1"
- Must be a three part version string I.E. Year.Major.Minor, or a two part version string of Year.Major. In the second case, Minor defaults to 0.
- Defaults to "0.0.0"
- Must be less than or equal to `lastTestedNVDAVersion`
- lastTestedNVDAVersion: The last version of NVDA this add-on has been tested with.
- e.g "2019.1.0"
- Must be a three part version string I.E. Year.Minor.Minor. Two part version strings ("2019.1") will not pass validation.
- Must be a three part version string I.E. Year.Major.Minor, or a two part version string of Year.Major. In the second case, Minor defaults to 0.
- Defaults to "0.0.0"
- Must be greater than or equal to `minimumNVDAVersion`
-
Expand Down
5 changes: 3 additions & 2 deletions source/addonAPIVersion.py
Expand Up @@ -23,11 +23,12 @@

#: Compiled regular expression to match an addon API version string.
#: Supports year.major.minor versions (e.g. 2018.1.1).
# Although year and major are manditory, minor is optional.
michaelDCurran marked this conversation as resolved.
Show resolved Hide resolved
#: Resulting match objects expose three groups reflecting release year, release major, and release minor version,
# respectively.
# As minor is optional, the final group in the resulting match object may be None if minor is not provided in the original string. In this case it should be treated as being 0.
#: @type: RegexObject
ADDON_API_VERSION_REGEX = re.compile(r"^(0|\d{4})\.(\d)\.(\d)$")

ADDON_API_VERSION_REGEX = re.compile(r"^(0|\d{4})\.(\d)(?:\.(\d))?$")

def getAPIVersionTupleFromString(version):
"""Converts a string containing an NVDA version to a tuple of the form (versionYear, versionMajor, versionMinor)"""
Expand Down
3 changes: 2 additions & 1 deletion source/addonHandler/__init__.py
Expand Up @@ -657,7 +657,8 @@ class AddonManifest(ConfigObj):
# Eg: 2019.1.0 or 0.0.0
# Must have 3 integers separated by dots.
# The first integer must be a Year (4 characters)
# "0.0.0" is also valid
# "0.0.0" is also valid.
# The final integer can be left out, and in that case will default to 0. E.g. 2019.1

"""))

Expand Down
14 changes: 7 additions & 7 deletions tests/unit/test_addonVersionCheck.py
Expand Up @@ -88,12 +88,18 @@ def test_addonCompat_attemptingToUseAddonRequiringNewAPIFeaturesWithOldNVDA(self

class TestGetAPIVersionTupleFromString(unittest.TestCase):

def test_getAPIVersionTupleFromString_succeeds(self):
def test_getAPIVersionTupleFromString_3_succeeds(self):
"""Tests trying to get the API version tuple from an API version string with a standard version
layout will succeed.
"""
self.assertEqual((2019, 1, 0), addonAPIVersion.getAPIVersionTupleFromString("2019.1.0"))

def test_getAPIVersionTupleFromString_2_succeeds(self):
"""Tests trying to get the API version tuple from an API version where the Minor part is omitted and therefore defaults to 0.
This will succeed.
"""
self.assertEqual((2019, 1, 0), addonAPIVersion.getAPIVersionTupleFromString("2019.1"))

def test_getAPIVersionTupleFromString_allZeros_succeeds(self):
"""Tests trying to get the API version tuple from an API version string that is all zeros.
This is used as the FIRST api version.
Expand Down Expand Up @@ -124,12 +130,6 @@ def test_getAPIVersionTupleFromString_oneMatch_raises(self):
"""
self.assertRaises(ValueError, addonAPIVersion.getAPIVersionTupleFromString, "2019.")

def test_getAPIVersionTupleFromString_twoMatch_raises(self):
"""Tests trying to get the API version tuple from an API version string with two matching groups
results in an error being raised
"""
self.assertRaises(ValueError, addonAPIVersion.getAPIVersionTupleFromString, "2019.1")

def test_getAPIVersionTupleFromString_devAppended_raises(self):
"""Tests trying to get the API version tuple from an API version string with three matching groups
and some extra appended results in an error being raised
Expand Down
5 changes: 3 additions & 2 deletions user_docs/en/changes.t2t
Expand Up @@ -23,8 +23,9 @@ What's New in NVDA

== Changes ==
- Updated liblouis braille translator to version 3.8.0. (#9013)
- Add-on authors now can enforce a minimum required NVDA version for their add-ons. Unsupported add-ons will not load or install. (#6275)
- Add-on authors must now specify the last version of NVDA the add-on has been tested against. Users will be warned against installing or enabling untested add-ons. (#6275)
- Add-on authors now can enforce a minimum required NVDA version for their add-ons. NVDA will refuse to install or load an add-on whos minimum required NVDA version is higher than the current NVDA version. (#6275)
michaelDCurran marked this conversation as resolved.
Show resolved Hide resolved
- Add-on authors can now specify the last version of NVDA the add-on has been tested against. If an add-on has been only tested against a version of NVDA lower than the current version, then NVDA will refuse to install or load the add-on. (#6275)
- This version of NVDA will allow installing and loading of add-ons that do not yet contain Minimum and Last Tested NVDA version information, but upgrading to future versions of NvDA (E.g. 2019.2) will automatically cause these older add-ons to be disabled.
michaelDCurran marked this conversation as resolved.
Show resolved Hide resolved
- The move mouse to navigator object command is now available in Microsoft Word as well as for UIA controls, particularly Microsoft Edge. (#7916, #8371)
- Reporting of text under the mouse has been improved within Microsoft Edge and other UIA applications. (#8370)
- When NVDA is started with the `--portable-path` command line parameter, the provided path is automatically filled in when trying to create a portable copy of NVDA using the NVDA menu. (#8623)
Expand Down