matlab-proxy 0.24.1__py3-none-any.whl → 0.24.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of matlab-proxy might be problematic. Click here for more details.

matlab_proxy/settings.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2024 The MathWorks, Inc.
1
+ # Copyright 2020-2025 The MathWorks, Inc.
2
2
 
3
3
  import datetime
4
4
  import os
@@ -47,7 +47,7 @@ def get_process_startup_timeout():
47
47
  return int(custom_startup_timeout)
48
48
 
49
49
  else:
50
- logger.warn(
50
+ logger.warning(
51
51
  f"The value set for {mwi_env.get_env_name_process_startup_timeout()}:{custom_startup_timeout} is not a number. Using {constants.DEFAULT_PROCESS_START_TIMEOUT} as the default value"
52
52
  )
53
53
  return constants.DEFAULT_PROCESS_START_TIMEOUT
@@ -74,7 +74,7 @@ def get_matlab_executable_and_root_path():
74
74
  matlab_root_path = Path(custom_matlab_root_path)
75
75
 
76
76
  # Terminate process if invalid Custom Path was provided!
77
- mwi.validators.validate_matlab_root_path(
77
+ matlab_root_path = mwi.validators.validate_matlab_root_path(
78
78
  matlab_root_path, is_custom_matlab_root=True
79
79
  )
80
80
 
@@ -101,10 +101,9 @@ def get_matlab_executable_and_root_path():
101
101
 
102
102
  # Control only gets here if custom matlab root was not set AND which matlab returned no results.
103
103
  # Note, error messages are formatted as multi-line strings and the front end displays them as is.
104
- error_message = "Unable to find MATLAB on the system PATH. Add MATLAB to the system PATH, and restart matlab-proxy."
105
-
106
- logger.error(error_message)
107
- raise MatlabInstallError(error_message)
104
+ raise MatlabInstallError(
105
+ "Unable to find MATLAB on the system PATH. Add MATLAB to the system PATH, and restart matlab-proxy."
106
+ )
108
107
 
109
108
 
110
109
  def get_matlab_version(matlab_root_path):
@@ -126,7 +125,16 @@ def get_matlab_version(matlab_root_path):
126
125
  tree = ET.parse(version_info_file_path)
127
126
  root = tree.getroot()
128
127
 
129
- return root.find("release").text
128
+ matlab_version = root.find("release").text
129
+
130
+ # If the matlab on system PATH is a wrapper script, then it would not be possible to determine MATLAB root (inturn not being able to determine MATLAB version)
131
+ # unless MWI_CUSTOM_MATLAB_ROOT is set. Raising only a warning as the matlab version is only required for communicating with MHLM.
132
+ if not matlab_version:
133
+ logger.warning(
134
+ f"Could not determine MATLAB version from MATLAB root path: {matlab_root_path}. Set {mwi_env.get_env_name_custom_matlab_root()} to a valid MATLAB root path"
135
+ )
136
+
137
+ return matlab_version
130
138
 
131
139
 
132
140
  def get_ws_env_settings():
@@ -270,15 +278,7 @@ def get(config_name=matlab_proxy.get_default_config_name(), dev=False):
270
278
  logger.warning(warning)
271
279
  settings["warnings"].append(warning)
272
280
 
273
- try:
274
- # Update settings with matlab specific values.
275
- settings.update(get_matlab_settings())
276
- except UIVisibleFatalError as error:
277
- logger.error(f"Exception raised during initialization: {error}")
278
- settings["error"] = error
279
- # Exceptions of this kind must propagate to the UI.
280
- # Returning settings that have been created without exceptions
281
- pass
281
+ settings.update(get_matlab_settings())
282
282
 
283
283
  return settings
284
284
 
@@ -362,84 +362,33 @@ def get_matlab_settings():
362
362
  Unless they are of type UIVisibleFatalError
363
363
  """
364
364
 
365
- matlab_executable_path, matlab_root_path = get_matlab_executable_and_root_path()
366
-
367
365
  ws_env, ws_env_suffix = get_ws_env_settings()
366
+ mw_licensing_urls = _get_mw_licensing_urls(ws_env_suffix)
367
+ nlm_conn_str = _get_nlm_conn_str()
368
+ has_custom_code_to_execute, code_to_execute = _get_matlab_code_to_execute()
369
+ err = None
368
370
 
369
- # MATLAB Proxy gives precedence to the licensing information conveyed
370
- # by the user. If MLM_LICENSE_FILE is set, it should be prioritised over
371
- # other ways of licensing. But existence of license_info.xml in matlab/licenses
372
- # folder may cause hinderance in this workflow. So specifying -licmode as 'file'
373
- # overrides license_info.xml and enforces MLM_LICENSE_FILE to be the topmost priority
374
-
375
- # NLM Connection String provided by MLM_LICENSE_FILE environment variable
376
- nlm_conn_str = mwi.validators.validate_mlm_license_file(
377
- os.environ.get(mwi_env.get_env_name_network_license_manager())
378
- )
379
- matlab_lic_mode = ["-licmode", "file"] if nlm_conn_str else ""
380
- # flag to hide MATLAB Window
381
- flag_to_hide_desktop = ["-nodesktop"]
382
- if system.is_windows():
383
- flag_to_hide_desktop.extend(["-noDisplayDesktop", "-wait", "-log"])
371
+ try:
372
+ matlab_executable_path, matlab_root_path = get_matlab_executable_and_root_path()
384
373
 
385
- matlab_code_dir = Path(__file__).resolve().parent / "matlab"
386
- matlab_startup_file = str(matlab_code_dir / "startup.m")
387
- matlab_code_file = str(matlab_code_dir / "evaluateUserMatlabCode.m")
374
+ except UIVisibleFatalError as error:
375
+ logger.error(f"Exception raised during initialization: {error}")
376
+ # Set matlab root and executable path to None as MATLAB root could not be determined
377
+ matlab_executable_path = matlab_root_path = None
378
+ err = error
388
379
 
389
380
  matlab_version = get_matlab_version(matlab_root_path)
390
-
391
- # If the matlab on system PATH is a wrapper script, then it would not be possible to determine MATLAB root (inturn not being able to determine MATLAB version)
392
- # unless MWI_CUSTOM_MATLAB_ROOT is set. Raising only a warning as the matlab version is only required for communicating with MHLM.
393
- if not matlab_version:
394
- logger.warn(
395
- f"Could not determine MATLAB version from MATLAB root path: {matlab_root_path}"
396
- )
397
- logger.warn(
398
- f"Set {mwi_env.get_env_name_custom_matlab_root()} to a valid MATLAB root path"
399
- )
400
-
401
- mpa_flags = (
402
- mwi_env.Experimental.get_mpa_flags()
403
- if mwi_env.Experimental.is_mpa_enabled()
404
- else ""
405
- )
406
- profile_matlab_startup = (
407
- "-timing" if mwi_env.Experimental.is_matlab_startup_profiling_enabled() else ""
408
- )
409
-
410
- has_custom_code_to_execute = (
411
- len(os.getenv(mwi_env.get_env_name_custom_matlab_code(), "").strip()) > 0
412
- )
413
-
414
- # Sanitize file paths to avoid MATLAB not running the script due to early breakup of character array.
415
- mp_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_startup_file)}'); catch MATLABProxyInitializationError; disp(MATLABProxyInitializationError.message); end;"
416
- custom_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_code_file)}'); catch MATLABCustomStartupCodeError; disp(MATLABCustomStartupCodeError.message); end;"
417
- code_to_execute = (
418
- mp_code_to_execute + custom_code_to_execute
419
- if has_custom_code_to_execute
420
- else mp_code_to_execute
421
- )
381
+ matlab_version_determined_on_startup = bool(matlab_version)
382
+ matlab_cmd = _get_matlab_cmd(matlab_executable_path, code_to_execute, nlm_conn_str)
422
383
 
423
384
  return {
424
- "matlab_path": matlab_root_path,
385
+ "error": err,
425
386
  "matlab_version": matlab_version,
426
- "matlab_version_determined_on_startup": True if matlab_version else False,
427
- "matlab_cmd": [
428
- matlab_executable_path,
429
- "-nosplash",
430
- *flag_to_hide_desktop,
431
- "-softwareopengl",
432
- # " v=mvm ",
433
- *matlab_lic_mode,
434
- *mpa_flags,
435
- profile_matlab_startup,
436
- "-r",
437
- code_to_execute,
438
- ],
387
+ "matlab_path": matlab_root_path,
388
+ "matlab_version_determined_on_startup": matlab_version_determined_on_startup,
389
+ "matlab_cmd": matlab_cmd,
439
390
  "ws_env": ws_env,
440
- "mwa_api_endpoint": f"https://login{ws_env_suffix}.mathworks.com/authenticationws/service/v4",
441
- "mhlm_api_endpoint": f"https://licensing{ws_env_suffix}.mathworks.com/mls/service/v1/entitlement/list",
442
- "mwa_login": f"https://login{ws_env_suffix}.mathworks.com",
391
+ **mw_licensing_urls,
443
392
  "nlm_conn_str": nlm_conn_str,
444
393
  "has_custom_code_to_execute": has_custom_code_to_execute,
445
394
  }
@@ -646,3 +595,104 @@ def _sanitize_file_path_for_matlab(filepath: str) -> str:
646
595
  """
647
596
  filepath_with_single_quotes_escaped = filepath.replace("'", "''")
648
597
  return filepath_with_single_quotes_escaped
598
+
599
+
600
+ def _get_matlab_code_to_execute():
601
+ """Returns the code that needs to run on MATLAB startup.
602
+ Will check for user provided custom MATLAB code and execute it along with the default startup script.
603
+
604
+ Returns:
605
+ tuple: With the first value representing whether there is custom MATLAB code to execute, and the second value representing the MATLAB code to execute.
606
+ """
607
+ matlab_code_dir = Path(__file__).resolve().parent / "matlab"
608
+ matlab_startup_file = str(matlab_code_dir / "startup.m")
609
+ matlab_code_file = str(matlab_code_dir / "evaluateUserMatlabCode.m")
610
+
611
+ has_custom_code_to_execute = (
612
+ len(os.getenv(mwi_env.get_env_name_custom_matlab_code(), "").strip()) > 0
613
+ )
614
+
615
+ # Sanitize file paths to avoid MATLAB not running the script due to early breakup of character array.
616
+ mp_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_startup_file)}'); catch MATLABProxyInitializationError; disp(MATLABProxyInitializationError.message); end;"
617
+ custom_code_to_execute = f"try; run('{_sanitize_file_path_for_matlab(matlab_code_file)}'); catch MATLABCustomStartupCodeError; disp(MATLABCustomStartupCodeError.message); end;"
618
+ code_to_execute = (
619
+ mp_code_to_execute + custom_code_to_execute
620
+ if has_custom_code_to_execute
621
+ else mp_code_to_execute
622
+ )
623
+
624
+ return has_custom_code_to_execute, code_to_execute
625
+
626
+
627
+ def _get_nlm_conn_str():
628
+ """Get the Network License Manager (NLM) connection string.
629
+
630
+ Returns:
631
+ str: The NLM connection string provided by the MLM_LICENSE_FILE environment variable.
632
+ """
633
+ # NLM Connection String provided by MLM_LICENSE_FILE environment variable
634
+ nlm_conn_str = mwi.validators.validate_mlm_license_file(
635
+ os.environ.get(mwi_env.get_env_name_network_license_manager())
636
+ )
637
+
638
+ return nlm_conn_str
639
+
640
+
641
+ def _get_mw_licensing_urls(ws_env_suffix):
642
+ """Get the MathWorks licensing URLs.
643
+
644
+ Args:
645
+ ws_env_suffix (str): The environment suffix for the licensing URLs.
646
+
647
+ Returns:
648
+ dict: A dictionary containing the MathWorks licensing URLs for authentication and entitlement.
649
+ """
650
+ return {
651
+ "mwa_api_endpoint": f"https://login{ws_env_suffix}.mathworks.com/authenticationws/service/v4",
652
+ "mhlm_api_endpoint": f"https://licensing{ws_env_suffix}.mathworks.com/mls/service/v1/entitlement/list",
653
+ "mwa_login": f"https://login{ws_env_suffix}.mathworks.com",
654
+ }
655
+
656
+
657
+ def _get_matlab_cmd(matlab_executable_path, code_to_execute, nlm_conn_str):
658
+ """Construct the MATLAB command with appropriate flags and arguments.
659
+
660
+ Args:
661
+ matlab_executable_path (str): The path to the MATLAB executable.
662
+ code_to_execute (str): The MATLAB code to execute on startup.
663
+ nlm_conn_str (str): The Network License Manager connection string.
664
+
665
+ Returns:
666
+ list: A list of command-line arguments to launch MATLAB with the specified configuration.
667
+ """
668
+ if not matlab_executable_path:
669
+ return None
670
+
671
+ matlab_lic_mode = ["-licmode", "file"] if nlm_conn_str else ""
672
+ # flag to hide MATLAB Window
673
+ flag_to_hide_desktop = ["-nodesktop"]
674
+ if system.is_windows():
675
+ flag_to_hide_desktop.extend(["-noDisplayDesktop", "-wait", "-log"])
676
+
677
+ mpa_flags = (
678
+ mwi_env.Experimental.get_mpa_flags()
679
+ if mwi_env.Experimental.is_mpa_enabled()
680
+ else ""
681
+ )
682
+
683
+ profile_matlab_startup = (
684
+ "-timing" if mwi_env.Experimental.is_matlab_startup_profiling_enabled() else ""
685
+ )
686
+
687
+ return [
688
+ matlab_executable_path,
689
+ "-nosplash",
690
+ *flag_to_hide_desktop,
691
+ "-softwareopengl",
692
+ # " v=mvm ",
693
+ *matlab_lic_mode,
694
+ *mpa_flags,
695
+ profile_matlab_startup,
696
+ "-r",
697
+ code_to_execute,
698
+ ]
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2024 The MathWorks, Inc.
1
+ # Copyright 2020-2025 The MathWorks, Inc.
2
2
  """This file contains validators for various runtime artifacts.
3
3
  A validator is defined as a function which verifies the input and
4
4
  returns it unchanged if validation passes.
@@ -320,9 +320,10 @@ def validate_matlab_root_path(matlab_root: Path, is_custom_matlab_root: bool):
320
320
  Raises:
321
321
  MatlabInstallError
322
322
  """
323
- warn_string = ""
324
- if is_custom_matlab_root:
325
- warn_string += f"""Edit the environment variable {mwi_env.get_env_name_custom_matlab_root()} to the correct path, and restart matlab-proxy."""
323
+
324
+ # When Custom MATLAB root is provided, validate the existence of the
325
+ # VersionInfo.xml file at the specified path else, its optional (for matlab wrapper usecase)
326
+ custom_matlab_root_warn_str = f"Edit the environment variable {mwi_env.get_env_name_custom_matlab_root()} to the correct path, and restart matlab-proxy. "
326
327
 
327
328
  try:
328
329
  __validate_if_paths_exist([matlab_root])
@@ -332,18 +333,25 @@ def validate_matlab_root_path(matlab_root: Path, is_custom_matlab_root: bool):
332
333
 
333
334
  except OSError as exc:
334
335
  logger.error(". ".join(exc.args))
335
- raise MatlabInstallError(warn_string)
336
+ raise MatlabInstallError(
337
+ custom_matlab_root_warn_str if is_custom_matlab_root else ""
338
+ )
336
339
 
337
340
  version_info_file_path = matlab_root / VERSION_INFO_FILE_NAME
338
341
 
339
342
  if not version_info_file_path.is_file():
340
- log_warn_string = (
341
- warn_string + f"Unable to locate {VERSION_INFO_FILE_NAME} at {matlab_root}"
342
- )
343
- logger.warn(log_warn_string)
343
+ warn_str = f"Unable to locate {VERSION_INFO_FILE_NAME} at {matlab_root}"
344
+ # If VersionInfo.xml file is missing when a custom MATLAB root is provided, then
345
+ # raise an error with a detailed message
346
+ if is_custom_matlab_root:
347
+ log_error_string = custom_matlab_root_warn_str + warn_str
348
+ raise MatlabInstallError(log_error_string)
344
349
 
345
- # Returning None as matlab_root could not be determined
346
- return None
350
+ else:
351
+ # No VersionInfo.xml file is present and its not a custom MATLAB root, implies a matlab wrapper is
352
+ # being used, so warn the user and return None as MATLAB root could not be determined
353
+ logger.warning(warn_str)
354
+ return None
347
355
 
348
356
  return matlab_root
349
357
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: matlab-proxy
3
- Version: 0.24.1
3
+ Version: 0.24.2
4
4
  Summary: Python® package enables you to launch MATLAB® and access it from a web browser.
5
5
  Home-page: https://github.com/mathworks/matlab-proxy/
6
6
  Author: The MathWorks, Inc.
@@ -103,7 +103,7 @@ python -m pip install matlab-proxy
103
103
  ```
104
104
 
105
105
  ### Building From Sources
106
- Building from sources requires Node.js® version 16 or higher. [Click here to install Node.js](https://nodejs.org/en/)
106
+ Building from sources requires Node.js® version 18 or higher. [Click here to install Node.js](https://nodejs.org/en/)
107
107
 
108
108
  ```bash
109
109
  git clone https://github.com/mathworks/matlab-proxy.git
@@ -1,20 +1,20 @@
1
1
  matlab_proxy/__init__.py,sha256=6cwi8buKCMtw9OeWaOYUHEoqwl5MyJ_s6GxgNuqPuNg,1673
2
2
  matlab_proxy/app.py,sha256=7BsHSM3PxTjN6eN10HLj74Y1wtu-Gl92g1RLbaTGz9U,34698
3
- matlab_proxy/app_state.py,sha256=KO2aczGbTnIMoXVqHJEriEyeapYHU_sDXifwA5U3kTw,72077
3
+ matlab_proxy/app_state.py,sha256=e1AnmZ22gegzZ9N26Ha-IQR1ZhDukNC_LAQYP5k09Lc,72542
4
4
  matlab_proxy/constants.py,sha256=L9fhXdcGH7Eu56h0aB_TNm3d6aNFr2nP6-HyQJ96TAA,1175
5
5
  matlab_proxy/default_configuration.py,sha256=tBHaEq_bYsX2uC9pPA9mi_8M6o94ij-rxq8mbvcYpFc,1874
6
6
  matlab_proxy/devel.py,sha256=nR6XPVBUEdQ-RZGtYvX1YHTp8gj9cuw5Hp8ahasMBc8,14310
7
- matlab_proxy/settings.py,sha256=ni-9zNbWF3cy4v0X8vAwAiM5WcC8U_t3a-s7GXIkyBA,26723
7
+ matlab_proxy/settings.py,sha256=-_r5JtUfuid6CUydRYTb_0rsAF4z2AzBqieAc65tQ8Y,28109
8
8
  matlab_proxy/gui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  matlab_proxy/gui/favicon.ico,sha256=7w7Ki1uQP2Rgwc64dOV4-NrTu97I3WsZw8OvRSoY1A0,130876
10
- matlab_proxy/gui/index.html,sha256=6SxjZB0znU7vcLRnk4avZIzdOqlFBFt-zaNC8qhxIr0,720
10
+ matlab_proxy/gui/index.html,sha256=R-jJ3X8sD0wD4OEsS6esTybLzO6l7jizBsMvwdvCDs8,720
11
11
  matlab_proxy/gui/manifest.json,sha256=NwDbrALM5auYyj2bbEf4aGwAUDqNl1FzMFQpPiG2Ty4,286
12
12
  matlab_proxy/gui/robots.txt,sha256=kNJLw79pisHhc3OVAimMzKcq3x9WT6sF9IS4xI0crdI,67
13
13
  matlab_proxy/gui/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  matlab_proxy/gui/static/css/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
15
  matlab_proxy/gui/static/css/index.BSVLACuY.css,sha256=LzuRvV10Z0pF0ugGSnj5zKJvT4AHwwBbCd-wSH4mHjg,305333
16
16
  matlab_proxy/gui/static/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- matlab_proxy/gui/static/js/index.Cm14Eqsb.js,sha256=mcaB_Rp1rvj4mdHLEWC3s3dZhDKTBuYOFXSg8e-B68o,280210
17
+ matlab_proxy/gui/static/js/index.c3NLxnRM.js,sha256=VsDAyIfCMENbdJIcG2416ttyvYg8rmSqI_ogax2bIio,280258
18
18
  matlab_proxy/gui/static/media/MATLAB-env-blur.NupTbPv_.png,sha256=QpmQTLDvBu2-b7ev83Rvpt0Q72R6wdQGkuJMPPpjv7M,220290
19
19
  matlab_proxy/gui/static/media/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  matlab_proxy/gui/static/media/glyphicons-halflings-regular.BKjkU69z.woff,sha256=omOU9-3hAMoRjv8u2ghZYnWpg5uVnCJuFUOVV6WoB0I,23424
@@ -52,7 +52,7 @@ matlab_proxy/util/mwi/environment_variables.py,sha256=sOfmL8PjQONgkJdegdotLbsqHs
52
52
  matlab_proxy/util/mwi/exceptions.py,sha256=3jklFU6br2_pSSsATCRDY3A5fTzk6ekJ4M69sunwxBk,5114
53
53
  matlab_proxy/util/mwi/logger.py,sha256=GoisSphy3Jyi5-6-X0WRl1YkdrKx2xzjSxBN_w3oTU8,3802
54
54
  matlab_proxy/util/mwi/token_auth.py,sha256=UbIWqo7qADaZdijFvorLYsZbxzaB8TycGP8nk305ru0,9997
55
- matlab_proxy/util/mwi/validators.py,sha256=iXPR7b3jtnwx2i15YxKQgmOm2pt3ujJeMGYNxY0oGGw,12633
55
+ matlab_proxy/util/mwi/validators.py,sha256=dg2OXL686vWie_JoTNpFSje2m_UqdpvpTVHJl5tmxSo,13247
56
56
  matlab_proxy/util/mwi/embedded_connector/__init__.py,sha256=Vfl2hNC7V1IwoK9_wrwfENs4BC8P-Mvvqh4BNGi2n48,119
57
57
  matlab_proxy/util/mwi/embedded_connector/helpers.py,sha256=kpIgJN0AqYLeX56UylWgB0t07fg8sh0RhIlUH_8JitM,3654
58
58
  matlab_proxy/util/mwi/embedded_connector/request.py,sha256=RXoVvrm5fibVb2A6EZnkMWwAQkYX3J5kqDTGQDZo9p0,4316
@@ -86,12 +86,12 @@ tests/integration/utils/licensing.py,sha256=rEBjvMXO8R3mL6KnePu2lojmOsjD4GXl9frf
86
86
  tests/unit/__init__.py,sha256=KfwQxxM5a1kMRtNbhz8tb7YfHp8e2d0tNLB55wYvDS8,37
87
87
  tests/unit/conftest.py,sha256=FIL7bhw2-9B5OEspqt9toZ2ZlN18pOsPEFjeQmVNcSk,1916
88
88
  tests/unit/test_app.py,sha256=pM8zVyXWLx8nP8RePusXH4admEBYKc5JC8eE2t8xIQE,38487
89
- tests/unit/test_app_state.py,sha256=HuRs4ofCviS_N8Nj71_KkB3OrEf8aqHsA0SZlUreQPc,37110
89
+ tests/unit/test_app_state.py,sha256=pIO3hvpddetf4xAdAum05gKfZ0TTS-LAEq-c57h_f40,37961
90
90
  tests/unit/test_constants.py,sha256=2nXxTmDP8utr8krsfZ4c_Bh4_mWPcDO5uI8MXeq4Usg,158
91
91
  tests/unit/test_ddux.py,sha256=a2J2iM8j_nnfJVuMI38p5AjwrRdoMj3N88gFgS2I4hg,713
92
92
  tests/unit/test_devel.py,sha256=A-1iVhSSwmywaW65QIRcUS2Fk7nJxceCcCm7CJtNdEc,7982
93
93
  tests/unit/test_non_dev_mode.py,sha256=0v27y27SLOWvw6jf_GhLLNg-RMsZS_OyGAnqoQYPpSA,5515
94
- tests/unit/test_settings.py,sha256=eBlV-ME_O8oLoOjJqqYTDTXJs-0smnM0oIMwHZEjUbo,17727
94
+ tests/unit/test_settings.py,sha256=SsWLOzossGCjRr8555clsBvDI4Z0jPE4JVhjhx7Ovno,23722
95
95
  tests/unit/util/__init__.py,sha256=GInSQBb2SoVD5LZfmSCQa9-UZJT_UP-jNfrojkgCybU,87
96
96
  tests/unit/util/test_mw.py,sha256=YC4mjn6G6_XuHELt8uW9F6g2K0_fWtQl1R0kWFvWbAo,18565
97
97
  tests/unit/util/test_util.py,sha256=gecUFSVIg4a9s3Ljl0A7eSSY5jN4vH668CbjnTpi198,7431
@@ -100,15 +100,15 @@ tests/unit/util/mwi/test_custom_http_headers.py,sha256=UfrhclS0j6WhShtg1ki2oF1kK
100
100
  tests/unit/util/mwi/test_download.py,sha256=jYwPJFYGrPKqnkIJW42XYSe1fowmzChAkOx0k0xVldo,4779
101
101
  tests/unit/util/mwi/test_logger.py,sha256=S0Q5TirFxysrH2YSxRzGY9mWoWB83hG3q3XpGENCpcw,3150
102
102
  tests/unit/util/mwi/test_token_auth.py,sha256=-eBsaQ5JC7pyd9PXt48Rqs4cWjg6I-eOkp_gFVEwYhk,10538
103
- tests/unit/util/mwi/test_validators.py,sha256=lJy9rEXCULRrp9wxv9KXUjtlTFbchqTefxGLUg_n3S8,11452
103
+ tests/unit/util/mwi/test_validators.py,sha256=GvLP3lSvoOQAjoclYunKPfxPIagUsnVGHRskHELResE,11765
104
104
  tests/unit/util/mwi/embedded_connector/__init__.py,sha256=pl5jqyCHEwZEviiL8OC-SHulb1rBecstQCFF6qVjL9Y,37
105
105
  tests/unit/util/mwi/embedded_connector/test_helpers.py,sha256=vYTWNUTuDeaygo16JGMTvWeI_CLOnvPkwNJmLndvJhE,890
106
106
  tests/unit/util/mwi/embedded_connector/test_request.py,sha256=PR-jddnXDEiip-lD7A_QSvRwEkwo3eQ8owZlk-r9vnk,1867
107
107
  tests/utils/__init__.py,sha256=ttzJ8xKWGxOJZz56qOiWOn6sp5LGomkZMn_w4KJLRMU,42
108
108
  tests/utils/logging_util.py,sha256=VBy_NRvwau3C_CVTBjK5RMROrQimnJYHO2U0aKSZiRw,2234
109
- matlab_proxy-0.24.1.dist-info/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
110
- matlab_proxy-0.24.1.dist-info/METADATA,sha256=4MRz3xe4BjJtlDV-2KJ07wl-lP-QsE-o64F2u5FZk4U,10199
111
- matlab_proxy-0.24.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
112
- matlab_proxy-0.24.1.dist-info/entry_points.txt,sha256=ZAlCUsgKzGcAeQaMZOq31FrTB5tQ8Ypq8Op_8U600-A,305
113
- matlab_proxy-0.24.1.dist-info/top_level.txt,sha256=KF-347aoRGsfHTpiSqfIPUZ95bzK5-oMIu8S_TUcu-w,40
114
- matlab_proxy-0.24.1.dist-info/RECORD,,
109
+ matlab_proxy-0.24.2.dist-info/LICENSE.md,sha256=oF0h3UdSF-rlUiMGYwi086ZHqelzz7yOOk9HFDv9ELo,2344
110
+ matlab_proxy-0.24.2.dist-info/METADATA,sha256=ysaPplN9gudFA9lO3lByAYn2Gm1p9TVJ_gruq8HPU6U,10199
111
+ matlab_proxy-0.24.2.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
112
+ matlab_proxy-0.24.2.dist-info/entry_points.txt,sha256=ZAlCUsgKzGcAeQaMZOq31FrTB5tQ8Ypq8Op_8U600-A,305
113
+ matlab_proxy-0.24.2.dist-info/top_level.txt,sha256=KF-347aoRGsfHTpiSqfIPUZ95bzK5-oMIu8S_TUcu-w,40
114
+ matlab_proxy-0.24.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
- # Copyright 2023-2024 The MathWorks, Inc.
1
+ # Copyright 2023-2025 The MathWorks, Inc.
2
2
 
3
3
  import asyncio
4
4
  import json
@@ -13,7 +13,11 @@ from matlab_proxy import settings
13
13
  from matlab_proxy import settings
14
14
  from matlab_proxy.app_state import AppState
15
15
  from matlab_proxy.constants import MWI_AUTH_TOKEN_NAME_FOR_HTTP
16
- from matlab_proxy.util.mwi.exceptions import LicensingError, MatlabError
16
+ from matlab_proxy.util.mwi.exceptions import (
17
+ LicensingError,
18
+ MatlabError,
19
+ MatlabInstallError,
20
+ )
17
21
  from matlab_proxy.constants import (
18
22
  CONNECTOR_SECUREPORT_FILENAME,
19
23
  USER_CODE_OUTPUT_FILE_NAME,
@@ -611,6 +615,29 @@ async def test_start_matlab_without_xvfb(app_state_fixture, mocker):
611
615
  assert app_state_fixture.processes["matlab"] is mock_matlab
612
616
 
613
617
 
618
+ async def test_start_matlab_without_xvfb_and_matlab(app_state_fixture):
619
+ """Test to check if MATLAB doesn't start and sets the error variable to MatlabInstallError when
620
+ there is not MATLAB on system PATH
621
+
622
+ Args:
623
+ app_state_fixture (AppState): Object of AppState class with defaults set
624
+ """
625
+ # Arrange
626
+ app_state_fixture.settings["is_xvfb_available"] = False
627
+ app_state_fixture.settings["matlab_cmd"] = None
628
+
629
+ # Act
630
+ await app_state_fixture.start_matlab()
631
+
632
+ # Assert
633
+ # Check if Xvfb has not started
634
+ assert app_state_fixture.processes["xvfb"] is None
635
+ # Check if Matlab has not started
636
+ assert app_state_fixture.processes["matlab"] is None
637
+ # Check if MatlabInstallError is set as the error
638
+ assert isinstance(app_state_fixture.error, MatlabInstallError)
639
+
640
+
614
641
  @pytest.mark.parametrize(
615
642
  "is_desktop, client_id, is_client_id_present, expected_is_active_client",
616
643
  [