Fixed GH Issue 4809. scoop.sh installed scons (and likely scons-local )created msvs project files would fail.#4817
Fixed GH Issue 4809. scoop.sh installed scons (and likely scons-local )created msvs project files would fail.#4817bdbaddog wants to merge 6 commits intoSCons:masterfrom
Conversation
…) created msvs project files would fail.
Changes: * Change SCons/Tool/msvs.py function comment before getExecScriptMain and replace with docstring. Taken from PR SCons#4817. * Revert python executable code * Generate scons_home (user env, SCONS_HOME, or SCONS_LIB_DIR path specification) and scons_path (currently executing SCons module path) paths in unified script in SCons/Tool/msvs.py and testing/framework/TestSConsMSVS.py. Similar to the two code paths in PR SCons#4817. * Set the SCONS_HOME variable in the testenv as is done with SCONS_LIB_DIR. Add SCONS_HOME to testing/framework/TestSConsMSVS.py.
…e scons.py which was run available in SCons.Script.Main.SCONS_SCRIPT_PATH
|
|
||
|
|
||
| def main() -> None: | ||
| def main(script_path) -> None: |
There was a problem hiding this comment.
Bugs of omission?
SCons/SCript/Main main function now takes a required script_path argument.
Missing:
SCons/__main__.pyneeds to pass ascript_pathargument.- The
bin/scons-test.pyfunctiondo_nothingneeds to accept ascript_pathargument.
I could be wrong.
There was a problem hiding this comment.
Good catch. Updating.
There was a problem hiding this comment.
How'd you find those? Are we missing some tests which should catch such? (python -m scons ?)
There was a problem hiding this comment.
I just searched the source code for combinations of Script.main (e.g. regex Script\.main\( most likely).
Potential issues:
-
The change from
main()tomain(script_path)can/will break user code.Basically anyone doing the same thing:
import SCons.Script; SCons.Script.main(). -
Isn't
mainthe entry point when building the wheel wrapper executables for Windows?[console_scripts] scons = SCons.Script.Main:main scons-configure-cache = SCons.Utilities.ConfigureCache:main sconsign = SCons.Utilities.sconsign:mainI thought that the entry point was not supposed to take arguments but I certainly could be wrong. A required argument could be problematic.
-
scons.pyis not the only way SCons will be called.For example, the zipapp (e.g.,
scons-local-4.10.1.pyz) will be called via__main__.py.However, adding
os.path.abspath(__file__)will not work for the zippapp. An invocation likeS:\SCons\test-4809\scons-local-4.10.1.pyz\__main__.pywill fail.Something like
os.path.dirname(os.path.abspath(__file__))would be needed to use the name of the zipapp file itself. An invocation likeS:\SCons\test-4809\scons-local-4.10.1.pyzshould work. -
Changing the default generated msvs script code path from using
PYTHON_ROOTandPYTHONPATHwhich has allowed deferred evaluation of the location of python and SCons since version 1.0 to a hard-coded absolute path could break some user code.Both
PYTHON_ROOT(or something similar) andPYTHONPATHwere/are useful when using python and SCons from a USB stick and/or when physically moving folders between computers as it avoids hard-coded absolute paths.Edit: This is a different animal when actually launching the VS GUI which can be done via batch file(s) via the SCons project root to open the generated .sln in the appropriate build folder.
Don't shoot the messenger.
There was a problem hiding this comment.
Not shooting the messenger, just wanted to see what I should have done to catch those.
Fixed GH Issue #4809 4809. scoop.sh installed scons (and likely scons-local )created msvs project files would fail.
See #4810 for discussion.
This is the implementation of the fix discussed in that PR.
Largely the work of.
@jcbrill & @madmiraal
Note: I tested this live with the SConstruct from #4809 and scoop.sh installed scons
(And then locally editing scoop installed scons' msvs.py"
Contributor Checklist:
CHANGES.txtandRELEASE.txt(and read theREADME.rst).