File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 11%% PYTHON_VERSION get the Python version used by MATLAB
22%
3- % uses persistent variable to cache the Python version
3+ % uses persistent variable to cache the Python version.
4+ % If the environment changes, the cached version will be invalid.
5+ % this cache is cleared by "clear stdlib.python_version"
46%
57% %% Inputs
68% * force_old: (optional) boolean flag to force checking of Python on Matlab < R2022a
1719 force_old = false ;
1820end
1921
20- persistent stdlib_py_version
22+ persistent stdlib_py_version pyv_cached
23+
24+ if ~isempty(pyv_cached )
25+ pyv_cached = false ;
26+ end
2127
2228msg = ' ' ;
2329
24- if ~isempty( stdlib_py_version )
30+ if pyv_cached
2531 v = stdlib_py_version ;
2632 return
2733end
4349 msg = e .message ;
4450end
4551
46- % cache the result
47- if ~isempty(v )
48- stdlib_py_version = v ;
49- end
52+ % cache the result - even if empty -- because the check takes up to 1000 ms say on HPC
53+ stdlib_py_version = v ;
54+ pyv_cached = true ;
5055
5156end
You can’t perform that action at this time.
0 commit comments