diff --git a/appveyor.yml b/appveyor.yml index ab587f59eaa..98e0d1a3f97 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ branches: - /release-.*/ environment: - PY_PYTHON: 3.8-32 + PY_PYTHON: 3.7-32 encFileKey: secure: ekOvuyywHuDdGZmRmoj+b3jfrq39A2xlx4RD5ZUGd/8= mozillaSymsAuthToken: diff --git a/miscDeps b/miscDeps index 91217045c4d..fc1e9c47dc7 160000 --- a/miscDeps +++ b/miscDeps @@ -1 +1 @@ -Subproject commit 91217045c4d3263c0ac9130e6f53e4852060f351 +Subproject commit fc1e9c47dc7f797fa0bca6cd91a32590fbf30edf diff --git a/readme.md b/readme.md index f2abd157982..d01d00f3584 100644 --- a/readme.md +++ b/readme.md @@ -55,7 +55,7 @@ The NVDA source depends on several other packages to run correctly. ### Installed Dependencies The following dependencies need to be installed on your system: -* [Python](https://www.python.org/), version 3.8, 32 bit +* [Python](https://www.python.org/), version 3.7, 32 bit * Use latest minor version if possible. * Microsoft Visual Studio 2019 Community, Version 16.3 or later: * Download from https://visualstudio.microsoft.com/vs/ diff --git a/sconstruct b/sconstruct index 0e02b1ef472..c5905140f0e 100755 --- a/sconstruct +++ b/sconstruct @@ -22,7 +22,7 @@ if nvdaVenv != virtualEnv: # Variables for storing required version of Python, and the version which is used to run this script. requiredPythonMajor ="3" -requiredPythonMinor = "8" +requiredPythonMinor = "7" requiredPythonArchitecture = "32bit" installedPythonMajor = str(sys.version_info.major) installedPythonMinor = str(sys.version_info.minor) diff --git a/source/addonHandler/__init__.py b/source/addonHandler/__init__.py index 5f505c01a81..6248a163ce3 100644 --- a/source/addonHandler/__init__.py +++ b/source/addonHandler/__init__.py @@ -1,6 +1,7 @@ # -*- coding: UTF-8 -*- +# addonHandler.py # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2012-2021 NV Access Limited, Rui Batista, Noelia Ruiz Martínez, +# Copyright (C) 2012-2019 Rui Batista, NV Access Limited, Noelia Ruiz Martínez, # Joseph Lee, Babbage B.V., Arnold Loubriat # This file is covered by the GNU General Public License. # See the file COPYING for more details. @@ -539,8 +540,8 @@ def initTranslation(): try: callerFrame = inspect.currentframe().f_back callerFrame.f_globals['_'] = translations.gettext - # Install pgettext function. - callerFrame.f_globals['pgettext'] = translations.pgettext + # Install our pgettext function. + callerFrame.f_globals['pgettext'] = languageHandler.makePgettext(translations) finally: del callerFrame # Avoid reference problems with frames (per python docs) diff --git a/source/languageHandler.py b/source/languageHandler.py index a3ea42a6f67..a32fdf73dc9 100644 --- a/source/languageHandler.py +++ b/source/languageHandler.py @@ -1,5 +1,6 @@ +# languageHandler.py # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2007-2021 NV Access Limited, Joseph Lee +# Copyright (C) 2007-2018 NV access Limited, Joseph Lee # This file is covered by the GNU General Public License. # See the file COPYING for more details. @@ -7,6 +8,7 @@ This module assists in NVDA going global through language services such as converting Windows locale ID's to friendly names and presenting available languages. """ +import builtins import os import sys import ctypes @@ -124,6 +126,28 @@ def getAvailableLanguages(presentational=False): ) return langs + +def makePgettext(translations): + """Obtaina pgettext function for use with a gettext translations instance. + pgettext is used to support message contexts, + but Python's gettext module doesn't support this, + so NVDA must provide its own implementation. + """ + if isinstance(translations, gettext.GNUTranslations): + def pgettext(context, message): + try: + # Look up the message with its context. + return translations._catalog[u"%s\x04%s" % (context, message)] + except KeyError: + return message + elif isinstance(translations, gettext.NullTranslations): + # A language with out a translation catalog, such as English. + def pgettext(context, message): + return message + else: + raise ValueError("%s is Not a GNUTranslations or NullTranslations object" % translations) + return pgettext + def getWindowsLanguage(): """ Fetches the locale name of the user's configured language in Windows. @@ -178,10 +202,10 @@ def setLanguage(lang: str) -> None: trans = gettext.translation("nvda", fallback=True) curLang = "en" - # #9207: Python 3.8 adds gettext.pgettext, so add it to the built-in namespace. - trans.install(names=["pgettext"]) + trans.install() setLocale(curLang) - + # Install our pgettext function. + builtins.pgettext = makePgettext(trans) def setLocale(localeName: str) -> None: ''' diff --git a/source/louisHelper.py b/source/louisHelper.py index 533086d19c6..7a3bdc72631 100644 --- a/source/louisHelper.py +++ b/source/louisHelper.py @@ -1,16 +1,12 @@ +# louisHelper.py # A part of NonVisual Desktop Access (NVDA) # This file is covered by the GNU General Public License. # See the file COPYING for more details. -# Copyright (C) 2018-2021 NV Access Limited, Babbage B.V., Joseph Lee +# Copyright (C) 2018 NV Access Limited, Babbage B.V. """Helper module to ease communication to and from liblouis.""" -# Python 3.8 changes the way DLL's are loaded due to security. -# Thus manually add NVDA executable path to DLL lookup path for loading liblouis.dll. -import os -import globalVars -with os.add_dll_directory(globalVars.appDir): - import louis +import louis from logHandler import log import config diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index a4e3e078997..7317f40c020 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -46,7 +46,6 @@ What's New in NVDA == Changes for Developers == - Note: this is a Add-on API compatibility breaking release. Add-ons will need to be re-tested and have their manifest updated. -- NVDA now requires Python 3.8. (#12075) - NVDA's build system now fetches all Python dependencies with pip and stores them in a Python virtual environment. This is all done transparently. - To build NVDA, SCons should continue to be used in the usual way. E.g. executing scons.bat in the root of the repository. Running ``py -m SCons`` is no longer supported, and ``scons.py`` has also been removed. - To run NVDA from source, rather than executing ``source/nvda.pyw`` directly, the developer should now use ``runnvda.bat`` in the root of the repository. If you do try to execute ``source/nvda.pyw``, a message box will alert you this is no longer supported. diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 39bf105e16c..66035a196e0 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -67,8 +67,8 @@ For details regarding exceptions, access the license document from the NVDA menu + System Requirements +[SystemRequirements] - Operating Systems: all 32-bit and 64-bit editions of Windows 7, Windows 8, Windows 8.1, Windows 10, and all Server Operating Systems starting from Windows Server 2008 R2. - - For Windows 7 and Windows Server 2008 R2 NVDA requires Service Pack 1 and the [KB3063858 https://support.microsoft.com/en-us/kb/3063858] update. - Both of these should be installed if all available updates are applied. + - For Windows 7, NVDA requires Service Pack 1 or higher. + - For Windows Server 2008 R2, NVDA requires Service Pack 1 or higher. - at least 150 MB of storage space. - diff --git a/venvUtils/ensureAndActivate.bat b/venvUtils/ensureAndActivate.bat index b39d1f947ff..7d6526a8dd5 100644 --- a/venvUtils/ensureAndActivate.bat +++ b/venvUtils/ensureAndActivate.bat @@ -4,7 +4,7 @@ rem and then activates it. rem This is an internal script and should not be used directly. rem Ensure the environment is created and up to date -py -3.8-32 "%~dp0\ensureVenv.py" +py -3.7-32 "%~dp0\ensureVenv.py" if ERRORLEVEL 1 goto :EOF rem Set the necessary environment variables to have Python use this virtual environment. diff --git a/venvUtils/ensureVenv.py b/venvUtils/ensureVenv.py index 3256fdfba4d..bf11e404cc4 100644 --- a/venvUtils/ensureVenv.py +++ b/venvUtils/ensureVenv.py @@ -134,4 +134,15 @@ def ensureVenvAndRequirements(): "Please deactivate the current Python virtual environment and try again." ) sys.exit(1) + if ( + sys.version_info.minor == 7 + and sys.version_info.micro == 6 + ): + # #10696: Building with Python 3.7.6 fails. Inform user and exit. + Py376FailMsg = ( + "Error: Building with Python 3.7.6 is not possible.\n" + "Please use a more recent version of Python 3." + ) + print(Py376FailMsg) + sys.exit(1) ensureVenvAndRequirements()