Skip to content

Commit 68f8a90

Browse files
committed
has_psutil: require force if less than R2022a
1 parent 10a6841 commit 68f8a90

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

+stdlib/+python/has_psutil.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
%% PYTHON.HAS_PSUTIL is Python psutil module availble
22

3-
function y = has_psutil()
3+
function y = has_psutil(force_old)
4+
arguments
5+
force_old (1,1) logical = false
6+
end
7+
8+
% For MATLAB versions older than R2022a, skip Python version check unless force_old is true
9+
if isMATLABReleaseOlderThan('R2022a') && ~force_old
10+
return
11+
end
412

513
y = pvt_psutil();
614
% this is to avoid Matlab < R2022a JIT but with Python in general

+stdlib/python_version.m

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,10 @@
2424
return
2525
end
2626

27-
v = [];
28-
29-
% For MATLAB versions older than R2022a, skip Python version check unless force_old is true
30-
if isMATLABReleaseOlderThan('R2022a') && ~force_old
31-
return
32-
end
33-
3427
% we use a separate function because the JIT compiler in Matlab < R2022a
3528
% breaks for any py.* command when pyenv() is not correctly configured
3629

37-
v = stdlib.python.version();
30+
v = stdlib.python.version(force_old);
3831

3932
% cache the result
4033
if ~isempty(v)

0 commit comments

Comments
 (0)