@@ -24,7 +24,7 @@ class _MatlabFinder(build_py):
24
24
MATLAB_REL = 'R2023b'
25
25
26
26
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
27
- MATLAB_VER = '9.15.1a2 '
27
+ MATLAB_VER = '9.15.1a3 '
28
28
29
29
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
30
30
SUPPORTED_PYTHON_VERSIONS = set (['3.9' , '3.10' ])
@@ -49,7 +49,8 @@ class _MatlabFinder(build_py):
49
49
path_env_var_name = ''
50
50
python_ver = ''
51
51
platform = ''
52
- found_matlab = ''
52
+ found_matlab_release = ''
53
+ found_matlab_version = ''
53
54
found_matlab_with_wrong_arch_in_default_install = ''
54
55
found_matlab_with_wrong_arch_in_path = ''
55
56
verbose = False
@@ -66,8 +67,8 @@ class _MatlabFinder(build_py):
66
67
no_compatible_matlab = "No compatible MATLAB installation found in Windows Registry. This release of " + \
67
68
"MATLAB Engine API for Python is compatible with version {ver:s}. The found versions were"
68
69
no_matlab = "No compatible MATLAB installation found in Windows Registry."
69
- incompatible_ver = "MATLAB version {ver:s} was found, but this release of MATLAB Engine API for Python is not compatible with it. " + \
70
- "To install a compatible version, call python -m pip install matlabengine=={found :s}."
70
+ incompatible_ver = "MATLAB version {ver:s} ({rel:s}) was found, but this release of MATLAB Engine API for Python is not compatible with it. " + \
71
+ "To install a compatible version, call python -m pip install matlabengine=={ver :s}."
71
72
invalid_version_from_matlab_ver = "Format of MATLAB version '{ver:s}' is invalid."
72
73
invalid_version_from_eng = "Format of MATLAB Engine API version '{ver:s}' is invalid."
73
74
next_steps = "Reinstall MATLAB, use DYLD_LIBRARY_PATH to specify a different MATLAB installation, or use a different Python interpreter."
@@ -254,7 +255,7 @@ def _find_matlab_key_from_windows_registry(self, key):
254
255
if not key_value :
255
256
if found_vers :
256
257
vers = ', ' .join (found_vers )
257
- eng_ver_major_minor = self ._get_engine_ver_major_minor ()
258
+ eng_ver_major_minor = self ._get_engine_ver_major_minor (self . MATLAB_VER )
258
259
eng_ver_major_minor_as_str = '{}.{}' .format (eng_ver_major_minor [0 ], eng_ver_major_minor [1 ])
259
260
raise RuntimeError (f"{ self .no_compatible_matlab .format (ver = eng_ver_major_minor_as_str )} { vers } ." )
260
261
else :
@@ -263,9 +264,9 @@ def _find_matlab_key_from_windows_registry(self, key):
263
264
self ._print_if_verbose (f'_find_matlab_key_from_windows_registry returned: { key_value } ' )
264
265
return key_value
265
266
266
- def _get_engine_ver_major_minor (self ):
267
+ def _get_engine_ver_major_minor (self , id ):
267
268
re_major_minor = "^(\d+)\.(\d+)"
268
- eng_match = re .match (re_major_minor , self . MATLAB_VER )
269
+ eng_match = re .match (re_major_minor , id )
269
270
if not eng_match :
270
271
raise RuntimeError (f"{ self .invalid_version_from_eng .format (ver = self .MATLAB_VER )} " )
271
272
ret = (eng_match .group (1 ), eng_match .group (2 ))
@@ -296,8 +297,9 @@ def verify_matlab_release(self, root):
296
297
matlab_release = ''
297
298
for child in tree_root :
298
299
if child .tag == 'release' :
299
- matlab_release = self .found_matlab = child .text
300
- break
300
+ matlab_release = self .found_matlab_release = child .text
301
+ elif child .tag == 'version' :
302
+ self .found_matlab_version = self ._get_engine_ver_major_minor (child .text )
301
303
return matlab_release == self .MATLAB_REL
302
304
303
305
def search_path_for_directory_unix (self , arch , path_dirs ):
@@ -328,9 +330,9 @@ def search_path_for_directory_unix(self, arch, path_dirs):
328
330
329
331
def _err_msg_if_bad_matlab_root (self , matlab_root ):
330
332
if not matlab_root :
331
- if self .found_matlab :
332
- if self .found_matlab in self .VER_TO_REL :
333
- return self .incompatible_ver .format (ver = self .VER_TO_REL [ self . found_matlab ], found = self .found_matlab )
333
+ if self .found_matlab_version :
334
+ if self .found_matlab_version in self .VER_TO_REL :
335
+ return self .incompatible_ver .format (ver = self .found_matlab_version , rel = self .found_matlab_release )
334
336
# Found a MATLAB release but it is older than the oldest version supported,
335
337
# or newer than the newest version supported.
336
338
else :
@@ -339,7 +341,7 @@ def _err_msg_if_bad_matlab_root(self, matlab_root):
339
341
min_r = self .VER_TO_REL [min_v ]
340
342
max_v = v_to_r_keys [- 1 ]
341
343
max_r = self .VER_TO_REL [max_v ]
342
- return self .minimum_maximum .format (this_v = self .found_matlab , min_v = min_v , min_r = min_r , max_v = max_v , max_r = max_r )
344
+ return self .minimum_maximum .format (this_v = self .found_matlab_release , min_v = min_v , min_r = min_r , max_v = max_v , max_r = max_r )
343
345
else :
344
346
# If we reach this line, we assume that the default location has already been checked for an
345
347
# appropriate MATLAB installation but none was found.
@@ -410,7 +412,7 @@ def run(self):
410
412
setup (
411
413
name = "matlabengine" ,
412
414
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
413
- version = "9.15.1a2 " ,
415
+ version = "9.15.1a3 " ,
414
416
description = 'A module to call MATLAB from Python' ,
415
417
author = 'MathWorks' ,
416
418
license = "MathWorks XSLA License" ,
0 commit comments