@@ -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.2 '
27
+ MATLAB_VER = '9.13.2a0 '
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' ])
@@ -82,6 +82,8 @@ def set_platform_and_arch(self):
82
82
self .arch = 'glnxa64'
83
83
elif self .platform == 'Darwin' :
84
84
if platform .mac_ver ()[- 1 ] == 'arm64' :
85
+ # We will change this value later in the script if we find that the user is
86
+ # using an installation of MATLAB built for maci64, to be run under Rosetta.
85
87
self .arch = 'maca64'
86
88
else :
87
89
self .arch = 'maci64'
@@ -234,6 +236,10 @@ def search_path_for_directory_unix(self):
234
236
dir_to_find = os .path .join ('bin' , self .arch )
235
237
# directory could end with slashes
236
238
endings = [dir_to_find , dir_to_find + os .sep ]
239
+ if self .arch == 'maca64' :
240
+ addl_dir_to_find = 'maci64'
241
+ endings .append (addl_dir_to_find )
242
+ endings .append (addl_dir_to_find + os .sep )
237
243
238
244
matlab_root = ''
239
245
dir_idx = 0
@@ -245,6 +251,13 @@ def search_path_for_directory_unix(self):
245
251
if path .endswith (ending ):
246
252
# _get_matlab_root_from_unix_bin will return an empty string if MATLAB is not found.
247
253
# Non-empty string (MATLAB found) will break both loops.
254
+ if self .arch == 'maca64' and ending [:6 ] == 'maci64' :
255
+ # We found a maci64 installation. Use it (under Rosetta) rather than maca64.
256
+ # This means that if the user wants to use maci64 on a maca64 machine,
257
+ # they need to make sure that the maci64 installation is in the default
258
+ # location if there is one, or if not, that it is earlier on the path than
259
+ # any maca64 installations.
260
+ self .arch = 'maci64'
248
261
matlab_root = self ._get_matlab_root_from_unix_bin (path )
249
262
ending_idx += 1
250
263
dir_idx += 1
@@ -308,7 +321,7 @@ def run(self):
308
321
setup (
309
322
name = "matlabengine" ,
310
323
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
311
- version = "9.13.2 " ,
324
+ version = "9.13.2a0 " ,
312
325
description = 'A module to call MATLAB from Python' ,
313
326
author = 'MathWorks' ,
314
327
license = "MathWorks XSLA License" ,
0 commit comments