gOdoo-cli 0.11.10__tar.gz → 0.11.12__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 (51) hide show
  1. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/PKG-INFO +1 -1
  2. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/pyproject.toml +1 -1
  3. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/cli_common.py +1 -1
  4. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/dump.py +11 -11
  5. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/load.py +1 -1
  6. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/util.py +0 -1
  7. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/bootstrap.py +4 -4
  8. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/db/query.py +1 -1
  9. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/launch.py +7 -5
  10. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/git_repo.py +3 -3
  11. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/modules.py +4 -3
  12. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/modules_py.py +1 -1
  13. godoo_cli-0.11.12/src/godoo_cli/version.py +1 -0
  14. godoo_cli-0.11.10/src/godoo_cli/version.py +0 -1
  15. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/LICENSE +0 -0
  16. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/README.md +0 -0
  17. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/__init__.py +0 -0
  18. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/__main__.py +0 -0
  19. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/cli.py +0 -0
  20. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/__init__.py +0 -0
  21. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/__init__.py +0 -0
  22. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/cli.py +0 -0
  23. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/backup/pull.py +0 -0
  24. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/config.py +0 -0
  25. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/db/__init__.py +0 -0
  26. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/db/cli.py +0 -0
  27. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/db/connection.py +0 -0
  28. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/db/passwords.py +0 -0
  29. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  30. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/cli.py +0 -0
  31. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/config_parameters.py +0 -0
  32. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/importer.py +0 -0
  33. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/modules.py +0 -0
  34. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/rpc/translations.py +0 -0
  35. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/shell.py +0 -0
  36. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/source_get.py +0 -0
  37. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/test/__init__.py +0 -0
  38. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/test/cli.py +0 -0
  39. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/test/test_load_data.py +0 -0
  40. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/commands/test/test_run.py +0 -0
  41. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/__init__.py +0 -0
  42. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/git_odoo.py +0 -0
  43. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  44. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/git_url.py +0 -0
  45. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/git/zip_download.py +0 -0
  46. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/__init__.py +0 -0
  47. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/cli.py +0 -0
  48. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/modules_git.py +0 -0
  49. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/odoo_files.py +0 -0
  50. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  51. {godoo_cli-0.11.10 → godoo_cli-0.11.12}/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.11.10
3
+ Version: 0.11.12
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.11.10"
3
+ version = "0.11.12"
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"
@@ -136,7 +136,7 @@ class DatabaseCLIArgs:
136
136
  help="db password",
137
137
  rich_help_panel="Database Options",
138
138
  )
139
- db_port: str = Option(
139
+ db_port: int = Option(
140
140
  "",
141
141
  envvar="ODOO_DB_PORT",
142
142
  help="db host port (empty for socket)",
@@ -1,5 +1,4 @@
1
1
  import logging
2
- import shutil
3
2
  from configparser import ConfigParser
4
3
  from datetime import datetime
5
4
  from pathlib import Path
@@ -9,6 +8,7 @@ import typer
9
8
  from ...cli_common import CommonCLI
10
9
  from ...helpers.odoo_files import odoo_bin_get_version
11
10
  from ..db.connection import DBConnection
11
+ from .util import call_rsync
12
12
 
13
13
  LOGGER = logging.getLogger(__name__)
14
14
  CLI = CommonCLI()
@@ -41,33 +41,32 @@ def dump_instance(
41
41
  password=db_password,
42
42
  port=db_port,
43
43
  )
44
- dump_path.mkdir(parents=True, exist_ok=True)
44
+ if not conf_path.exists():
45
+ raise typer.Exit("No Odoo Conf Path provided or doesnt exists: '%s'" % conf_path)
45
46
 
46
- if not conf_path:
47
- raise typer.Exit("No Odoo Conf Path provided. Cannot dump Filestore")
47
+ if not dump_path.exists():
48
+ raise typer.Exit("No Dump Path provided or doesnt exists: %s" % dump_path)
48
49
 
49
50
  # Read .conf value [options] datad_dir
50
- conf_path = Path(conf_path)
51
51
  parser = ConfigParser()
52
52
  parser.read(conf_path)
53
53
  data_dir = parser["options"]["data_dir"]
54
54
  data_dir = Path(data_dir)
55
55
 
56
56
  # Copy Filestore
57
- LOGGER.info("Dumping Filestore")
58
57
  filestore_target = dump_path / "odoo_filestore"
59
- shutil.rmtree(filestore_target, ignore_errors=True)
60
- shutil.copytree(data_dir, filestore_target)
58
+ LOGGER.info("Dumping Filestore -> %s", filestore_target)
59
+ call_rsync(source_folder=data_dir, target_folder=filestore_target)
61
60
 
62
61
  # Dump DB using pg_dump
63
- LOGGER.info("Dumping DB")
64
62
  db_dump_target = dump_path / "odoo.dump"
63
+ LOGGER.info("Dumping DB -> %s", db_dump_target)
65
64
  db_dump_target.unlink(missing_ok=True)
66
65
  db_connection.run_psql_shell_command("pg_dump --format c {} > %s" % db_dump_target)
66
+ LOGGER.info("SQL Dump Completed with size -> %.2f MB", db_dump_target.stat().st_size / (1024 * 1024))
67
67
 
68
- readme_path = Path(dump_path) / "README.md"
68
+ readme_path = dump_path / "README.md"
69
69
  readme_path.unlink(missing_ok=True)
70
-
71
70
  odoo_version = odoo_bin_get_version(odoo_main_path)
72
71
 
73
72
  readme_content = f"""
@@ -84,3 +83,4 @@ SQL Dump and Filestore of gOdoo Instance.
84
83
 
85
84
  """
86
85
  readme_path.write_text(readme_content)
86
+ LOGGER.info("Odoo Dump Completed -> %s", dump_path)
@@ -22,7 +22,7 @@ def load_pg_dump(
22
22
  ):
23
23
  """Drop and recreate db_name and restore dump_path into it."""
24
24
  if not dump_path.exists():
25
- raise FileNotFoundError("Cannot find PG dump @ %s" % dump_path)
25
+ raise FileNotFoundError("Cannot find Odoo Dump @ %s" % dump_path)
26
26
 
27
27
  conn = DBConnection(
28
28
  db_name="postgres",
@@ -16,7 +16,6 @@ def call_rsync(source_folder: Path, target_folder: Path, rsync_delete: bool = Tr
16
16
  args += ["--delete"]
17
17
  args += [f"{source_folder}/", f"{target_folder}/"]
18
18
  command = " ".join(map(str, args))
19
- LOGGER.info("Rysnc filestore to: %s", source_folder)
20
19
  LOGGER.debug("Running: %s", command)
21
20
  return subprocess.run(command, shell=True).returncode
22
21
 
@@ -90,8 +90,8 @@ def _boostrap_command(
90
90
  init_modules += [f.name for f in workspace_addons]
91
91
  init_cmd = "--init " + ",".join(init_modules) if init_modules else ""
92
92
 
93
- addon_paths = [str(p.absolute()) for p in addon_paths]
94
- addon_paths = ", ".join(list(filter(None, addon_paths)))
93
+ addon_paths_str_list = [str(p.absolute()) for p in addon_paths if p and p.exists()]
94
+ addon_paths_str = ", ".join(addon_paths_str_list)
95
95
 
96
96
  base_cmds = [
97
97
  str(odoo_main_path.absolute()) + "/odoo-bin",
@@ -100,7 +100,7 @@ def _boostrap_command(
100
100
  "--save",
101
101
  f"--load-language {languages}",
102
102
  "--stop-after-init",
103
- f"--addons-path '{addon_paths}'",
103
+ f"--addons-path '{addon_paths_str}'",
104
104
  ]
105
105
  odoo_cmd = base_cmds + db_command
106
106
  if extra_cmd_args:
@@ -109,7 +109,7 @@ def _boostrap_command(
109
109
  _add_default_argument(cmd_list=odoo_cmd, arg="--data-dir", arg_val="/var/lib/odoo")
110
110
 
111
111
  if multithread_worker_count == -1:
112
- multithread_worker_count = (os.cpu_count() or 2) / 2
112
+ multithread_worker_count = int(os.cpu_count() or 2 / 2)
113
113
 
114
114
  if multithread_worker_count > 0:
115
115
  odoo_cmd += [
@@ -108,7 +108,7 @@ def is_bootstrapped(
108
108
 
109
109
  def _get_installed_modules(db_connection: DBConnection, to_install=False):
110
110
  """Get list of installed modules in database (to_install includes the modules marked for installation)"""
111
- if boot := _is_bootstrapped(db_connection=db_connection) != DB_BOOTSTRAP_STATUS.BOOTSTRAPPED:
111
+ if (boot := _is_bootstrapped(db_connection=db_connection)) != DB_BOOTSTRAP_STATUS.BOOTSTRAPPED:
112
112
  return boot.value
113
113
  lookup_states = ["installed", "to upgrade"]
114
114
  if to_install:
@@ -2,7 +2,7 @@ import logging
2
2
  import re
3
3
  import threading
4
4
  from pathlib import Path
5
- from typing import List
5
+ from typing import List, Optional
6
6
 
7
7
  import typer
8
8
 
@@ -43,7 +43,9 @@ def _launch_command(
43
43
  upgrade_workspace_modules : bool, optional
44
44
  upgrade workspace addons, by default True
45
45
  """
46
- upgrade_addons = [f.name for f in godooModules(workspace_addon_path)] if upgrade_workspace_modules else []
46
+ upgrade_addons = (
47
+ [f.name for f in godooModules(workspace_addon_path).get_modules()] if upgrade_workspace_modules else []
48
+ )
47
49
  if any(["-u" in i or "--update" in i for i in extra_cmd_args]):
48
50
  upgrade_addons = []
49
51
  update_addon_string = "--update " + ",".join(upgrade_addons) if upgrade_addons else ""
@@ -67,9 +69,9 @@ def pre_launch(
67
69
  odoo_demo: bool,
68
70
  dev_mode: bool,
69
71
  multithread_worker_count: int = 0,
70
- extra_launch_args: List[str] = None,
71
- extra_bootstrap_args: List[str] = None,
72
- log_file_path: Path = None,
72
+ extra_launch_args: Optional[List[str]] = None,
73
+ extra_bootstrap_args: Optional[List[str]] = None,
74
+ log_file_path: Optional[Path] = None,
73
75
  install_workspace_addons: bool = True,
74
76
  launch_or_bootstrap: bool = False,
75
77
  languages: str = "de_DE,en_US",
@@ -71,7 +71,7 @@ def git_pull_checkout_reset(
71
71
  clone_kwargs = {}
72
72
  if branch:
73
73
  clone_kwargs["branch"] = branch
74
- repo = _git_clean_clone(repo.remotes[0].url, repo.working_dir, **clone_kwargs)
74
+ repo = _git_clean_clone(repo.remotes[0].url, Path(repo.working_dir), **clone_kwargs)
75
75
  else:
76
76
  raise e
77
77
  if commit:
@@ -135,12 +135,12 @@ def git_ensure_ref(
135
135
  git_pull_checkout_reset(repo=repo, branch=branch, commit=commit, pull=pull)
136
136
 
137
137
  if current == str(repo.head.commit):
138
- LOGGER.info("Repo Commit matches. Skipping: '%s' --> '%s'", repo_src, target_folder)
138
+ LOGGER.debug("Repo Commit matches. Skipping: '%s' --> '%s'", repo_src, current)
139
139
  else:
140
140
  LOGGER.info("Pulled Repo from: '%s'. Head is now at: %s", repo_src, repo.head.commit)
141
141
  except InvalidGitRepositoryError:
142
142
  repo = _git_clean_clone(repo_src, target_folder, branch=branch, **kwargs)
143
- git_pull_checkout_reset(repo=repo, branch=branch, commit=commit, pull=False)
143
+ git_pull_checkout_reset(repo=repo, branch=branch, commit=commit)
144
144
 
145
145
  LOGGER.info(
146
146
  "Cloned Repo: '%s'. Branch='%s' Head='%s'",
@@ -56,7 +56,7 @@ class godooModule:
56
56
  class godooModules:
57
57
  """Abstract interface to Addon-Paths. Finds modules and their dependencies."""
58
58
 
59
- def __init__(self, addon_paths: List[Path]) -> None:
59
+ def __init__(self, addon_paths: Union[List[Path], Path]) -> None:
60
60
  if not isinstance(addon_paths, list):
61
61
  addon_paths = [addon_paths]
62
62
  self.addon_paths = addon_paths
@@ -69,7 +69,8 @@ class godooModules:
69
69
  if module_names:
70
70
  for name in module_names:
71
71
  try:
72
- yield self.get_module(name)
72
+ if module := self.get_module(name):
73
+ yield module
73
74
  except ModuleNotFoundError as e:
74
75
  if raise_missing_names:
75
76
  raise e
@@ -106,7 +107,7 @@ class godooModules:
106
107
 
107
108
  def get_module_dependencies(
108
109
  self, module: Union[godooModule, List[godooModule]], dont_follow: Optional[List[str]] = None
109
- ) -> List[str]:
110
+ ) -> List[godooModule]:
110
111
  """Get dependant modules of module(s). Recursively follows dependencies."""
111
112
  if isinstance(module, godooModule):
112
113
  module = [module]
@@ -50,7 +50,7 @@ def _install_py_reqs_by_odoo_cmd(addon_paths: List[Path], odoo_bin_cmd: str):
50
50
  CompletedProcess
51
51
  """
52
52
  install_modules = []
53
- for m in re.finditer(r'(--init|-i) "?([^ \n]+)"?', odoo_bin_cmd):
53
+ for m in re.finditer(r'(--init|-i|--load) "?([^ \n]+)"?', odoo_bin_cmd):
54
54
  install_modules += m.group(2).split(",")
55
55
  if install_modules:
56
56
  LOGGER.debug("Found Modules to install in odoo-bin command: %s", install_modules)
@@ -0,0 +1 @@
1
+ __version__ = "0.11.12"
@@ -1 +0,0 @@
1
- __version__ = "0.11.10"
File without changes
File without changes