MCPcopy
hub / github.com/GitGuardian/ggshield / _install_from_local_wheel

Function _install_from_local_wheel

ggshield/cmd/plugin/install.py:255–294  ·  view source on GitHub ↗

Install a plugin from a local wheel file.

(
    ctx: click.Context,
    wheel_path_str: str,
    signature_mode: SignatureVerificationMode = SignatureVerificationMode.STRICT,
)

Source from the content-addressed store, hash-verified

253
254
255def _install_from_local_wheel(
256 ctx: click.Context,
257 wheel_path_str: str,
258 signature_mode: SignatureVerificationMode = SignatureVerificationMode.STRICT,
259) -> None:
260 """Install a plugin from a local wheel file."""
261 wheel_path = Path(wheel_path_str)
262
263 if not wheel_path.exists():
264 ui.display_error(f"Wheel file not found: {wheel_path}")
265 ctx.exit(ExitCode.USAGE_ERROR)
266
267 downloader = PluginDownloader()
268 enterprise_config = EnterpriseConfig.load()
269
270 ui.display_info(f"Installing from {wheel_path.name}...")
271
272 try:
273 plugin_name, version, installed_wheel = downloader.install_from_wheel(
274 wheel_path, signature_mode=signature_mode
275 )
276
277 plugin_name = enable_installed_plugin(
278 enterprise_config, plugin_name, version, installed_wheel
279 )
280 enterprise_config.save()
281
282 ui.display_info(f"Installed {plugin_name} v{version}")
283
284 except SignatureVerificationError as e:
285 ui.display_error(f"Signature verification failed: {e}")
286 ui.display_info(
287 "This plugin is not signed by GitGuardian. "
288 "If you trust its origin and still want to install it, "
289 "pass --allow-unsigned."
290 )
291 ctx.exit(ExitCode.UNEXPECTED_ERROR)
292 except Exception as e:
293 ui.display_error(f"Failed to install from wheel: {e}")
294 ctx.exit(ExitCode.UNEXPECTED_ERROR)
295
296
297def _install_from_url(

Callers 1

install_cmdFunction · 0.85

Calls 7

install_from_wheelMethod · 0.95
PluginDownloaderClass · 0.90
enable_installed_pluginFunction · 0.90
display_errorMethod · 0.80
display_infoMethod · 0.80
loadMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected