Skip to content

Commit 8a2d9a0

Browse files
committed
version 9.13.3a9; verbose
1 parent 796e4b5 commit 8a2d9a0

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The MATLAB® Engine API for Python® provides a package to integrate MATLA
2121
MATLAB Engine API for Python can be installed directly from the Python Package Index.
2222
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
2323
```bash
24-
$ python -m pip install matlabengine==9.13.3a8
24+
$ python -m pip install matlabengine==9.13.3a9
2525
```
2626

2727

@@ -46,7 +46,7 @@ setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:<matlabroot>/bin/glnxa64
4646
MATLAB Engine API for Python can be installed directly from the Python Package Index.
4747
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
4848
```bash
49-
$ python -m pip install matlabengine==9.13.3a8
49+
$ python -m pip install matlabengine==9.13.3a9
5050
```
5151

5252
### macOS
@@ -70,7 +70,7 @@ setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:<matlabroot>/bin/maci64
7070
MATLAB Engine API for Python can be installed directly from the Python Package Index.
7171
<!-- MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string) -->
7272
```bash
73-
$ python -m pip install matlabengine==9.13.3a8
73+
$ python -m pip install matlabengine==9.13.3a9
7474
```
7575

7676
---

setup.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from setuptools import setup, find_packages
44
from setuptools.command.build_py import build_py
55
import os
6-
import pdb
76
import re
87
import sys
98
import platform
@@ -25,7 +24,7 @@ class _MatlabFinder(build_py):
2524
MATLAB_REL = 'R2022b'
2625

2726
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
28-
MATLAB_VER = '9.13.3a8'
27+
MATLAB_VER = '9.13.3a9'
2928

3029
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
3130
SUPPORTED_PYTHON_VERSIONS = set(['3.8', '3.9', '3.10'])
@@ -51,10 +50,11 @@ class _MatlabFinder(build_py):
5150
found_matlab = ''
5251
found_matlab_with_wrong_arch_in_default_install = ''
5352
found_matlab_with_wrong_arch_in_path = ''
53+
verbose = True
5454

5555
# ERROR MESSAGES
5656
minimum_maximum = "No compatible version of MATLAB was found. " + \
57-
"This feature supports MATLAB {min_v:s} ({min_r:s}) through {max_v:s} ({max_r:s}), inclusive."
57+
"Version {this_v:s} was found, but this feature only supports MATLAB {min_v:s} ({min_r:s}) through {max_v:s} ({max_r:s}), inclusive."
5858
dir_not_found = "Directory not found: "
5959
no_windows_install = "MATLAB installation not found in Windows Registry:"
6060
unsupported_platform = "{platform:s} is not a supported platform."
@@ -72,6 +72,10 @@ class _MatlabFinder(build_py):
7272
wrong_arch_in_default_install = "MATLAB installation in {path1:s} is {matlab_arch:s}, but Python interpreter is {python_arch:s}. {next_steps:s}."
7373
wrong_arch_in_path = "MATLAB installation in {path1:s}, listed in DYLD_LIBRARY_PATH, is {matlab_arch:s}, but Python interpreter is {python_arch:s}. {next_steps:s}."
7474

75+
def _print_if_verbose(self, msg):
76+
if self.verbose:
77+
print(msg)
78+
7579
def set_platform_and_arch(self):
7680
"""
7781
Sets the platform and architecture.
@@ -150,7 +154,8 @@ def _create_path_list(self):
150154
raise RuntimeError(self.install_or_set_path.format(
151155
ver=self.MATLAB_REL, arch=self.arch,
152156
path=self.path_env_var_name))
153-
157+
158+
self._print_if_verbose(f'_create_path_list returned: {path_dirs}')
154159
return path_dirs
155160

156161
def _get_alternate_arch(self):
@@ -191,7 +196,7 @@ def _get_matlab_root_from_unix_bin(self, dir):
191196
found_matlab_with_wrong_arch_in_path = possible_root
192197
else:
193198
matlab_root = possible_root
194-
199+
self._print_if_verbose(f'_get_matlab_root_from_unix_bin returned: {matlab_root}')
195200
return matlab_root
196201

197202
def get_matlab_root_from_windows_reg(self):
@@ -205,7 +210,9 @@ def get_matlab_root_from_windows_reg(self):
205210
raise RuntimeError(f"{self.no_windows_install} {err}")
206211

207212
matlab_ver_key = self._find_matlab_key_from_windows_registry(key)
208-
return self._get_root_from_version_key(reg, matlab_ver_key)
213+
ret = self._get_root_from_version_key(reg, matlab_ver_key)
214+
self._print_if_verbose(f'get_matlab_root_from_windows_reg returned: {ret}')
215+
return ret
209216

210217
def _get_root_from_version_key(self, reg, ver_key):
211218
"""
@@ -218,6 +225,7 @@ def _get_root_from_version_key(self, reg, ver_key):
218225
except (OSError, FileNotFoundError) as err:
219226
raise RuntimeError(f"{self.no_windows_install} {err}")
220227

228+
self._print_if_verbose(f'_get_root_from_version_key returned: {matlab_root}')
221229
return matlab_root
222230

223231
def _find_matlab_key_from_windows_registry(self, key):
@@ -248,14 +256,17 @@ def _find_matlab_key_from_windows_registry(self, key):
248256
else:
249257
raise RuntimeError(f"{self.no_matlab}")
250258

259+
self._print_if_verbose(f'_find_matlab_key_from_windows_registry returned: {key_value}')
251260
return key_value
252261

253262
def _get_engine_ver_major_minor(self):
254263
re_major_minor = "^(\d+)\.(\d+)"
255264
eng_match = re.match(re_major_minor, self.MATLAB_VER)
256265
if not eng_match:
257266
raise RuntimeError(f"{self.invalid_version_from_eng.format(ver=self.MATLAB_VER)}")
258-
return (eng_match.group(1), eng_match.group(2))
267+
ret = (eng_match.group(1), eng_match.group(2))
268+
self._print_if_verbose(f'_get_engine_ver_major_minor returned: {ret}')
269+
return ret
259270

260271
def _check_matlab_ver_against_engine(self, matlab_ver):
261272
re_major_minor = "^(\d+)\.(\d+)"
@@ -308,7 +319,7 @@ def search_path_for_directory_unix(self, arch, path_dirs):
308319
matlab_root = self._get_matlab_root_from_unix_bin(path)
309320
ending_idx += 1
310321
dir_idx += 1
311-
322+
self._print_if_verbose(f'search_path_for_directory_unix returned: {matlab_root}')
312323
return matlab_root
313324

314325
def _err_msg_if_bad_matlab_root(self, matlab_root):
@@ -324,7 +335,7 @@ def _err_msg_if_bad_matlab_root(self, matlab_root):
324335
min_r = self.VER_TO_REL[min_v]
325336
max_v = v_to_r_keys[-1]
326337
max_r = self.VER_TO_REL[max_v]
327-
return self.minimum_maximum.format(min_v=min_v, min_r=min_r, max_v=max_v, max_r=max_r)
338+
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)
328339
else:
329340
# If we reach this line, we assume that the default location has already been checked for an
330341
# appropriate MATLAB installation but none was found.
@@ -357,7 +368,6 @@ def run(self):
357368
self.set_platform_and_arch()
358369
self.set_python_version()
359370

360-
pdb.set_trace()
361371
if self.platform == 'Windows':
362372
matlab_root = self.get_matlab_root_from_windows_reg()
363373
else:
@@ -396,7 +406,7 @@ def run(self):
396406
setup(
397407
name="matlabengine",
398408
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
399-
version="9.13.3a8",
409+
version="9.13.3a9",
400410
description='A module to call MATLAB from Python',
401411
author='MathWorks',
402412
license="MathWorks XSLA License",

src/matlab/engine/_arch.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
win64
2+
C:\UserAddedPrograms\MATLAB\R2022b\bin\win64
3+
C:\UserAddedPrograms\MATLAB\R2022b\extern\engines\python\dist\matlab\engine\win64
4+
C:\UserAddedPrograms\MATLAB\R2022b\extern\bin\win64

0 commit comments

Comments
 (0)