Skip to content

Commit 8b30891

Browse files
committed
v9.12.10
1 parent 838cdd8 commit 8b30891

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

.github/workflows/python-publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ permissions:
99

1010
jobs:
1111
deploy:
12-
1312
runs-on: ubuntu-latest
1413

1514
steps:
@@ -26,8 +25,17 @@ jobs:
2625
- name: Build package
2726
run: python setup.py sdist
2827

29-
- name: Publish package
28+
- name: Publish package to TestPyPI since the "prerelease" checkbox is checked
29+
if: "github.event.release.prerelease"
30+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
31+
with:
32+
user: __token__
33+
password: ${{ secrets.MATLABENGINE_TEST_PYPI_TOKEN }}
34+
repository_url: https://test.pypi.org/legacy/
35+
36+
- name: Publish package to PyPI since the "prerelease" checkbox is unchecked
37+
if: "!github.event.release.prerelease"
3038
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
3139
with:
3240
user: __token__
33-
password: ${{ secrets.PYPI_API_TOKEN }}
41+
password: ${{ secrets.MATLABENGINE_PYPI_TOKEN }}

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

7676
---

setup.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from setuptools import setup, find_packages
44
from setuptools.command.build_py import build_py
55
import os
6+
import re
67
import sys
78
import platform
89
import xml.etree.ElementTree as xml
@@ -23,7 +24,7 @@ class _MatlabFinder(build_py):
2324
MATLAB_REL = 'R2022a'
2425

2526
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
26-
MATLAB_VER = '9.12'
27+
MATLAB_VER = '9.12.10'
2728

2829
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
2930
SUPPORTED_PYTHON_VERSIONS = set(['3.8', '3.9'])
@@ -63,6 +64,8 @@ class _MatlabFinder(build_py):
6364
no_matlab = "No MATLAB installation found in Windows Registry."
6465
incompatible_ver = "MATLAB version {ver:s} was found, but MATLAB Engine API for Python is not compatible with it. " + \
6566
"To install a compatible version, call python -m pip install matlabengine=={found:s}."
67+
invalid_version_from_matlab_ver = "Format of MATLAB version '{ver:s}' is invalid."
68+
invalid_version_from_eng = "Format of MATLAB Engine API version '{ver:s}' is invalid."
6669

6770
def set_platform_and_arch(self):
6871
"""
@@ -171,7 +174,7 @@ def _find_matlab_key_from_windows_registry(self, key):
171174
found_vers.append(sub_key)
172175
# Example: the version in the registry could be "9.13.1" whereas our version is "9.13"
173176
# we still want to allow this
174-
if sub_key.startswith(self.MATLAB_VER):
177+
if self._check_matlab_ver_against_engine(sub_key):
175178
key_value = sub_key
176179
break
177180

@@ -184,10 +187,25 @@ def _find_matlab_key_from_windows_registry(self, key):
184187

185188
return key_value
186189

190+
def _check_matlab_ver_against_engine(self, matlab_ver):
191+
re_major_minor = "^(\d+)\.(\d+)"
192+
matlab_ver_match = re.match(re_major_minor, matlab_ver)
193+
if not matlab_ver_match:
194+
raise RuntimeError(f"{self.invalid_version_from_matlab_ver.format(ver=matlab_ver)}")
195+
eng_match = re.match(re_major_minor, self.MATLAB_VER)
196+
if not eng_match:
197+
raise RuntimeError(f"{self.invalid_version_from_eng.format(ver=self.MATLAB_VER)}")
198+
199+
matlab_ver_major_minor = (matlab_ver_match.group(1), matlab_ver_match.group(2))
200+
eng_major_minor = (eng_match.group(1), eng_match.group(2))
201+
202+
return (matlab_ver_major_minor == eng_major_minor)
203+
187204
def verify_matlab_release(self, root):
188205
"""
189206
Parses VersionInfo.xml to verify the MATLAB release matches the supported release
190-
for the Python Engine.
207+
for the Python Engine. The major and minor version numbers must match. Everything
208+
else will be ignored.
191209
"""
192210
version_info = os.path.join(root, 'VersionInfo.xml')
193211
if not os.path.isfile(version_info):
@@ -201,10 +219,7 @@ def verify_matlab_release(self, root):
201219
if child.tag == 'release':
202220
matlab_release = self.found_matlab = child.text
203221
break
204-
205-
if matlab_release != self.MATLAB_REL:
206-
return False
207-
return True
222+
return matlab_release == self.MATLAB_REL
208223

209224
def search_path_for_directory_unix(self):
210225
"""
@@ -284,7 +299,7 @@ def run(self):
284299
setup(
285300
name="matlabengine",
286301
# MUST_BE_UPDATED_EACH_RELEASE (Search repo for this string)
287-
version="9.12",
302+
version="9.12.10",
288303
description='A module to call MATLAB from Python',
289304
author='MathWorks',
290305
license="MathWorks XSLA License",

0 commit comments

Comments
 (0)