Skip to content

Commit 01f3e1e

Browse files
authored
Update to Python 3.11 (#15544)
Closes #12064 Closes #12551 Closes #15577 Closes #15167 Summary of the issue: Python needs to be updated to 3.11, as Python 3.7 is EOL. Python pip dependencies need to be updated to match the python upgrade. typing_extensions is no longer needed. Description of user facing changes Performance and security enhancements from dependency upgrades. Description of development approach Updates python in build scripts Updates pip dependencies Set Windows 8.1 (Blue) as minimum windows version Update references to python and windows version in docs nose is replaced by the unittest module with xmlrunner to generate XML test output drop python optimization to level 0 from level 1. level 1 removes asserts.
1 parent 041477f commit 01f3e1e

30 files changed

+222
-320
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ init:
2020
"INIT, $(Get-Date -Format 'o')"| Out-File ../timing.csv -Append
2121
2222
environment:
23-
PY_PYTHON: 3.7-32
23+
PY_PYTHON: 3.11-32
2424
secure_authenticode_pass:
2525
secure: Way+hJyhbiLG/cmCo4+dHHzS5DiSvk/45o6frnIQ27GBX6nVDsh7jwQ7fSnqxBRP
2626
secure_ssh_pass:

appveyor/scripts/tests/unitTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
$outDir = (Resolve-Path .\testOutput\unit\)
22
$unitTestsXml = "$outDir\unitTests.xml"
3-
.\rununittests.bat --with-xunit --xunit-file="$unitTestsXml"
3+
.\rununittests.bat --output-file "$unitTestsXml"
44
if($LastExitCode -ne 0) {
55
Set-AppveyorBuildVariable "testFailExitCode" $LastExitCode
66
Add-AppveyorMessage "FAIL: Unit tests. See test results for more information."

appx/sconscript

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ else: # not for submission, just side-loadable
6161
signExec=env['signExec'] if env['certFile'] else None
6262

6363
# Files from NVDA's distribution that cannot be included in the appx due to policy or security restrictions
64-
excludedDistFiles=[
65-
'nvda_eoaProxy.exe',
64+
excludedDistFiles = [
6665
'nvda_service.exe',
6766
'nvda_slave.exe',
6867
'nvda_noUIAccess.exe',
@@ -107,4 +106,3 @@ if signExec and not isStoreSubmission:
107106
env.AddPostAction(appx,signExec)
108107

109108
Return(['appx'])
110-

nvdaHelper/archBuild_sconscript

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
###
2-
#This file is a part of the NVDA project.
3-
#URL: http://www.nvda-project.org/
4-
#Copyright 2006-2010 NVDA contributers.
5-
#This program is free software: you can redistribute it and/or modify
6-
#it under the terms of the GNU General Public License version 2.0, as published by
7-
#the Free Software Foundation.
8-
#This program is distributed in the hope that it will be useful,
9-
#but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11-
#This license can be found at:
12-
#http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
13-
###
1+
# A part of NonVisual Desktop Access (NVDA)
2+
# Copyright (C) 2006-2023 NV Access Limited
3+
# This file may be used under the terms of the GNU General Public License, version 2 or later.
4+
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
145

156
import os
167
import shutil
@@ -87,7 +78,7 @@ env.Append(
8778
'UNICODE',
8879
'_CRT_SECURE_NO_DEPRECATE',
8980
('LOGLEVEL', '${nvdaHelperLogLevel}'),
90-
('_WIN32_WINNT', '_WIN32_WINNT_WIN7'),
81+
('_WIN32_WINNT', '_WIN32_WINNT_WINBLUE'),
9182
# NOMINMAX: prevent minwindef.h min/max macro definition, which unexpectedly override developer
9283
# expectations
9384
'NOMINMAX',
@@ -102,10 +93,10 @@ env.Append(CPPPATH=[
10293
'#/miscDeps/include',
10394
Dir('.').abspath
10495
])
105-
if TARGET_ARCH == "arm64":
106-
subsystem = "/subsystem:windows,6.02"
107-
else:
108-
subsystem = "/subsystem:windows,6.01"
96+
97+
# Windows 8.1 (blue)
98+
subsystem = "/subsystem:windows,6.03"
99+
109100
env.Append(
110101
LINKFLAGS=[
111102
'/incremental:no',

nvdaHelper/local/nvdaHelperLocal.cpp

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
/*
2-
This file is a part of the NVDA project.
3-
URL: http://www.nvda-project.org/
4-
Copyright 2008-2014 NV Access Limited.
5-
This program is free software: you can redistribute it and/or modify
6-
it under the terms of the GNU General Public License version 2.0, as published by
7-
the Free Software Foundation.
8-
This program is distributed in the hope that it will be useful,
9-
but WITHOUT ANY WARRANTY; without even the implied warranty of
10-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11-
This license can be found at:
12-
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2+
A part of NonVisual Desktop Access (NVDA)
3+
Copyright (C) 2008-2023 NV Access Limited
4+
This file may be used under the terms of the GNU General Public License, version 2 or later.
5+
For more details see: https://www.gnu.org/licenses/gpl-2.0.html
136
*/
147

158
#include <cstdio>
@@ -28,20 +21,6 @@ decltype(&SendMessageW) real_SendMessageW = nullptr;
2821
decltype(&SendMessageTimeoutW) real_SendMessageTimeoutW = nullptr;
2922
decltype(&OpenClipboard) real_OpenClipboard = nullptr;
3023

31-
typedef struct _RPC_SECURITY_QOS_V5_W {
32-
unsigned long Version;
33-
unsigned long Capabilities;
34-
unsigned long IdentityTracking;
35-
unsigned long ImpersonationType;
36-
unsigned long AdditionalSecurityInfoType;
37-
union
38-
{
39-
RPC_HTTP_TRANSPORT_CREDENTIALS_W *HttpCredentials;
40-
} u;
41-
void *Sid;
42-
unsigned int EffectiveOnly;
43-
void *ServerSecurityDescriptor;
44-
} RPC_SECURITY_QOS_V5_W, *PRPC_SECURITY_QOS_V5_W;
4524

4625
handle_t createRemoteBindingHandle(wchar_t* uuidString) {
4726
RPC_STATUS rpcStatus;

nvdaHelper/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ You should still build on the command line to verify errors.
7070
- Press next
7171
- Specify Debug Configuration Settings
7272
- Build command line: `scons source`
73-
- Preprocessor definitions (/D): `WIN32;_WINDOWS;_USRDLL;NVDAHELPER_EXPORTS;UNICODE;_CRT_SECURE_NO_DEPRECATE;LOGLEVEL=15;_WIN32_WINNT=_WIN32_WINNT_WIN7;NOMINMAX`
73+
- Preprocessor definitions (/D): `WIN32;_WINDOWS;_USRDLL;NVDAHELPER_EXPORTS;UNICODE;_CRT_SECURE_NO_DEPRECATE;LOGLEVEL=15;_WIN32_WINNT=_WIN32_WINNT_WINBLUE;NOMINMAX`
7474
- Include search paths (/I): `../include;../miscDeps/include;./;../build\x86_64;../include/minhook/include`
7575
- Forced Included files (/FI): `winuser.h`
7676
- Press next
@@ -90,7 +90,7 @@ You should still build on the command line to verify errors.
9090
```
9191
cl /Fobuild\x86\vbufBackends\gecko_ia2\gecko_ia2.obj /c build\x86\vbufBackends\gecko_ia2\gecko_ia2.cpp
9292
/TP /EHsc /nologo /std:c++20 /permissive- /Od /MT /W3 /WX
93-
/DUNICODE /D_CRT_SECURE_NO_DEPRECATE /DLOGLEVEL=15 /D_WIN32_WINNT=_WIN32_WINNT_WIN7 /DNOMINMAX /DNDEBUG
93+
/DUNICODE /D_CRT_SECURE_NO_DEPRECATE /DLOGLEVEL=15 /D_WIN32_WINNT=_WIN32_WINNT_WINBLUE /DNOMINMAX /DNDEBUG
9494
/Iinclude /Imiscdeps\include /Ibuild\x86
9595
/Z7
9696
```

projectDocs/dev/createDevEnvironment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The NVDA source depends on several other packages to run correctly.
3434
### Installed Dependencies
3535
The following dependencies need to be installed on your system:
3636

37-
* [Python](https://www.python.org/), version 3.7, 32 bit
37+
* [Python](https://www.python.org/), version 3.11, 32 bit
3838
* Use latest minor version if possible.
3939
* Microsoft Visual Studio 2019 or 2022:
4040
* To replicate the production build environment, use the [version of Visual Studio 2019 that AppVeyor is using](https://www.appveyor.com/docs/windows-images-software/#visual-studio-2019).

requirements.txt

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,30 @@ SCons==4.5.2
44
# NVDA's runtime dependencies
55
comtypes==1.2.0
66
pyserial==3.5
7-
wxPython==4.1.1
8-
git+https://github.com/DiffSK/configobj@3e2f4cc#egg=configobj
7+
wxPython==4.2.1
8+
git+https://github.com/DiffSK/configobj@e2ba4457c4651fa54f8d59d8dcdd3da950e956b8#egg=configobj
99
requests==2.31.0
10-
# Required to use a pinned old version for requests.
11-
# py2exe fails to compile properly without this.
12-
# This can be removed when upgrading py2exe to 0.13+ and python to 3.8+.
13-
# https://github.com/Ousret/charset_normalizer/issues/253
14-
charset-normalizer==2.1.1
10+
# Pillow is an implicit dependency and requires zlib and jpeg by default, but we don't need it
11+
Pillow==10.0.1 -C "zlib=disable" -C "jpeg=disable"
1512

1613
#NVDA_DMP requires diff-match-patch
1714
fast_diff_match_patch==2.0.1
1815

1916
# Packaging NVDA
20-
py2exe==0.11.1.0
17+
git+https://github.com/py2exe/py2exe@4e7b2b2c60face592e67cb1bc935172a20fa371d#egg=py2exe
2118

22-
# For building developer documentation
23-
sphinx==5.1.1
24-
sphinx_rtd_theme==1.0.0
19+
# Creating XML unit test reports
20+
unittest-xml-reporting==3.2.0
2521

26-
# Requirements for type checking.
27-
# typing_extensions is incorporated in py3.8+, also available via mypy
28-
typing_extensions==4.3.0
22+
# For building developer documentation
23+
sphinx==7.2.6
24+
sphinx_rtd_theme==1.3.0
2925

3026
# Requirements for automated linting
3127
flake8 ~= 3.7.7
3228
flake8-tabs == 2.1.0
3329

34-
# Requirements for unit tests
35-
nose==1.3.7
36-
3730
# Requirements for system tests
38-
robotframework==3.2.2
39-
robotremoteserver==1.1
40-
robotframework-screencaplibrary==1.5.0
31+
robotframework==6.1.1
32+
robotremoteserver==1.1.1
33+
robotframework-screencaplibrary==1.6.0

rununittests.bat

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ set here=%hereOrig%
44
if #%hereOrig:~-1%# == #\# set here=%hereOrig:~0,-1%
55
set scriptsDir=%here%\venvUtils
66
set unitTestsPath=%here%\tests\unit
7+
set testOutput=%here%\testOutput\unit
8+
md %testOutput%
79

8-
call "%scriptsDir%\venvCmd.bat" py -m nose -sv --traverse-namespace -w "%unitTestsPath%" %*
10+
call "%scriptsDir%\venvCmd.bat" py -m xmlrunner discover -v -s "%unitTestsPath%" -t "%here%" --output-file "%testOutput%\unitTests.xml" %*

sconstruct

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ if nvdaVenv != virtualEnv:
2323
print("Warning: SCons launched within a custom Python virtual environment.")
2424

2525
# Variables for storing required version of Python, and the version which is used to run this script.
26-
requiredPythonMajor ="3"
27-
requiredPythonMinor = "7"
26+
requiredPythonMajor = "3"
27+
requiredPythonMinor = "11"
2828
requiredPythonArchitecture = "32bit"
2929
installedPythonMajor = str(sys.version_info.major)
3030
installedPythonMinor = str(sys.version_info.minor)
@@ -308,16 +308,12 @@ def NVDADistGenerator(target, source, env, for_signature):
308308
# which scons treats as an error code.
309309
and None]
310310

311-
buildCmd = ["cd", source[0].path, "&&",
312-
sys.executable]
311+
buildCmd = ["cd", source[0].path, "&&", sys.executable]
313312
if release:
314313
buildCmd.append("-O")
315314
# Issue errors about str(bytes_instance), str(bytearray_instance)
316315
buildCmd.append("-bb")
317-
buildCmd.extend(("setup.py", "-vv", "build", "--build-base", buildDir.abspath,
318-
"py2exe", "--dist-dir", target[0].abspath))
319-
if release:
320-
buildCmd.append("-O1")
316+
buildCmd.append("setup.py")
321317
if env.get("uiAccess"):
322318
buildCmd.append("--enable-uiAccess")
323319

@@ -346,7 +342,7 @@ def NVDADistGenerator(target, source, env, for_signature):
346342
action.append(Copy(target[0], file.path))
347343

348344
if certFile:
349-
for prog in "nvda_noUIAccess.exe", "nvda_uiAccess.exe", "nvda_slave.exe", "nvda_eoaProxy.exe":
345+
for prog in "nvda_noUIAccess.exe", "nvda_uiAccess.exe", "nvda_slave.exe":
350346
action.append(lambda target,source,env, progByVal=prog: signExec([target[0].File(progByVal)],source,env))
351347

352348
action.extend((

0 commit comments

Comments
 (0)