pymss 2.3.1__tar.gz → 2.3.2__tar.gz
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.
- {pymss-2.3.1 → pymss-2.3.2}/PKG-INFO +1 -1
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/install.py +16 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/PKG-INFO +1 -1
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/SOURCES.txt +1 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/_engine.py +2 -1
- {pymss-2.3.1 → pymss-2.3.2}/pyproject.toml +1 -1
- pymss-2.3.2/test/test_plugin_macos_attributes.py +82 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_management.py +50 -0
- {pymss-2.3.1 → pymss-2.3.2}/LICENSE +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/README.md +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/__main__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/_builtin_node_types.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/_identifiers.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/audio_io.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/audio_services.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/cli.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/config.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/ensemble.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/builtin_nodes.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/comfy_loader.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/core.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/nodes.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/runner.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/graph/yaml_compiler.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/logger.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/model_download.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/model_registry.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/_core_shims.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/common_separator.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/uvr_lib_v5/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/uvr_lib_v5/spec_utils.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/vr_mlx.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/vr_models.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/modules/vocal_remover/vr_separator.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/_command_bootstrap.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/_command_process.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/_profile_lock.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/_python_entry.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/_rpc_session.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/builtins.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/command.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/files.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/graph_bridge.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/host_services.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/kit_builtins.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/python_profiles.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/operations/rpc_process.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/builtins.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/codecs.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/graph_ops.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/kit.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/lifecycle.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/loader.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/manifest.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/marketplace.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/registry.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/service.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/plugins/sources.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/progress.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/model_catalog.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr16000_hl512.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr32000_hl512.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr33075_hl384.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr44100_hl1024.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr44100_hl256.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr44100_hl512.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr44100_hl512_cut.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/1band_sr44100_hl512_nf1024.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/2band_32000.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/2band_44100_lofi.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/2band_48000.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/3band_44100.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/3band_44100_mid.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/3band_44100_msb2.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100_mid.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100_msb.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100_msb2.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100_reverse.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_44100_sw.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_v2.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_v2_sn.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_v3.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_v3_sn.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/resources/vr_modelparams/4band_v4_ms_fullband.json +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/separator.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/app.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/audio.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/config.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/errors.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/models.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/state.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/index-C2f3RgYK.js +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/index-Dd_kG96D.css +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-cyrillic-ext-wght-normal-DSNfmdVt.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-cyrillic-wght-normal-B2hlT84T.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-devanagari-wght-normal-Cv-Vwajv.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-greek-ext-wght-normal-12T8GTDR.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-greek-wght-normal-Ymb6dZNd.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-latin-ext-wght-normal-W1qJv59z.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-latin-wght-normal-BYSzYMf3.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/assets/noto-sans-vietnamese-wght-normal-DLTJy58D.woff2 +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/server/webui_static/index.html +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/user_models.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/utils.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss/workflow.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/dependency_links.txt +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/entry_points.txt +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/requires.txt +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss.egg-info/top_level.txt +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/LICENSE +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/NOTICE +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/__init__.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/cli.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/context.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/environment.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/inventory.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/leases.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/locks.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/profiles.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/pymss_plugin_manager/service.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/setup.cfg +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_all.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_downmix.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_formats.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_layout_metadata.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_materialization.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_resample.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_audio_services.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_builtin_capabilities.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_builtin_operations.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_codec_capabilities.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_command_bootstrap.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_command_operations.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_command_process.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_core_shims.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_audio_merge.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_custom_models.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_execution_events.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_lifecycle.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_resample_service.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_graph_runner_lifecycle.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_kit_builtins.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_legacy_loudnorm_node.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_mlx_warmup.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_model_catalog_overrides.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_model_detection.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_model_download_progress.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_npu_runtime.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_operation_graph_bridge.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_operation_invocation.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_operations.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_overlap_finalize.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_environment.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_kit.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_marketplace.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_node_contract.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_protocol.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_protocol_posix.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugin_sources.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_plugins.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_polarformer.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_progress.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_python_profiles.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_rpc_declarations.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_rpc_process.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_separator_channels.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_separator_device_defaults.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_use_amp.py +0 -0
- {pymss-2.3.1 → pymss-2.3.2}/test/test_workflow.py +0 -0
|
@@ -56,6 +56,21 @@ class InstallError(Exception):
|
|
|
56
56
|
"""Raised when a plugin install fails."""
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
def _clear_macos_attributes(plugin_dir: Path) -> None:
|
|
60
|
+
"""Clear attributes on the acquired copy before it can be loaded or published."""
|
|
61
|
+
if sys.platform != "darwin":
|
|
62
|
+
return
|
|
63
|
+
try:
|
|
64
|
+
# -s operates on symlinks themselves so recursive cleanup stays in this copy.
|
|
65
|
+
subprocess.run(
|
|
66
|
+
["/usr/bin/xattr", "-rc", "-s", str(plugin_dir.absolute())],
|
|
67
|
+
check=True, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=30,
|
|
68
|
+
)
|
|
69
|
+
except (OSError, subprocess.SubprocessError) as error:
|
|
70
|
+
detail = (error.stderr or str(error)) if isinstance(error, subprocess.CalledProcessError) else str(error)
|
|
71
|
+
raise InstallError(f"macOS plugin attribute cleanup failed: {detail.strip()}") from error
|
|
72
|
+
|
|
73
|
+
|
|
59
74
|
@dataclass
|
|
60
75
|
class InstallResult:
|
|
61
76
|
name: str
|
|
@@ -399,6 +414,7 @@ def install(
|
|
|
399
414
|
_write_install_manifest(staged, name=name, source=source, url=url,
|
|
400
415
|
subpath=subpath, ref=ref, meta=meta, registry_url=resolved_registry_url,
|
|
401
416
|
resolved_commit=source_meta.get("resolved_commit"))
|
|
417
|
+
_clear_macos_attributes(staged)
|
|
402
418
|
staged.rename(dest)
|
|
403
419
|
return InstallResult(name=name, path=dest, source=source,
|
|
404
420
|
version=meta.get("version"), dependencies_installed=installed_deps)
|
|
@@ -158,6 +158,7 @@ test/test_operations.py
|
|
|
158
158
|
test/test_overlap_finalize.py
|
|
159
159
|
test/test_plugin_environment.py
|
|
160
160
|
test/test_plugin_kit.py
|
|
161
|
+
test/test_plugin_macos_attributes.py
|
|
161
162
|
test/test_plugin_management.py
|
|
162
163
|
test/test_plugin_marketplace.py
|
|
163
164
|
test/test_plugin_node_contract.py
|
|
@@ -828,7 +828,7 @@ def _verify_candidate(root: Path, candidate: Path, name: str, *, candidate_depen
|
|
|
828
828
|
|
|
829
829
|
def _acquire_source(target: str, directory: Path, subpath: str | None = None):
|
|
830
830
|
from datetime import datetime, timezone
|
|
831
|
-
from pymss.plugins.install import InstallResult, install, list_available
|
|
831
|
+
from pymss.plugins.install import InstallResult, install, list_available, _clear_macos_attributes
|
|
832
832
|
|
|
833
833
|
local_root = _LOCAL_SOURCE.get()
|
|
834
834
|
from_default = bool(local_root and _NAME.fullmatch(target))
|
|
@@ -888,6 +888,7 @@ def _acquire_source(target: str, directory: Path, subpath: str | None = None):
|
|
|
888
888
|
"defaultRepository": from_default,
|
|
889
889
|
**({"sourceContext": {"registryUrl": _REGISTRY_URL.get(), "localSource": str(local_root)}} if from_default else {}),
|
|
890
890
|
}), encoding="utf-8")
|
|
891
|
+
_clear_macos_attributes(destination)
|
|
891
892
|
return InstallResult(name=name, path=destination, source="path", version=version)
|
|
892
893
|
|
|
893
894
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pymss"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.2"
|
|
8
8
|
description = "Python package for music source separation."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import importlib
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
from types import SimpleNamespace
|
|
8
|
+
from unittest.mock import Mock
|
|
9
|
+
|
|
10
|
+
import pytest
|
|
11
|
+
|
|
12
|
+
install_mod = importlib.import_module("pymss.plugins.install")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def package(tmp_path):
|
|
16
|
+
source = tmp_path / "source"
|
|
17
|
+
source.mkdir()
|
|
18
|
+
(source / "pyproject.toml").write_text(
|
|
19
|
+
'[project]\nname="provider"\nversion="1.0"\n'
|
|
20
|
+
'[tool.pymss.plugin]\nid="author.provider"\napi_version=2\n', encoding="utf-8")
|
|
21
|
+
(source / "__init__.py").write_text("def setup(plugin): pass\n", encoding="utf-8")
|
|
22
|
+
return source
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.parametrize("remote", [False, True])
|
|
26
|
+
def test_macos_install_clears_only_the_staged_plugin_before_publication(tmp_path, monkeypatch, remote):
|
|
27
|
+
source = package(tmp_path)
|
|
28
|
+
store = tmp_path / "installed"
|
|
29
|
+
calls = []
|
|
30
|
+
|
|
31
|
+
def run(command, **options):
|
|
32
|
+
staged = Path(command[-1])
|
|
33
|
+
assert staged.is_relative_to(store)
|
|
34
|
+
assert staged != source
|
|
35
|
+
assert (staged / "pyproject.toml").is_file()
|
|
36
|
+
assert not (store / "author.provider").exists()
|
|
37
|
+
calls.append((command, options))
|
|
38
|
+
return subprocess.CompletedProcess(command, 0, "", "")
|
|
39
|
+
|
|
40
|
+
def clone(url, destination, **options):
|
|
41
|
+
shutil.copytree(source, destination)
|
|
42
|
+
return {"resolved_commit": "a" * 40}
|
|
43
|
+
|
|
44
|
+
monkeypatch.setattr(install_mod, "sys", SimpleNamespace(platform="darwin"))
|
|
45
|
+
monkeypatch.setattr(install_mod.subprocess, "run", run)
|
|
46
|
+
monkeypatch.setattr(install_mod, "_clone", clone)
|
|
47
|
+
result = install_mod.install("https://github.com/author/plugin" if remote else str(source),
|
|
48
|
+
plugins_dir=store, no_deps=True)
|
|
49
|
+
assert result.path == store / "author.provider"
|
|
50
|
+
assert len(calls) == 1
|
|
51
|
+
command, options = calls[0]
|
|
52
|
+
assert command[:3] == ["/usr/bin/xattr", "-rc", "-s"]
|
|
53
|
+
assert options["check"] is True
|
|
54
|
+
assert options["timeout"] == 30
|
|
55
|
+
assert (source / "__init__.py").read_text() == "def setup(plugin): pass\n"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@pytest.mark.parametrize("platform", ["win32", "linux"])
|
|
59
|
+
def test_other_platforms_do_not_run_xattr(tmp_path, monkeypatch, platform):
|
|
60
|
+
source = package(tmp_path)
|
|
61
|
+
run = Mock(side_effect=AssertionError("Unexpected native command"))
|
|
62
|
+
monkeypatch.setattr(install_mod, "sys", SimpleNamespace(platform=platform))
|
|
63
|
+
monkeypatch.setattr(install_mod.subprocess, "run", run)
|
|
64
|
+
result = install_mod.install(str(source), plugins_dir=tmp_path / "installed", no_deps=True)
|
|
65
|
+
assert result.path.is_dir()
|
|
66
|
+
run.assert_not_called()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@pytest.mark.parametrize("error", [
|
|
70
|
+
subprocess.CalledProcessError(1, "xattr", stderr="Operation not permitted"),
|
|
71
|
+
subprocess.TimeoutExpired("xattr", 30),
|
|
72
|
+
FileNotFoundError("xattr unavailable"),
|
|
73
|
+
])
|
|
74
|
+
def test_cleanup_failure_aborts_before_publishing_the_plugin(tmp_path, monkeypatch, error):
|
|
75
|
+
source = package(tmp_path)
|
|
76
|
+
monkeypatch.setattr(install_mod, "sys", SimpleNamespace(platform="darwin"))
|
|
77
|
+
monkeypatch.setattr(install_mod.subprocess, "run", Mock(side_effect=error))
|
|
78
|
+
store = tmp_path / "installed"
|
|
79
|
+
with pytest.raises(install_mod.InstallError, match="macOS plugin attribute cleanup failed"):
|
|
80
|
+
install_mod.install(str(source), plugins_dir=store, no_deps=True)
|
|
81
|
+
assert not (store / "author.provider").exists()
|
|
82
|
+
assert (source / "pyproject.toml").is_file()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import importlib
|
|
3
4
|
import json
|
|
4
5
|
import os
|
|
5
6
|
from concurrent.futures import ThreadPoolExecutor
|
|
@@ -45,6 +46,55 @@ def release_leases():
|
|
|
45
46
|
release_runtime()
|
|
46
47
|
|
|
47
48
|
|
|
49
|
+
def test_macos_management_cleans_each_acquired_copy_before_verification(tmp_path, monkeypatch):
|
|
50
|
+
install_mod = importlib.import_module("pymss.plugins.install")
|
|
51
|
+
events = []
|
|
52
|
+
package = source(tmp_path)
|
|
53
|
+
|
|
54
|
+
def cleanup(command, **options):
|
|
55
|
+
assert command[:3] == ["/usr/bin/xattr", "-rc", "-s"]
|
|
56
|
+
candidate = Path(command[-1])
|
|
57
|
+
assert candidate.is_relative_to(tmp_path / "plugins")
|
|
58
|
+
assert candidate != package
|
|
59
|
+
events.append("cleanup")
|
|
60
|
+
return subprocess.CompletedProcess(command, 0, "", "")
|
|
61
|
+
|
|
62
|
+
def probe(root, paths):
|
|
63
|
+
events.append("probe")
|
|
64
|
+
return [{"name": path.name, "managed": True, "loaded": True} for path in (root / "installed").iterdir()]
|
|
65
|
+
|
|
66
|
+
monkeypatch.setattr(install_mod, "sys", SimpleNamespace(platform="darwin"))
|
|
67
|
+
monkeypatch.setattr(install_mod.subprocess, "run", cleanup)
|
|
68
|
+
cpu = PluginService(PluginContext(tmp_path / "plugins/cpu"), PluginPolicy(probe=probe))
|
|
69
|
+
cuda = PluginService(PluginContext(tmp_path / "plugins/cuda"), PluginPolicy(probe=probe))
|
|
70
|
+
actions = [lambda: cpu.install(str(package)), lambda: cpu.update("author.provider"),
|
|
71
|
+
lambda: cpu.manage("repair", name="author.provider"), lambda: cuda.prepare("author.provider")]
|
|
72
|
+
for action in actions:
|
|
73
|
+
events.clear()
|
|
74
|
+
action()
|
|
75
|
+
assert events[0] == "cleanup"
|
|
76
|
+
assert events.count("cleanup") == 1
|
|
77
|
+
assert "probe" in events
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_failed_macos_cleanup_keeps_the_installed_binding_and_skips_verification(tmp_path, monkeypatch):
|
|
81
|
+
install_mod = importlib.import_module("pymss.plugins.install")
|
|
82
|
+
manager = service(tmp_path / "plugins/cpu")
|
|
83
|
+
package = source(tmp_path)
|
|
84
|
+
manager.install(str(package))
|
|
85
|
+
installed = manager.context.root / "installed/author.provider"
|
|
86
|
+
before = {p.relative_to(installed): p.read_bytes() for p in installed.rglob("*") if p.is_file()}
|
|
87
|
+
probe = mock.Mock(side_effect=AssertionError("The candidate must not be loaded"))
|
|
88
|
+
manager.policy.probe = probe
|
|
89
|
+
monkeypatch.setattr(install_mod, "sys", SimpleNamespace(platform="darwin"))
|
|
90
|
+
monkeypatch.setattr(install_mod.subprocess, "run", mock.Mock(side_effect=
|
|
91
|
+
subprocess.CalledProcessError(1, "xattr", stderr="Operation not permitted")))
|
|
92
|
+
with pytest.raises(install_mod.InstallError, match="Operation not permitted"):
|
|
93
|
+
manager.update("author.provider")
|
|
94
|
+
assert {p.relative_to(installed): p.read_bytes() for p in installed.rglob("*") if p.is_file()} == before
|
|
95
|
+
probe.assert_not_called()
|
|
96
|
+
|
|
97
|
+
|
|
48
98
|
def test_inventory_api_import_and_query_do_not_initialize_the_core(tmp_path):
|
|
49
99
|
repository = Path(__file__).resolve().parents[1]
|
|
50
100
|
code = (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|