Skip to content

Commit 47ec06d

Browse files
committed
python_version use float
1 parent 84fd7c5 commit 47ec06d

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

+stdlib/platform_tell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function platform_tell()
1414
end
1515

1616
if stdlib.has_python()
17-
fprintf('Python: %s Home: %s\n', stdlib.python_version(), stdlib.python_home());
17+
fprintf('Python: %0.2f Home: %s\n', stdlib.python_version(), stdlib.python_home());
1818
end
1919

2020
if ismac()

+stdlib/python_version.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
function v = python_version()
44

5-
pe = pyenv();
6-
v = pe.Version;
5+
try
6+
pe = pyenv();
7+
v = str2double(pe.Version);
8+
catch
9+
v = [];
10+
end
711

812
end

+stdlib/relative_to.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
ois = stdlib.is_absolute(other);
4848

4949
if bis ~= ois
50-
rel = "";
50+
rel = "";
5151
return
5252
end
5353

@@ -68,7 +68,7 @@
6868

6969
try
7070
bp = py.pathlib.Path(other);
71-
if stdlib.python_version() >= "3.12"
71+
if stdlib.python_version() >= 3.12
7272
r = bp.relative_to(base, pyargs(walk_up=true));
7373
else
7474
r = bp.relative_to(base);

test/TestRelative.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function test_proximate_to(tc, pp)
3737
};
3838
% NOTE: ".." in relative_to(base) is ambiguous including for python.pathlib, C++ <filesystem>, etc.
3939

40-
if stdlib.has_dotnet() || stdlib.python_version() >= "3.12"
40+
if stdlib.has_dotnet() || stdlib.python_version() >= 3.12
4141
p = [p, {
4242
{"a/b/c/d", "a/b", fullfile("..", "..")}, ...
4343
{"a/b", "a/c", fullfile("..", "c")}, ...
@@ -49,7 +49,7 @@ function test_proximate_to(tc, pp)
4949

5050
if ispc
5151

52-
if stdlib.has_dotnet() || stdlib.python_version() >= "3.12"
52+
if stdlib.has_dotnet() || stdlib.python_version() >= 3.12
5353
p = [p, { ...
5454
{"C:/a/b", "C:/", fullfile("..", "..")}, ...
5555
{"c:/a/b", "c:/a", ".."}, ...

test/TestSys.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function test_dotnet_version(tc)
2626
function test_has_python(tc)
2727
tc.assumeTrue(stdlib.has_python())
2828
v = stdlib.python_version();
29-
tc.verifyGreaterThan(strlength(v), 0, "expected non-empty Python version")
29+
tc.verifyGreaterThanOrEqual(v, 3.8, "expected Python >= 3.8")
3030
end
3131

3232
function test_os_version(tc)

0 commit comments

Comments
 (0)