ProjectTool fails on non-Windows platforms
donno opened this issue · 1 comments
cake.library.project imports cake.library.compilers.msvc simply for the type MsvcCompiler so it can determine if the compiler used is MSVC or not.
By doing this it fails because that imports cake.msvs which then tries to import _winreg (Linux doesn't provide the Windows registry).
Fundamentally there should be no reason why project files for shouldn't be buildable on Windows. While I am unaware of any other tools that would find a use for vcproj file, it would be a pain having to conditionally the use of the project tool in cake scripts based on platform.
Traceback (most recent call last):
File "/root/.local/lib/python2.7/site-packages/cake/runner.py", line 454, in run
configuration = engine.findConfiguration(scriptPath)
File "/root/.local/lib/python2.7/site-packages/cake/engine.py", line 335, in findConfiguration
return self.getConfiguration(configScript)
File "/root/.local/lib/python2.7/site-packages/cake/engine.py", line 308, in getConfiguration
script.execute()
File "/root/.local/lib/python2.7/site-packages/cake/script.py", line 273, in execute
exec byteCode in scriptGlobals
File "/root/descentreader/config.cake", line 19, in <module>
from cake.library.project import ProjectTool
File "/root/.local/lib/python2.7/site-packages/cake/library/project.py", line 26, in <module>
from cake.library.compilers.msvc import MsvcCompiler
File "/root/.local/lib/python2.7/site-packages/cake/library/compilers/msvc.py", line 19, in <module>
from cake.msvs import getMsvcProductDir, getMsvsInstallDir, getPlatformSdkVersions, getWindowsKitsDir, vswhere
File "/root/.local/lib/python2.7/site-packages/cake/msvs.py", line 10, in <module>
import _winreg as winreg
ImportError: No module named _winreg
Build failed with 1 errors.
Possibly the simplest solution would be to wrap the import of MsvcCompiler in project.py with a try/catch ImportError and change the code which checks for MsvcCompiler to assume it can't be used (as the import failed)