Skip to content

Commit fd631be

Browse files
committed
Update to v0.2.0, introducing support for MATLAB R2024b.
1 parent ff523ac commit fd631be

13 files changed

+103
-73
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ jobs:
1616
- matlab
1717
baseImage:
1818
- debian:latest
19-
- ubuntu:latest
19+
# Update to ubuntu:latest when R2024b support for it has been released in matlab-deps
20+
- ubuntu:22.04
2021
- mcr.microsoft.com/devcontainers/base:ubuntu
2122
steps:
2223
- uses: actions/checkout@v3

src/matlab/README.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# MATLAB (matlab)
32

43
Installs MATLAB with supporting packages and tools.
@@ -13,28 +12,26 @@ Installs MATLAB with supporting packages and tools.
1312

1413
## Options
1514

16-
| Options Id | Description | Type | Default Value |
17-
|-----|-----|-----|-----|
18-
| release | MATLAB Release to install. | string | r2024a |
19-
| products | Products to install, specified as a list of space-separated product names.</br> For details of products, see [MATLAB Package Manager](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md#product-installation-options). | string | MATLAB |
20-
| doc | Flag to install documentation and examples (R2022b and earlier releases). | boolean | false |
21-
| installGpu | Skips installation of GPU libraries when you install Parallel Computing Toolbox (R2023a and later releases). | boolean | false |
22-
| destination | Full path to the installation destination folder. | string | /opt/matlab/$RELEASE |
23-
| installMatlabProxy | Installs matlab-proxy and its dependencies (R2020b and later releases). | boolean | false |
24-
| installJupyterMatlabProxy | Installs jupyter-matlab-proxy and its dependencies (R2020b and later releases). | boolean | false |
25-
| installMatlabEngineForPython | Installs the MATLAB Engine for Python if the destination option is set correctly. | boolean | false |
26-
| startInDesktop | Starts matlab-proxy when container starts. | string | false |
27-
| networkLicenseManager | MATLAB will use the specified Network License Manager. | string | - |
28-
| skipMATLABInstall | Set to true if you do not want to install MATLAB, for example if you only want to install `matlab-proxy` or `jupyter-matlab-proxy`. | boolean | false |
15+
| Options Id | Description | Type | Default Value |
16+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------------------- |
17+
| release | MATLAB Release to install. | string | r2024b |
18+
| products | Products to install, specified as a list of space-separated product names.</br> For details of products, see [MATLAB Package Manager](https://github.com/mathworks-ref-arch/matlab-dockerfile/blob/main/MPM.md#product-installation-options). | string | MATLAB |
19+
| doc | Flag to install documentation and examples (R2022b and earlier releases). | boolean | false |
20+
| installGpu | Skips installation of GPU libraries when you install Parallel Computing Toolbox (R2023a and later releases). | boolean | false |
21+
| destination | Full path to the installation destination folder. | string | /opt/matlab/$RELEASE |
22+
| installMatlabProxy | Installs matlab-proxy and its dependencies (R2020b and later releases). | boolean | false |
23+
| installJupyterMatlabProxy | Installs jupyter-matlab-proxy and its dependencies (R2020b and later releases). | boolean | false |
24+
| installMatlabEngineForPython | Installs the MATLAB Engine for Python if the destination option is set correctly. | boolean | false |
25+
| startInDesktop | Starts matlab-proxy when container starts. | string | false |
26+
| networkLicenseManager | MATLAB will use the specified Network License Manager. | string | - |
27+
| skipMATLABInstall | Set to true if you do not want to install MATLAB, for example if you only want to install `matlab-proxy` or `jupyter-matlab-proxy`. | boolean | false |
2928

3029
## Customizations
3130

3231
### VS Code Extensions
3332

3433
- `MathWorks.language-matlab`
3534

36-
37-
3835
---
3936

40-
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/mathworks/devcontainer-features/blob/main/src/matlab/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
37+
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/mathworks/devcontainer-features/blob/main/src/matlab/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

src/matlab/devcontainer-feature.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
{
22
"name": "MATLAB",
33
"id": "matlab",
4-
"version": "0.1.0",
4+
"version": "0.2.0",
55
"description": "Installs MATLAB with supporting packages and tools.",
66
"documentationURL": "https://github.com/mathworks/devcontainer-features",
77
"options": {
88
"release": {
99
"type": "string",
1010
"proposals": [
11-
"r2024a",
12-
"r2023b",
13-
"r2023a",
14-
"r2022b",
15-
"r2022a",
16-
"r2021b",
17-
"r2021a",
18-
"r2020b",
19-
"r2020a",
20-
"r2019b",
21-
"r2019a"
11+
"R2024b",
12+
"R2024a",
13+
"R2023b",
14+
"R2023a",
15+
"R2022b",
16+
"R2022a",
17+
"R2021b",
18+
"R2021a",
19+
"R2020b",
20+
"R2020a",
21+
"R2019b",
22+
"R2019a"
2223
],
23-
"default": "r2024a",
24+
"default": "R2024b",
2425
"description": "MATLAB Release to install."
2526
},
2627
"products": {
@@ -44,8 +45,8 @@
4445
},
4546
"destination": {
4647
"type": "string",
47-
"default": "/opt/matlab/$RELEASE",
48-
"description": "Full path to the installation destination folder."
48+
"default": "",
49+
"description": "Full path to the installation destination folder. Default: /opt/matlab/${RELEASE^}"
4950
},
5051
"installMatlabProxy": {
5152
"default": false,

src/matlab/install-helper-functions.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function ihf_get_remove_cmd() {
136136
# returns "true/false" string if MATLAB_RELEASE is valid
137137
function ihf_is_valid_matlab_release() {
138138
# List of supported MATLAB_RELEASE values
139-
local _SUPPORTED_MATLAB_RELEASES=("r2024a" "r2023b" "r2023a" "r2022b" "r2022a" "r2021b" "r2021a" "r2020b" "r2020a" "r2019b" "r2019a")
139+
local _SUPPORTED_MATLAB_RELEASES=("R2024b" "R2024a" "R2023b" "R2023a" "R2022b" "R2022a" "R2021b" "R2021a" "R2020b" "R2020a" "R2019b" "R2019a")
140140

141141
## Validate MATLAB_RELEASE
142142
if [ -z "$MATLAB_RELEASE" ]; then
@@ -289,11 +289,11 @@ function test_script() {
289289
ihf_pkg_mgr_update
290290

291291

292-
MATLAB_RELEASE=r2024a
292+
MATLAB_RELEASE=R2024a
293293
is_release_valid=$(ihf_is_valid_matlab_release)
294294
echo "Is $MATLAB_RELEASE valid? Ans: $is_release_valid"
295295

296-
MATLAB_RELEASE=r2023bd
296+
MATLAB_RELEASE=R2023bd
297297
echo "Is $MATLAB_RELEASE valid? Ans: $(ihf_is_valid_matlab_release)"
298298

299299
LINUX_DISTRO=$(ihf_is_debian_or_rhel)

src/matlab/install-matlab-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function get_prerequisite_pkgs() {
4040

4141
function get_base_dependencies_list() {
4242
local MATLAB_DEPS_OS_VERSION=$(ihf_get_matlab_deps_os)
43-
local BASE_DEPS_URL=https://raw.githubusercontent.com/mathworks-ref-arch/container-images/main/matlab-deps/${MATLAB_RELEASE}/${MATLAB_DEPS_OS_VERSION}/base-dependencies.txt
43+
local BASE_DEPS_URL=https://raw.githubusercontent.com/mathworks-ref-arch/container-images/main/matlab-deps/${MATLAB_RELEASE,}/${MATLAB_DEPS_OS_VERSION}/base-dependencies.txt
4444
# Get matlab_deps - if this fails, then we aren't on a supported os
4545
local PKGS=$(wget -qO- ${BASE_DEPS_URL})
4646
if [ -z "$PKGS" ]; then

src/matlab/install.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,28 @@ set -eu -o pipefail
1717

1818
## Set defaults to all the options in the feature.
1919

20-
# r2024a is the latest available release.
21-
RELEASE="${RELEASE:-"r2024a"}"
20+
# R2024b is the latest available release.
21+
RELEASE="${RELEASE:-"R2024b"}"
2222
PRODUCTS="${PRODUCTS:-"MATLAB"}"
2323
DOC="${DOC:-"false"}"
2424
INSTALLGPU="${INSTALLGPU:-"false"}"
25-
DESTINATION="${DESTINATION:-"/opt/matlab/${RELEASE}"}"
25+
DESTINATION="${DESTINATION:-"/opt/matlab/${RELEASE^}"}"
2626
INSTALLMATLABPROXY="${INSTALLMATLABPROXY:-"false"}"
2727
INSTALLJUPYTERMATLABPROXY="${INSTALLJUPYTERMATLABPROXY:-"false"}"
2828
INSTALLMATLABENGINEFORPYTHON="${INSTALLMATLABENGINEFORPYTHON:-"false"}"
2929
STARTINDESKTOP="${STARTINDESKTOP:-"false"}"
3030
NETWORKLICENSEMANAGER="${NETWORKLICENSEMANAGER:-" "}"
3131
SKIPMATLABINSTALL="${SKIPMATLABINSTALL:-"false"}"
3232

33-
MATLAB_RELEASE="${RELEASE}"
33+
MATLAB_RELEASE="${RELEASE^}"
3434
MATLAB_PRODUCT_LIST="${PRODUCTS}"
3535
MATLAB_INSTALL_LOCATION="${DESTINATION}"
3636

37+
echo "MATLAB_INSTALL_LOCATION: ${MATLAB_INSTALL_LOCATION}"
38+
39+
# Needed by the MATLAB Engine for Python.
40+
# Appends to any existing value of LD_LIBRARY_PATH the path where MATLAB is installed by this script.
41+
_LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+"${LD_LIBRARY_PATH}:"}${MATLAB_INSTALL_LOCATION}/bin/glnxa64"
3742

3843
_CONTAINER_USER_HOME="${_CONTAINER_USER_HOME:-"undefined"}"
3944
_CONTAINER_USER="${_CONTAINER_USER:-"undefined"}"
@@ -87,17 +92,21 @@ function install_matlab_engine_for_python() {
8792
# Installing the engine is tricky
8893
# The installation can fail if the python version does not match the supported release
8994
declare -A matlabengine_map
90-
matlabengine_map['r2024a']="24.1"
91-
matlabengine_map['r2023b']="23.2"
92-
matlabengine_map['r2023a']="9.14"
93-
matlabengine_map['r2022b']="9.13"
94-
matlabengine_map['r2022a']="9.12"
95-
matlabengine_map['r2021b']="9.11"
96-
matlabengine_map['r2021a']="9.10"
97-
matlabengine_map['r2020b']="9.9"
95+
matlabengine_map['R2024b']="24.2"
96+
matlabengine_map['R2024a']="24.1"
97+
matlabengine_map['R2023b']="23.2"
98+
matlabengine_map['R2023a']="9.14"
99+
matlabengine_map['R2022b']="9.13"
100+
matlabengine_map['R2022a']="9.12"
101+
matlabengine_map['R2021b']="9.11"
102+
matlabengine_map['R2021a']="9.10"
103+
matlabengine_map['R2020b']="9.9"
98104

99105
install_python_and_pip &&
100-
env LD_LIBRARY_PATH=${MATLAB_INSTALL_LOCATION}/bin/glnxa64 \
106+
107+
echo "Setting LD_LIBRARY_PATH=${_LD_LIBRARY_PATH}"
108+
109+
env LD_LIBRARY_PATH=${_LD_LIBRARY_PATH} \
101110
python3 -m pip install matlabengine==${matlabengine_map[$MATLAB_RELEASE]}.*
102111
}
103112

@@ -216,7 +225,7 @@ if [ "$SKIPMATLABINSTALL" != 'true' ]; then
216225

217226
# Handle GPU installation
218227
if [ "${INSTALLGPU}" == "false" ]; then
219-
RELEASES_THAT_SUPPORT_NOGPU=("r2024a" "r2023b" "r2023a")
228+
RELEASES_THAT_SUPPORT_NOGPU=("R2024b" "R2024a" "R2023b" "R2023a")
220229
# The value variable is assigned a regex that matches the exact value
221230
value="\<${MATLAB_RELEASE}\>"
222231
if [[ ${RELEASES_THAT_SUPPORT_NOGPU[@]} =~ $value ]]; then
@@ -242,6 +251,8 @@ if [ "$SKIPMATLABINSTALL" != 'true' ]; then
242251
create_home_folder_for_container_user
243252

244253
echo "Proceeding to install matlab as '$_CONTAINER_USER'..."
254+
255+
echo "Install location for MATLAB: ${MATLAB_INSTALL_LOCATION}"
245256

246257
# Switching to container user
247258
su $_CONTAINER_USER

src/matlab/tests.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
#!/usr/bin/env bash
22
# Calls conatins to test the install scripts
33

4-
# Check default installation for r2024a
5-
RELEASE=r2024a
4+
# Check default installation for R2024b
5+
RELEASE=R2024b
66
RUN_INSTALL_SCRIPT="env RELEASE=${RELEASE} /mounted/src/matlab/install.sh "
77
# TEST="python3 -m pip list | grep matlabengine && echo PASSED! || echo FAILED!"
88
docker run -it --rm --entrypoint /usr/bin/sh -v `pwd`:/mounted ubuntu:20.04 -c "$RUN_INSTALL_SCRIPT && echo PASSED! || echo FAILED!"
99

10-
RELEASE=r2022b
10+
RELEASE=R2022b
1111
RUN_INSTALL_SCRIPT="env RELEASE=${RELEASE} /mounted/src/matlab/install.sh "
1212
# TEST="python3 -m pip list | grep matlabengine && echo PASSED! || echo FAILED!"
1313
docker run -it --rm --entrypoint /usr/bin/sh -v `pwd`:/mounted registry.access.redhat.com/ubi9/ubi:latest -c "$RUN_INSTALL_SCRIPT && echo PASSED! || echo FAILED!"
1414

15-
RELEASE=r2024a
15+
RELEASE=R2024b
1616
RUN_INSTALL_SCRIPT="env RELEASE=${RELEASE} /mounted/src/matlab/install.sh "
1717
# TEST="python3 -m pip list | grep matlabengine && echo PASSED! || echo FAILED!"
1818
docker run -it --rm --entrypoint /usr/bin/bash -v `pwd`:/mounted registry.access.redhat.com/ubi9/ubi:latest
1919

20-
# RELEASE=r2024a
20+
# RELEASE=R2024a
2121
# RUN_INSTALL_SCRIPT="sudo env INSTALLMATLABENGINEFORPYTHON=true SKIPMATLABINSTALL=true _CONTAINER_USER=matlab \
2222
# _CONTAINER_USER_HOME=/home/matlab DESTINATION=/opt/matlab/${RELEASE^} RELEASE=${RELEASE} \
2323
# ~/install/install.sh "

test/matlab/check_ubi9.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#-------------------------------------------------------------------------------------------------------------
55
#
66
# This test file will be executed against one of the scenarios devcontainer.json test that
7-
# includes the 'matlab' feature with the r2024a release, and a support package installed.
7+
# includes the 'matlab' feature with the R2024a release, and a support package installed.
88
# Support package installation is special, because these packages need to be installed into
99
# the end users HOME folder and not into the root users folders. Installing into root will
1010
# result in users being unable to access the Support Packages.
@@ -21,7 +21,7 @@
2121
# "upgradePackages": "true"
2222
# },
2323
# "matlab": {
24-
# "release": "r2024a",
24+
# "release": "R2024a",
2525
# "products": "MATLAB MATLAB_Support_Package_for_Android_Sensors",
2626
# "startInDesktop": "test"
2727
# }
@@ -50,10 +50,10 @@ source dev-container-features-test-lib
5050
# Verify that the right release is installed in the expected location.
5151
check "is ubi9 " bash -c "cat /etc/os-release | grep 'ID.*rhel' "
5252

53-
check "r2024a is installed" bash -c "cat /opt/matlab/r2024a/VersionInfo.xml | grep '<release>R2023b</release>'"
53+
check "R2024a is installed" bash -c "cat /opt/matlab/R2024a/VersionInfo.xml | grep '<release>R2024a</release>'"
5454

5555
# Verify MATLAB_Support_Package_for_Android_Sensors is installed at the right place (ie: The home folder for the containerUser : vscode )
56-
check "support package is installed" bash -c "cat /home/vscode/Documents/MATLAB/SupportPackages/R2023b/ssiSearchFolders | head -1 | grep 'toolbox/matlab/hardware/shared/hwsdk'"
56+
check "support package is installed" bash -c "cat /home/vscode/Documents/MATLAB/SupportPackages/R2024a/ssiSearchFolders | head -1 | grep 'toolbox/matlab/hardware/shared/hwsdk'"
5757

5858

5959
check "python3 is installed" python3 --version

test/matlab/install_matlab_engine_for_python.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#
66
# This test file will be executed against one of the scenarios devcontainer.json test that
77
# includes the 'matlab' feature with
8-
# "image": "mathworks/matlab:r2024a",
8+
# "image": "mathworks/matlab:R2024a",
99
# "features": {
1010
# "matlab": {
11-
# "destination": "/opt/matlab/R2023b",
11+
# "destination": "/opt/matlab/R2024a",
1212
# "skipMATLABInstall": true,
1313
# "installMatlabEngineForPython": true
1414
# }
@@ -44,7 +44,7 @@ reportResults
4444

4545

4646
#### Commands to test in container:
47-
# RELEASE=r2024a
47+
# RELEASE=R2024a
4848
# RUN_INSTALL_SCRIPT="sudo env INSTALLMATLABENGINEFORPYTHON=true SKIPMATLABINSTALL=true _CONTAINER_USER=matlab \
4949
# _CONTAINER_USER_HOME=/home/matlab DESTINATION=/opt/matlab/${RELEASE^} RELEASE=${RELEASE} \
5050
# ~/install/install.sh "
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
check "r2022b is installed" bash -c "cat /opt/matlab/R2022b/VersionInfo.xml | grep '<release>R2022b</release>'"
8+
9+
# Report results
10+
# If any of the checks above exited with a non-zero exit code, the test will fail.
11+
reportResults

0 commit comments

Comments
 (0)