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