Skip to content

Commit 356dde2

Browse files
committed
9.13.3a4; improve err msg when appropriate MATLAB not found in default location or path
1 parent 44ecb46 commit 356dde2

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
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.3a3
24+
$ python -m pip install matlabengine==9.13.3a4
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.3a3
49+
$ python -m pip install matlabengine==9.13.3a4
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.3a3
73+
$ python -m pip install matlabengine==9.13.3a4
7474
```
7575

7676
---

setup.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class _MatlabFinder(build_py):
2424
MATLAB_REL = 'R2022b'
2525

2626
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
27-
MATLAB_VER = '9.13.3a3'
27+
MATLAB_VER = '9.13.3a4'
2828

2929
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
3030
SUPPORTED_PYTHON_VERSIONS = set(['3.8', '3.9', '3.10'])
@@ -44,7 +44,7 @@ class _MatlabFinder(build_py):
4444
}
4545

4646
arch = ''
47-
path_name = ''
47+
path_env_var_name = ''
4848
python_ver = ''
4949
platform = ''
5050
found_matlab = ''
@@ -59,7 +59,7 @@ class _MatlabFinder(build_py):
5959
unsupported_platform = "{platform:s} is not a supported platform."
6060
unsupported_python = "{python:s} is not supported. The supported Python versions are {supported:s}."
6161
unset_env = "Environment variable {path1:s} has not been set. Add <matlabroot>/bin/{arch:s} to {path2:s}, where <matlabroot> is the root of a valid MATLAB installation."
62-
set_path = "MATLAB installation not found in {path1:s}. Add <matlabroot>/bin/{arch:s} to {path2:s}, where <matlabroot> is the root of a valid MATLAB installation."
62+
install_or_set_path = "MATLAB {ver:s} installation not found. Install to default location, or add <matlabroot>/bin/{arch:s} to {path2:s}, where <matlabroot> is the root of a MATLAB {ver:s} installation."
6363
no_compatible_matlab = "No compatible MATLAB installation found in Windows Registry. This release of " + \
6464
"MATLAB Engine API for Python is compatible with version {ver:s}. The found versions were"
6565
no_matlab = "No compatible MATLAB installation found in Windows Registry."
@@ -79,7 +79,7 @@ def set_platform_and_arch(self):
7979
if self.platform not in self.PLATFORM_DICT:
8080
raise RuntimeError(self.unsupported_platform.format(platform=self.platform))
8181
else:
82-
self.path_name = self.PLATFORM_DICT[self.platform]
82+
self.path_env_var_name = self.PLATFORM_DICT[self.platform]
8383

8484
if self.platform == 'Windows':
8585
self.arch = 'win64'
@@ -141,12 +141,13 @@ def _create_path_list(self):
141141
"""
142142
path_dirs = []
143143
path_string = ''
144-
if self.path_name in os.environ:
145-
path_string = os.environ[self.path_name]
144+
if self.path_env_var_name in os.environ:
145+
path_string = os.environ[self.path_env_var_name]
146146
path_dirs.extend(path_string.split(os.pathsep))
147147

148148
if not path_dirs:
149-
raise RuntimeError(self.unset_env.format(path1=self.path_name, arch=self.arch, path2=self.path_name))
149+
raise RuntimeError(self.unset_env.format(path1=self.path_env_var_name,
150+
arch=self.arch, path2=self.path_env_var_name))
150151

151152
return path_dirs
152153

@@ -323,7 +324,10 @@ def _err_msg_if_bad_matlab_root(self, matlab_root):
323324
max_r = self.VER_TO_REL[max_v]
324325
return self.minimum_maximum.format(min_v=min_v, min_r=min_r, max_v=max_v, max_r=max_r)
325326
else:
326-
return self.set_path.format(path1=self.path_name, arch=arch, path2=self.path_name)
327+
# If we reach this line, we assume that the default location has already been checked for an
328+
# appropriate MATLAB installation but none was found.
329+
return self.install_or_set_path.format(ver=MATLAB_REL, arch=self.arch,
330+
path=self.path_env_var_name)
327331

328332
if not os.path.isdir(matlab_root):
329333
return f"{self.dir_not_found} {matlab_root}"
@@ -389,7 +393,7 @@ def run(self):
389393
setup(
390394
name="matlabengine",
391395
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
392-
version="9.13.3a3",
396+
version="9.13.3a4",
393397
description='A module to call MATLAB from Python',
394398
author='MathWorks',
395399
license="MathWorks XSLA License",

0 commit comments

Comments
 (0)