gOdoo-cli 0.10.0__tar.gz → 0.10.1__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.
Files changed (49) hide show
  1. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/PKG-INFO +1 -1
  2. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/pyproject.toml +1 -1
  3. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/test/cli.py +2 -1
  4. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/test/test_run.py +21 -16
  5. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/odoo_files.py +29 -8
  6. godoo_cli-0.10.1/src/godoo_cli/version.py +1 -0
  7. godoo_cli-0.10.0/src/godoo_cli/version.py +0 -1
  8. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/LICENSE +0 -0
  9. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/README.md +0 -0
  10. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/__init__.py +0 -0
  11. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/__main__.py +0 -0
  12. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/cli.py +0 -0
  13. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/cli_common.py +0 -0
  14. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/__init__.py +0 -0
  15. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/__init__.py +0 -0
  16. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/cli.py +0 -0
  17. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/dump.py +0 -0
  18. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/load.py +0 -0
  19. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/pull.py +0 -0
  20. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/backup/util.py +0 -0
  21. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/bootstrap.py +0 -0
  22. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/config.py +0 -0
  23. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/db/__init__.py +0 -0
  24. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/db/cli.py +0 -0
  25. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/db/connection.py +0 -0
  26. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/db/passwords.py +0 -0
  27. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/db/query.py +0 -0
  28. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/launch.py +0 -0
  29. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  30. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/cli.py +0 -0
  31. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/config_parameters.py +0 -0
  32. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/importer.py +0 -0
  33. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/modules.py +0 -0
  34. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/rpc/translations.py +0 -0
  35. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/shell.py +0 -0
  36. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/source_get.py +0 -0
  37. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/test/__init__.py +0 -0
  38. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/commands/test/test_load_data.py +0 -0
  39. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/__init__.py +0 -0
  40. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/git_odoo.py +0 -0
  41. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  42. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/git_repo.py +0 -0
  43. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/git_url.py +0 -0
  44. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/git/zip_download.py +0 -0
  45. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/__init__.py +0 -0
  46. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/bootstrap.py +0 -0
  47. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/cli.py +0 -0
  48. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  49. {godoo_cli-0.10.0 → godoo_cli-0.10.1}/src/godoo_cli/helpers/system.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gOdoo-cli
3
- Version: 0.10.0
3
+ Version: 0.10.1
4
4
  Summary: Wrapper around Odoo-Bin with some convinience RPC functions.
5
5
  Home-page: https://github.com/OpenJKSoftware/gOdoo
6
6
  License: LGPL-3
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.10.0"
3
+ version = "0.10.1"
4
4
  description = "Wrapper around Odoo-Bin with some convinience RPC functions."
5
5
  authors = ["Joshua Kreuder <Joshua_Kreuder@outlook.com>"]
6
6
  license = "LGPL-3"
@@ -1,7 +1,7 @@
1
1
  import typer
2
2
 
3
3
  from .test_load_data import odoo_load_test_data
4
- from .test_run import odoo_run_tests
4
+ from .test_run import odoo_get_changed_modules, odoo_run_tests
5
5
 
6
6
 
7
7
  def test_cli_app():
@@ -11,5 +11,6 @@ def test_cli_app():
11
11
  )
12
12
  app.command(name="run")(odoo_run_tests)
13
13
  app.command(name="load-data")(odoo_load_test_data)
14
+ app.command(name="get-changed-modules")(odoo_get_changed_modules)
14
15
 
15
16
  return app
@@ -7,7 +7,7 @@ import typer
7
7
  from typing_extensions import Annotated
8
8
 
9
9
  from ...cli_common import CommonCLI
10
- from ...helpers.odoo_files import get_changed_modules, get_depends_of_module, get_odoo_module_paths
10
+ from ...helpers.odoo_files import get_changed_modules_and_depends, get_odoo_module_paths
11
11
  from ...helpers.system import run_cmd
12
12
  from ..db.connection import DBConnection
13
13
  from ..launch import pre_launch
@@ -19,28 +19,33 @@ LOGGER = logging.getLogger(__name__)
19
19
 
20
20
  def _test_modules_special_cases(in_modules: List[str], workspace_addon_path: Path):
21
21
  if len(in_modules) == 1:
22
- command = in_modules[0]
23
22
  out_modules = []
23
+ command = in_modules[0]
24
24
  if command == "all":
25
25
  out_modules = get_odoo_module_paths(workspace_addon_path)
26
-
27
- if re_match := re.match(r"changes\:(.*)", command):
26
+ elif re_match := re.match(r"changes\:(.*)", command):
28
27
  compare_branch = re_match.group(1)
29
- changed_modules = get_changed_modules(addon_path=workspace_addon_path, diff_branch=compare_branch)
30
- if not changed_modules:
31
- return []
32
- change_modules_depends = []
33
- for module in changed_modules:
34
- change_modules_depends += get_depends_of_module(
35
- out_modules, module, already_done_modules=change_modules_depends
36
- )
37
- out_modules = changed_modules + change_modules_depends
38
- if out_modules:
39
- out_modules_with_tests = [p for p in out_modules if any(p.rglob("tests/__init__.py"))]
40
- return [p.stem for p in out_modules_with_tests]
28
+ changed_modules = get_changed_modules_and_depends(
29
+ diff_ref=compare_branch,
30
+ addon_path=workspace_addon_path,
31
+ )
32
+ out_modules = changed_modules
33
+ return [p.stem for p in out_modules]
41
34
  return in_modules
42
35
 
43
36
 
37
+ @CLI.arg_annotator
38
+ def odoo_get_changed_modules(
39
+ diff_ref: str = typer.Argument(..., help="Git Ref/Branch to compare against"),
40
+ workspace_addon_path=CLI.odoo_paths.workspace_addon_path,
41
+ ):
42
+ """Get Modules that have changed compared to diff_ref"""
43
+ changed_modules = get_changed_modules_and_depends(diff_ref=diff_ref, addon_path=workspace_addon_path)
44
+ if not changed_modules:
45
+ return
46
+ print("\n".join(sorted([p.stem for p in changed_modules]))) # pylint: disable=print-used
47
+
48
+
44
49
  @CLI.arg_annotator
45
50
  def odoo_run_tests(
46
51
  test_modules: List[str] = typer.Argument(
@@ -98,7 +98,7 @@ def get_odoo_module_paths(
98
98
  raise FileNotFoundError(f"Could not find odoo addon folder: '{folder}'")
99
99
  for folder in folder.iterdir():
100
100
  if folder_is_odoo_module(folder):
101
- module_paths.append(folder)
101
+ module_paths.append(folder.absolute())
102
102
  if module_names:
103
103
  module_names = [m for m in module_names if m != "base"]
104
104
  filtered_module_paths = [p for p in module_paths if p.stem in module_names]
@@ -110,7 +110,7 @@ def get_odoo_module_paths(
110
110
 
111
111
  def get_changed_modules(
112
112
  addon_path: Path,
113
- diff_branch: str,
113
+ diff_ref: str,
114
114
  ) -> List[Path]:
115
115
  """Get Paths of changed modules since git diff.
116
116
 
@@ -118,7 +118,7 @@ def get_changed_modules(
118
118
  ----------
119
119
  addon_path : Path
120
120
  Folder in git repo where to look for changes
121
- diff_branch : str
121
+ diff_ref : str
122
122
  Branch or diffable ref for git
123
123
 
124
124
  Returns
@@ -127,10 +127,11 @@ def get_changed_modules(
127
127
  List of Paths where something has changed since git diff
128
128
  """
129
129
  addon_path = addon_path.absolute()
130
+ odoo_module_paths = get_odoo_module_paths(addon_path)
130
131
  repo = Repo(addon_path, search_parent_directories=True)
131
132
  git_root = Path(repo.git.rev_parse("--show-toplevel"))
132
133
  changed_module_files = []
133
- for change in repo.git.diff("--name-status", diff_branch).split("\n"):
134
+ for change in repo.git.diff("--name-status", diff_ref).split("\n"):
134
135
  path = git_root / change.split("\t")[1]
135
136
  if addon_path in path.parents:
136
137
  changed_module_files.append(path)
@@ -138,14 +139,15 @@ def get_changed_modules(
138
139
  changed_module_folders = []
139
140
  for f in changed_module_files:
140
141
  for pf in f.parents:
141
- if pf.absolute() == addon_path.absolute():
142
- break
143
- if pf.absolute() not in changed_module_folders and folder_is_odoo_module(pf):
142
+ if pf.absolute() in odoo_module_paths:
144
143
  changed_module_folders.append(pf.absolute())
144
+ break
145
+ if pf.absolute() == addon_path:
146
+ break
145
147
  if changed_module_folders:
146
148
  LOGGER.debug(
147
149
  "Found Modules changed to branch '%s':\n %s",
148
- diff_branch,
150
+ diff_ref,
149
151
  changed_module_folders,
150
152
  )
151
153
  return changed_module_folders
@@ -198,6 +200,25 @@ def get_depends_of_module(
198
200
  return list(set(sub_depends))
199
201
 
200
202
 
203
+ def get_changed_modules_and_depends(diff_ref: str, addon_path: Path):
204
+ """Get Modules that have changed compared to diff_ref and all their dependencies downstream"""
205
+ all_modules = get_odoo_module_paths(addon_path)
206
+ changed_modules = get_changed_modules(addon_path=addon_path, diff_ref=diff_ref)
207
+ if not changed_modules:
208
+ return []
209
+ change_modules_depends = []
210
+ changed_module_names = [p.stem for p in changed_modules]
211
+ for module in all_modules:
212
+ # Check if there are other modules in addon path, that depend on a changed module
213
+ module_manifest = module / "__manifest__.py"
214
+ manifest = literal_eval(module_manifest.read_text())
215
+ depends = manifest.get("depends", [])
216
+ for depend in depends:
217
+ if depend in changed_module_names:
218
+ change_modules_depends.append(module)
219
+ return list(set(changed_modules + change_modules_depends))
220
+
221
+
201
222
  def get_addon_paths(
202
223
  odoo_main_repo: Path,
203
224
  workspace_addon_path: Path,
@@ -0,0 +1 @@
1
+ __version__ = "0.10.1"
@@ -1 +0,0 @@
1
- __version__ = "0.10.0"
File without changes
File without changes