Conversation
Latest version of Py2exe no longer invalidates signature of Python's dll so this workaround is no longer needed
… pip igf not installed
|
Hi, note that Py2Exe may insist on installing Numpy, so be careful with this approach. Thanks.
From: Łukasz Golonka <notifications@github.com>
Sent: Wednesday, December 23, 2020 10:14 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [nvaccess/nvda] Update to py2exe 0.10.1.0 (#11967)
Link to issue number:
Closes #11794 <#11794>
Summary of the issue:
We are currently using development build of py2exe. Since the current version of py2exe is now on pypi and supports Python 3.8 it is beneficial for us to upgrade.
Description of how this pull request fixes the issue:
* I've added a new function requestPackage which checks if the package with a given version is installed using pkg_resources and requests install from Pypi if it isn't.
* py2exe is no longer bundled as a submodule rather it is installed from Pypi when executing scons as suggested by @LeonarddeR <https://github.com/leonardder>
* Workaround introduced by pr #9796 <#9796> has been removed as py2exe no longer corrupts signature of Python's dll.
Testing performed:
Created a signed (with a self generated certificate) launcher and .appx package. Installed it on both Windows 7 and 10. Ensured that NVDA,, nvda_slave and nvda_eoa-proxy still works as expected.
Known issues with pull request:
* Before merging this a try branch should be created with these changes to make sure that everything builds on AppVeyor
* I've briefly considered using --user option when install dependencies via pip similar to what @feerrenrut <https://github.com/feerrenrut> did in #10051 <#10051> The problem with this approach is that --user is incompatible with virtual envs so improving situation for people who don't have admin permissions would break install by default for users of virtual envs.
*
* Ideally requestPackage should be used in all places where we're installing dependencies via pip. This is out of scope for this pr.
Change log entry:
Changes for developers:
* Py2exe has been upgraded to version 0.10.1.0
…_____
You can view, comment on, or merge this pull request online at:
#11967
Commit Summary
* Remove workaround for issue #9762
* Stop bundling Py2exe as a git submodule
* Add a generic function which installs package with a given name using pip igf not installed
* Install Py2exe when executing SCons
* Update readme to reflect the new situation
File Changes
* M .gitmodules <https://github.com/nvaccess/nvda/pull/11967/files#diff-fe7afb5c9c916e521401d3fcfb4277d5071798c3baf83baf11d6071742823584> (3)
* A buildFunctions.py <https://github.com/nvaccess/nvda/pull/11967/files#diff-01f2881e70036b63955af7bf4a137db851f367317670565e654042840fbeea75> (31)
* D include/py2exe <https://github.com/nvaccess/nvda/pull/11967/files#diff-edbf875e9ed26ede48667777b629a75fefca0d80bd181b1e8f42c706859510fe> (1)
* M readme.md <https://github.com/nvaccess/nvda/pull/11967/files#diff-5a831ea67cf5cf8703b0de46901ab25bd191f56b320053be9332d9a3b0d01d15> (7)
* M sconstruct <https://github.com/nvaccess/nvda/pull/11967/files#diff-e797ec4a79b3a47e5688a1e7d474d8ce8e9742b5b5de626dfacdbed0b3118ec5> (14)
* M source/sourceEnv.py <https://github.com/nvaccess/nvda/pull/11967/files#diff-6db01557eec96238f93e8d60734cbae048ceb14affdcecb453a878b018b4df53> (1)
Patch Links:
* https://github.com/nvaccess/nvda/pull/11967.patch
* https://github.com/nvaccess/nvda/pull/11967.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#11967> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB4AXEFDZBDJ7AWISVFDOHLSWIXNFANCNFSM4VHJEEJQ> .
|
|
@josephsl wrote:
While Numpy is indeed installed on AppVeyor during NVDA's build process it is not a dependency of py2exe, rather it is required by |
|
Hi, true, but I found that if Numpy is installed, Py2Exe will copy Numpy libs to NVDA installation. Thanks.
|
|
@josephsl wrote:
thankfully |
|
Hi, right, thanks for refining the explanation. This one won’t block our migration to Python 3.8 and later. CC @feerrenrut if he has any comments, and I think it would be great to start introducing dependency updates soon. Thanks.
|
|
Could you elaborate on:
|
|
@LeonarddeR Wrote:
In both these cases the version that is currently installed is uninstalled and replaced with whatever version is defined in the Sconstruct file. |
|
So if I understand correctly, packages will be installed / replaced globally, unless the user has set up a virtual environment? |
I like this idea. |
|
@michaelDCurran wrote:
That's true but it is not a new behaviour - the same thing happens when installing dependencies for Linting or building dev docs i.e. global packages are overwritten unless user explicitly activates a virtual env before initiating instal.
Again its not a new thing though I understand why it is not ideal.
To be extra clear are you suggesting to install packages at user level providing |
|
I'm proposing using -t directory, which will install them in to a specific directory of our choice. then, that directory should be added to NVDA's pythonPath. To my knowledge, that does not affect anything globally. |
|
hi @michaelDCurran |
See test results for failed build of commit 1a7d9afb88 |
|
I've started implementing the approach which has been requested by @michaelDCurran that is install packages to the specific directory inside NVDA's repo, and while it works for the subsequent runs of SCons the first one fails. I'll look into this further as soon as time allows and mark this pr as a draft for now. |
|
It seems that this build also supports Python 3.9, which is now the latest Python stable. |
|
@michaelDCurran This is now ready for review. As you've suggested py2exe and its dependencies are installed to the |
|
If @feerrenrut or @michaelDCurran could merge this ASAP, the work done in this pr could be used to handle stuff like wx as well. |
|
We plan to get several PR's merged into a Python 3.8 branch and get NVDA running on that branch first. We won't use it fix all issues, just those that prevent building and running, so it should be a very short lived branch. I've created py3.8 for this. The PR can be retargeted. Since @michaelDCurran is already familiar, I'll let him review this again. |
|
Is retargeting really necessary here. While more recent version of Py2exe is indeed needed to make NVDA run under Python 3.8 it is still backwards compatible with 3.7, so merging this PR to Alpha would give testers best chance of catching eventual regressions caused by py2exe upgrade. |
|
Agreed with @lukaszgo1 here. |
|
@LeonarddeR wrote:
In #11794 you've said that installing WX using pip is not a good idea since it is a runtime dependency. What has changed? |
In the initial approach, py2exe was installed globally using pip. The current approach installs py2exe to NVDA's repository. I don't think installing something like wx globally is a good idea, I don't have any objections against installing wx in the way this pr introduces. |
|
I'm currently experimenting with this idea, extending it to fetch scons, wxPython, comtypes, sphinx etc. However, I have hit a problem which is that if the user has previously installed a later version of a package globally (E.g. the user installed sphinx 3.4.3 system-wide) but NVDA specifically requires "sphinx==3.4.1", pkg_resources.working_set.resolve raises a VersionConflict error, and doesn't even run the install callback. Even if it did, or the code was changed to run pip install specifically for sphinx==3.4.1 before this point, and phinx 3.4.1 is definitely in our installed_packages directory, pkg_resources continues to fail to resolve it because it finds sphinx 3.4.3 in site-packages. After playing with this for a couple of days, I think I'm coming to the conclusion that if we do want to use pip at all, we need to fully switch to using a virtual environment, so that before any of our requirements, our Python distribution starts fresh. |
That is quite interesting - I recall testing this specific scenario back in December with the initial version of this PR and it worked as expected. Have you played with creating a WorkingSet with our InstalledPackages dir as an only entry and using it explicitly rather than rely on the global working_set instance?
Agree 100%
Assuming the version conflict above would be fixed and this problem affects only install of scons we can always leave it as a submodule for the time being. |
|
I've looked briefly to the virtual envs idea and making it transparent to the user would probably be pretty difficult. The default Python implementation has a convenient method to create a new env programmatically, it even allows to run arbitrary Python code after creation which would allow us to install packages, but there is no easy possibility of activating a newly created env. An alternative would be to use virtualenv that is going to require a separate install though. Would it be acceptable to just ask users to create a virtual environment before building NVDA and explain that building without one is unsupported? Also the py2exe developer pointed in various issues against his repository that he does not provide support when py2exe is used inside virtual environment. I haven't encountered a single failure and I'm building NVDA that way for some time now, but it can certainly be an argument against continuing with this idea. |
|
Using a separate WorkSpace object doesn't really seem to help. Workspace.resolve still seems to do strange things like wanting to fetch setuptools every time, and also even though it has already fetched sphinx 3.4.1, trying to request sphinx_rtd_theme (which depends on "sphinx") causes sphinx 3.4.3 (newest version) to be fetched, even though sphinx 3.4.1 is already there. |
|
I think there are a number of benefits to using a virtual environment, I'd like to see it investigated further. I think transparency to the user is important, but not as important as a reliable and reproducible build and runtime environment. That said, I think that we'll be able to create solutions to make it transparent. |
Thinking more about it I'm not sure to what extend we can achieve transparency here. Some issues which come to mind are:
While I'm not a fan of the way we bundle dependencies as a git submodules it was certainly much simpler and as far as I understand time is a factor here - without more recent version of Py2exe we cannot move to Python 3.8. |
|
Closing in favor of #12075 |
Link to issue number:
Closes #11794
Summary of the issue:
We are currently using development build of py2exe. Since the current version of py2exe is now on pypi and supports Python 3.8 it is beneficial for us to upgrade.
Description of how this pull request fixes the issue:
requestPackagewhich checks if the package with a given version is installed usingpkg_resourcesand requests install from Pypi if it isn't.Testing performed:
Created a signed (with a self generated certificate) launcher and .appx package. Installed it on both Windows 7 and 10. Ensured that NVDA,, nvda_slave and nvda_eoa-proxy still works as expected.
Known issues with pull request:
--useroption when installing dependencies via pip similar to what @feerrenrut did in Install lint deps at user level #10051 The problem with this approach is that--useris incompatible with virtual envs so improving situation for people who don't have admin permissions would break install by default for users of virtual envs.requestPackageshould be used in all places where we're installing dependencies via pip. This is out of scope for this pr.Change log entry:
Changes for developers: