Update SCons cxxtest build_tools to Python3
fbrier opened this issue · 1 comments
Operating System: Windows 10 Professional
Compiler: Visual Studio 2019 Community Edition
SCons: 4.3.0
Python: 3.9.4
In trying to integrate cxxtest into an SCons build, it appears that the cxxtest/build_tools/SCons/cxxtest.py is still Python 2, not 3. Please correct me if I am wrong, but the print statements were not using ()s. So I forked this repo and ran 2to3.exe and generated a new version. If I can fix this, I will put in a PR. However, then I ran into the error below, which is very odd. It is almost as if the wrong command line interpreter is being used on the cxxtestgen.BAT file. The build had been running in a PowerShell window, but also fails with the exact same error in a Visual Studio x64 Native Tools Command Prompt window.
File "D:\Projects\myproject\cxxtest\bin\cxxtestgen.BAT", line 1
@echo off
^
SyntaxError: invalid syntax
scons: *** [mysubproject.test\src\MyTestSuite.cpp] Error 1
scons: building terminated because of errors.
I tracked the error to the above cxxtest.py file, around line 325, where it appears an Action is created. I added a bunch of print statements to just before the cxxtest_builder is created. For some reason, CXXTEST_ROOT_PART is passed as a parameter, yet that symbol appears no where in the code, any documentation, or even the entire Internet. So I do not understand its purpose. A second question is why is a batch file being invoked, when it appears all it does is invoke a Python script. Why not just have the Action invoke the Python script?
@echo off
rem Just run the python script
python %0 %*
Or perhaps, in the conversion from Python 2 to 3, the Python script in the same directory was supposed to be found and invoked, rather than the batch file. I am not a Python or SCons expert. Any help or pointers would be appreciated. Thank you.
Tried scons-tool-cxxtest again and it worked great. Not sure what I did wrong the first time.