Repository navigation
Py3.8: Transparently use a Python virtual environment under the hood #12075
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
Changes from 37 commits
adf131a
5e87120
c8fc42b
9c9d1e1
3878133
90a7183
cd4a3cf
9503492
fd890d3
4a852d9
5795e76
6d58baa
3025d74
8074fa1
c22b7b3
0179e48
f70b0e8
cbd21be
6f427af
e59018e
daf53a1
ef52123
e7a54fd
713397c
c60975e
da159ae
2a9df26
459e3a3
12ae5a8
ada0b85
73c8490
19120dd
e924a87
1b827b6
1039dc5
8a13814
91193e2
f47db8e
8375c3e
2f01c39
f1eb3e9
89922ec
b834a4e
2039871
e2e23ed
34e7107
711eb37
ed432bf
b0cb717
7eb2584
ee498f3
7b125c6
b59263d
e820763
d8a89c0
d5e480c
e0f9c6b
c6c13e0
dd70ba8
95339d6
9ab0f6d
e008f1d
110edc1
778e512
06411a0
9b1c16a
cc7d219
0b78587
0dbdaed
49ea5ae
7a6fc4d
cca866a
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 |
|---|---|---|
|
|
@@ -42,3 +42,4 @@ tests/unit/nvda.ini | |
| source/locale/*/cldr.dic | ||
| .vscode | ||
| .vs | ||
| .venv | ||
This file was deleted.
This file was deleted.
This file was deleted.
| + − | python/brlapi-0.8.dll | |
| + − | python/brlapi.cp37-win32.pyd | |
| + − | python/brlapi.cp38-win32.pyd | |
| + − | python/libgcc_s_dw2-1.dll |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| from include.scons.SCons.Util import CLVar | ||
|
|
||
| Import([ | ||
| 'thirdPartyEnv', | ||
| 'sourceDir', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # NVDA's build system is SCons | ||
| SCons==4.1.0.post1 | ||
|
|
||
| # NVDA's runtime dependencies | ||
|
michaelDCurran marked this conversation as resolved.
Resolved
|
||
| comtypes==1.1.7 | ||
| pyserial==3.5 | ||
| wxPython==4.1.1 | ||
|
feerrenrut marked this conversation as resolved.
Resolved
michaelDCurran marked this conversation as resolved.
Resolved
|
||
|
|
||
| #NVDA_DMP requires diff-match-patch | ||
| diff_match_patch_python==1.0.2 | ||
|
|
||
| # Packaging NVDA | ||
| py2exe==0.10.1.0 | ||
|
|
||
| # For building developer documentation | ||
| sphinx==3.4.1 | ||
| sphinx_rtd_theme | ||
|
|
||
| # Requirements for automated linting | ||
| flake8 ~= 3.7.7 | ||
| flake8-tabs == 2.1.0 | ||
|
|
||
| # Requirements for unit tests | ||
| nose==1.3.7 | ||
|
|
||
| # Requirements for system tests | ||
| robotframework==3.2.2 | ||
| robotremoteserver==1.1 | ||
| robotframework-screencaplibrary==1.5.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| @echo off | ||
| call "%~dp0\venvUtils\venvCmd.bat" py "%~dp0\tests\lint\genDiff.py" %1 "%~dp0\_lint.diff" | ||
| if ERRORLEVEL 1 exit /b %ERRORLEVEL% | ||
| type "%~dp0\_lint.diff" | call "%~dp0\venvUtils\venvCmd.bat" py -Xutf8 -m flake8 --diff --tee --config="%~dp0\tests\lint\flake8.ini" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @echo off | ||
| call "%~dp0\venvUtils\venvCmd.bat" py "%~dp0\source\nvda.pyw" %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @echo off | ||
| call "%~dp0\venvUtils\venvCmd.bat" start pyw "%~dp0\source\nvda.pyw" %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| @echo off | ||
| call "%~dp0\venvUtils\venvCmd.bat" py -m robot --argumentfile "%~dp0\tests\system\robotArgs.robot" %* "%~dp0\tests\system\robot" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @echo off | ||
| call "%~dp0\venvUtils\venvCmd.bat" py -m unittest discover tests.unit -t . %* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,3 @@ | ||
| @echo off | ||
| rem We need this script because .py probably isn't in pathext. | ||
| rem We can't just call python -c because it may not be in the path. | ||
| rem Instead, find the python launcher (installed by python 3) | ||
| where py 1>nul 2>&1 | ||
| if "%ERRORLEVEL%" == "0" ( | ||
| rem Python launcher is present in the PATH | ||
| rem Call python 3.7 for 32 bits | ||
| py -3.7-32 "%~dp0\scons.py" %* | ||
| ) else ( | ||
| rem Python registers itself with the .py extension, so call scons.py. | ||
| "%~dp0\scons.py" %* | ||
| ) | ||
| rem Executes SScons within the NVDA build system's Python virtual environment. | ||
| "%~dp0\venvUtils\venvCmd.bat" py -m SCons %* | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a new line to the end of this file. |
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,19 @@ import sys | |
| import os | ||
| import platform | ||
|
|
||
| # Ensure we are inside the NVDA build system's Python virtual environment. | ||
| nvdaVenv = os.getenv("NVDA_VENV") | ||
| virtualEnv = os.getenv("VIRTUAL_ENV") | ||
| if not nvdaVenv or nvdaVenv != virtualEnv: | ||
| print( | ||
| "Error: SCons cannot detect the NVDA build system Python virtual environment.\n" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Double space after 'detect' |
||
| "SCons must be executed using scons.bat in the root of this repository." | ||
| ) | ||
| sys.exit(1) | ||
|
|
||
| # Variables for storing required version of Python, and the version which is used to run this script. | ||
| requiredPythonMajor ="3" | ||
| requiredPythonMinor = "7" | ||
| requiredPythonMinor = "8" | ||
| requiredPythonArchitecture = "32bit" | ||
| installedPythonMajor = str(sys.version_info.major) | ||
| installedPythonMinor = str(sys.version_info.minor) | ||
|
|
@@ -34,10 +44,6 @@ if ( | |
| requiredPythonArchitecture | ||
| ) | ||
| ) | ||
| if sys.version_info.micro == 6: | ||
| # #10696: Building with Python 3.7.6 fails. Innform user and exit. | ||
| Py376FailMsg = "Building with Python 3.7.6 is not possible.\nPlease use more recent version of Python 3." | ||
| raise RuntimeError(Py376FailMsg) | ||
| sourceEnvPath = os.path.abspath(os.path.join(Dir('.').srcnode().path, "source")) | ||
| sys.path.append(sourceEnvPath) | ||
| import sourceEnv | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -560,6 +560,11 @@ def run(self): | |
| else: | ||
| log.debug("initializing updateCheck") | ||
| updateCheck.initialize() | ||
| # If running from source, try to disconnect from the console we may have been executed in. | ||
| # NVDA may reconnect to read it later, | ||
| # but it is better to assume we are not connected to anything at the start. | ||
| if ctypes.windll.kernel32.FreeConsole() != 0: | ||
| log.debug("Freed from parent console process.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this change necessary or related to the rest of the PR?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If running NvDA from source in a console with runnvda.bat (in other words python) (not runnvdaw.bat or pythonw) NVDA is associated with the controle, and standard out / standard error are printed there. However, as a screen reader, NVDA itself connects to the console with focus in order to access its contents (at least the older implementation that doesn't use UIA). However, as NVDA is already connected to the console when it starts, then the winConsoleHandler code fails to connect again and or manage connecting / disconnecting from the console with focus. Thus, once NVDA is fully started up, and any critical errors would have been written to the console, as a screen reader, it is better to forcefully disconnect, and it may or may not reconnect later in order to read its content. However, I would be happy to remove this commit and address it in a future pr as it is not specifically to do with Python 3.8. However developers will still hit this if executing runnvda.bat. |
||
| log.info("NVDA initialized") | ||
| postNvdaStartup.notify() | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.