@@ -24,7 +24,7 @@ class _MatlabFinder(build_py):
2424 MATLAB_REL = 'R2023b'
2525
2626 # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
27- MATLAB_VER = '9.15.1a2 '
27+ MATLAB_VER = '9.15.1a3 '
2828
2929 # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
3030 SUPPORTED_PYTHON_VERSIONS = set (['3.9' , '3.10' ])
@@ -49,7 +49,8 @@ class _MatlabFinder(build_py):
4949 path_env_var_name = ''
5050 python_ver = ''
5151 platform = ''
52- found_matlab = ''
52+ found_matlab_release = ''
53+ found_matlab_version = ''
5354 found_matlab_with_wrong_arch_in_default_install = ''
5455 found_matlab_with_wrong_arch_in_path = ''
5556 verbose = False
@@ -66,8 +67,8 @@ class _MatlabFinder(build_py):
6667 no_compatible_matlab = "No compatible MATLAB installation found in Windows Registry. This release of " + \
6768 "MATLAB Engine API for Python is compatible with version {ver:s}. The found versions were"
6869 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}."
7172 invalid_version_from_matlab_ver = "Format of MATLAB version '{ver:s}' is invalid."
7273 invalid_version_from_eng = "Format of MATLAB Engine API version '{ver:s}' is invalid."
7374 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):
254255 if not key_value :
255256 if found_vers :
256257 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 )
258259 eng_ver_major_minor_as_str = '{}.{}' .format (eng_ver_major_minor [0 ], eng_ver_major_minor [1 ])
259260 raise RuntimeError (f"{ self .no_compatible_matlab .format (ver = eng_ver_major_minor_as_str )} { vers } ." )
260261 else :
@@ -263,9 +264,9 @@ def _find_matlab_key_from_windows_registry(self, key):
263264 self ._print_if_verbose (f'_find_matlab_key_from_windows_registry returned: { key_value } ' )
264265 return key_value
265266
266- def _get_engine_ver_major_minor (self ):
267+ def _get_engine_ver_major_minor (self , id ):
267268 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 )
269270 if not eng_match :
270271 raise RuntimeError (f"{ self .invalid_version_from_eng .format (ver = self .MATLAB_VER )} " )
271272 ret = (eng_match .group (1 ), eng_match .group (2 ))
@@ -296,8 +297,9 @@ def verify_matlab_release(self, root):
296297 matlab_release = ''
297298 for child in tree_root :
298299 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 )
301303 return matlab_release == self .MATLAB_REL
302304
303305 def search_path_for_directory_unix (self , arch , path_dirs ):
@@ -328,9 +330,9 @@ def search_path_for_directory_unix(self, arch, path_dirs):
328330
329331 def _err_msg_if_bad_matlab_root (self , matlab_root ):
330332 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 )
334336 # Found a MATLAB release but it is older than the oldest version supported,
335337 # or newer than the newest version supported.
336338 else :
@@ -339,7 +341,7 @@ def _err_msg_if_bad_matlab_root(self, matlab_root):
339341 min_r = self .VER_TO_REL [min_v ]
340342 max_v = v_to_r_keys [- 1 ]
341343 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 )
343345 else :
344346 # If we reach this line, we assume that the default location has already been checked for an
345347 # appropriate MATLAB installation but none was found.
@@ -410,7 +412,7 @@ def run(self):
410412 setup (
411413 name = "matlabengine" ,
412414 # MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
413- version = "9.15.1a2 " ,
415+ version = "9.15.1a3 " ,
414416 description = 'A module to call MATLAB from Python' ,
415417 author = 'MathWorks' ,
416418 license = "MathWorks XSLA License" ,
0 commit comments