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