[Scons-users] Need a better message when MSVC caching enabled
Eric Fahlgren
ericfahlgren at gmail.com
Sun Feb 2 11:31:22 EST 2020
I hacked up common.py, adding the '*' lines to read_script_env_cache.
Timed an empty build about 20 times both with and without my hack, saw less
that 10 ms difference between the two versions when processing a valid
cache. With some broken paths in the cache, it of course, takes the long
route, due to having to rebuild everything. (My .scons_msvc_cache contains
78 path values, half for x86, half for x64.)
def read_script_env_cache():
""" fetch cached msvc env vars if requested, else return empty dict """
envcache = {}
if CONFIG_CACHE:
try:
with open(CONFIG_CACHE, 'r') as f:
envcache = json.load(f)
#TODO can use more specific FileNotFoundError when py2 dropped
except IOError:
# don't fail if no cache file, just proceed without it
pass
* for cache_data in envcache.values():
* for key, paths in cache_data.items():
* if key in KEEPLIST[0:4]: # Ugly and unscalable, but works
for this example.
* for path in paths:
* if not os.path.exists(path):
* print(' Invalid path in ', key, path) #
Scaffolding, make it a real warning.
* return {} # Force cache rebuild.
return envcache
On Sat, Feb 1, 2020 at 7:46 PM Bill Deegan <bill at baddogconsulting.com>
wrote:
> Maybe also if that's enabled a message at SCons startup?
> Though that might break a lot of tests..
>
> On Sat, Feb 1, 2020 at 7:02 AM Eric Fahlgren <ericfahlgren at gmail.com>
> wrote:
>
>> No need to be sorry, quite the opposite. I remember thinking that this
>> could (would) happen when I started using it, but then simply forgot. On
>> the other hand, I will definitely not stop using the caching, the
>> improvements in speed we see are quite large (a invocation of SCons when
>> everything is up-to-date now takes about 0.5 seconds!, previously was
>> around 6-10 seconds), so I am a huge fan of this feature and thanks again
>> for adding it.
>>
>> On Sat, Feb 1, 2020 at 6:33 AM Mats Wichmann <mats at wichmann.us> wrote:
>>
>>> On 1/31/20 8:58 PM, Eric Fahlgren wrote:
>>> > So, I updated MSVC on a couple of machines today and all of a sudden
>>> I'm
>>> > getting error messages about "cl not found".
>>> >
>>> >>>> scons: Reading SConscript files ...
>>> >>>>
>>> >>>> scons: warning: Could not find MSVC compiler 'cl', it may need to be
>>> > installed separately with Visual Studio
>>> >>>> File "SConstruct", line 54, in __init__
>>> >
>>> > I start digging in and the path is pointing to the old version of the
>>> > compiler, hmm where is this coming from? A couple hours of hair
>>> pulling
>>> > later I realize, oh $#!t, I've got SCONS_CACHE_MSVC_CONFIG turned on,
>>> so
>>> > I delete ~/.scons_msvc_cache, voila, everything works fine.
>>> >
>>> > Could we enhance the warning message to also say something like "if you
>>> > have caching enabled, it may be out of date, see <path-to-cache-file>"
>>> > or something like that?
>>> >
>>> > I personally will never forget this again 😬, but it might help someone
>>> > else in the future.
>>>
>>> I'll look at how to improve on it. This was the reason the feature was
>>> marked experimental, figured something would go awry somewhere.
>>>
>>> "A couple hours ... later I realize... I've got SCONS_CACHE_MSVC_CONFIG
>>> turned on"
>>>
>>> Sorry about that - it kind of reinforces why SCons doesn't like to
>>> depend on the setting of environment vars, it's not always clear who's
>>> got what set up :)
>>>
>>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200202/b63db780/attachment.html>
More information about the Scons-users
mailing list