[Scons-users] Checking for specific versions of visual studio

Brian Cody brian.j.cody at gmail.com
Tue Sep 15 09:01:19 EDT 2015


Hey guys, a while ago I asked about how exists() is used for tools and I
was told it pretty much isn't. We have an scons.workarounds we use to get..
around things like this. Today it looks like this:

_already_warned_about_tool = set()

def does_tool_exist(env, tool):
    return SCons.Tool.Tool(tool, [str(SCons.Script.Dir(path)) for path in
env['toolpath']]).exists(env)

def verify_tool_exists(env, tool):
    exists = does_tool_exist(env, tool)
    if not exists:
        if tool not in _already_warned_about_tool:
            _already_warned_about_tool.add(tool)
            sys.stderr.write('*** Tool "' + tool + '" does not exist;
targets skipped.\n')
            if env['fail_if_tools_are_unavailable']:
                raise
SCons.Errors.BuildError(errstr='fail_if_tools_are_unavailable is enabled.')
    return exists

This is used because we have some developers who don't have all tools who
still want to be able to "build all that I can". Now the issue we're seeing
is that we create an environment specifically for visual studio 9.0. i.e.
Environment(tools = ['msvc', 'mslink', 'masm' , 'mslib'],
MSVC_VERSION='9.0', ......)

With this environment, the above function will successfully tell you if
visual studio is installed or not, however it will return True even if the
version is 12.0. At the moment I'm not sure that we can go to 12 with our
version of the compact framework. Our easier solution would be that this
function should just return false. Deep in the bowels of the visual studio
support I see that the "msvc_exists" takes a version number, but the
exists() in the tool does not attempt to use it. In "msvs_exists" it does
not allow the same version check.


So my leading question: How am I supposed to offer this functionality? If
this is a half-implemented in SCons, any suggestion on how to solve this
generically from our standpoint without injecting changes into the SCons
package?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150915/a64a3b85/attachment.html>


More information about the Scons-users mailing list