Skip to content

Commit

Permalink
Added a way to exclude some modules from the result of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
llacroix committed Jul 6, 2023
1 parent 7b6b05e commit bc4dc75
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
18 changes: 16 additions & 2 deletions odoo_tools/cli/click/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def show_module(ctx, module):
)
@click.option(
'--include-modules',
help="Remove logs and warnings.",
help="Include dependencies that aren't in the addons_paths.",
is_flag=True,
default=False
)
Expand All @@ -207,6 +207,12 @@ def show_module(ctx, module):
is_flag=True,
default=False
)
@click.option(
'--exclude-modules',
help="Exclude queried modules from the found dependencies.",
is_flag=True,
default=False
)
@click.pass_context
def show_dependencies(
ctx,
Expand All @@ -220,7 +226,8 @@ def show_dependencies(
path,
auto,
quiet,
include_modules
include_modules,
exclude_modules,
):
env = ctx.obj['env']

Expand Down Expand Up @@ -280,6 +287,13 @@ def check_module(mod):
for mod in sorted_dependencies
]

if exclude_modules:
mods = [
mod
for mod in mods
if mod not in check_modules
]

if csv:
print(",".join(mods), end="")
else:
Expand Down
23 changes: 23 additions & 0 deletions tests/cli/test_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from mock import patch, MagicMock
from odoo_tools.cli.odot import command
from odoo_tools.api.environment import Environment

from odoo_tools.api.modules import ModuleApi


def test_module_deps(runner):

with patch.object(ModuleApi, 'list') as list_modules:

result = runner.invoke(
command,
[
'module',
'deps',
'--exclude-modules',
'--csv-modules c,d',
]
)

import pdb; pdb.set_trace()
pass

0 comments on commit bc4dc75

Please sign in to comment.