mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-22 02:03:01 +02:00
Make Textual an optional dependency.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
|
||||
|
||||
def run_browse(
|
||||
diff_arguments,
|
||||
global_arguments,
|
||||
configs,
|
||||
):
|
||||
'''
|
||||
Run the "browse" action for the given repository.
|
||||
'''
|
||||
if not configs:
|
||||
return
|
||||
|
||||
logging.getLogger('asyncio').setLevel(logging.WARNING)
|
||||
|
||||
try:
|
||||
import textual
|
||||
except ImportError: # pragma: no cover
|
||||
raise ValueError('Unable to import the Textual library for the browse action; try installing "borgmatic[browse]"')
|
||||
|
||||
import borgmatic.actions.browse.view
|
||||
|
||||
app = borgmatic.actions.browse.view.Browse_app(configs)
|
||||
app.run()
|
||||
@@ -465,20 +465,3 @@ class Rich_color_formatter(logging.Formatter):
|
||||
record.prefix = f'{self.prefix}: ' if self.prefix else ''
|
||||
|
||||
return f'[{color}]{super().format(record)}[/{color}]'
|
||||
|
||||
|
||||
def run_browse(
|
||||
diff_arguments,
|
||||
global_arguments,
|
||||
configs,
|
||||
):
|
||||
'''
|
||||
Run the "browse" action for the given repository.
|
||||
'''
|
||||
if not configs:
|
||||
return
|
||||
|
||||
logging.getLogger('asyncio').setLevel(logging.WARNING)
|
||||
|
||||
app = Browse_app(configs)
|
||||
app.run()
|
||||
|
||||
@@ -12,7 +12,7 @@ import ruamel.yaml
|
||||
|
||||
import borgmatic.actions.borg
|
||||
import borgmatic.actions.break_lock
|
||||
import borgmatic.actions.browse.view
|
||||
import borgmatic.actions.browse.run
|
||||
import borgmatic.actions.change_passphrase
|
||||
import borgmatic.actions.check
|
||||
import borgmatic.actions.compact
|
||||
@@ -899,7 +899,7 @@ def collect_highlander_action_summary_logs(configs, arguments, configuration_par
|
||||
return
|
||||
|
||||
if 'browse' in arguments:
|
||||
borgmatic.actions.browse.view.run_browse(
|
||||
borgmatic.actions.browse.run.run_browse(
|
||||
arguments['browse'],
|
||||
arguments['global'],
|
||||
configs,
|
||||
|
||||
@@ -44,7 +44,7 @@ def ping_monitor(hook_config, config, config_filename, state, monitoring_log_lev
|
||||
import apprise # noqa: PLC0415
|
||||
from apprise import NotifyFormat, NotifyType # noqa: PLC0415
|
||||
except ImportError: # pragma: no cover
|
||||
logger.warning('Unable to import Apprise in monitoring hook')
|
||||
logger.warning('Unable to import Apprise in its monitoring hook; try installing "borgmatic[Apprise]"')
|
||||
return
|
||||
|
||||
state_to_notify_type = {
|
||||
|
||||
+2
-2
@@ -21,7 +21,6 @@ dependencies = [
|
||||
"packaging",
|
||||
"requests",
|
||||
"ruamel.yaml>0.15.0",
|
||||
"textual",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
@@ -31,7 +30,8 @@ validate-borgmatic-config = "borgmatic.commands.validate_config:main"
|
||||
|
||||
[project.optional-dependencies]
|
||||
Apprise = ["apprise"]
|
||||
dev = ["textual-dev"]
|
||||
browse = ["textual"]
|
||||
browse-dev = ["textual-dev"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://torsion.org/borgmatic"
|
||||
|
||||
Reference in New Issue
Block a user