gOdoo-cli 0.12.0__tar.gz → 0.12.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 (53) hide show
  1. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/PKG-INFO +26 -25
  2. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/pyproject.toml +28 -28
  3. godoo_cli-0.12.1/src/godoo_cli/commands/backup/upgrade.py +79 -0
  4. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/shell/shell.py +12 -10
  5. godoo_cli-0.12.1/src/godoo_cli/version.py +1 -0
  6. godoo_cli-0.12.0/src/godoo_cli/version.py +0 -1
  7. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/LICENSE +0 -0
  8. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/README.md +0 -0
  9. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/__init__.py +0 -0
  10. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/__main__.py +0 -0
  11. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/cli.py +0 -0
  12. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/cli_common.py +0 -0
  13. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/__init__.py +0 -0
  14. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/__init__.py +0 -0
  15. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/cli.py +0 -0
  16. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/dump.py +0 -0
  17. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/load.py +0 -0
  18. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/pull.py +0 -0
  19. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/backup/util.py +0 -0
  20. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/bootstrap.py +0 -0
  21. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/config.py +0 -0
  22. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/db/__init__.py +0 -0
  23. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/db/cli.py +0 -0
  24. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/db/connection.py +0 -0
  25. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/db/passwords.py +0 -0
  26. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/db/query.py +0 -0
  27. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/launch.py +0 -0
  28. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  29. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/cli.py +0 -0
  30. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/config_parameters.py +0 -0
  31. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/importer.py +0 -0
  32. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/modules.py +0 -0
  33. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/rpc/translations.py +0 -0
  34. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/shell/scripts/odoo_banner.py +0 -0
  35. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/source_get.py +0 -0
  36. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/test/__init__.py +0 -0
  37. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/test/cli.py +0 -0
  38. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/test/test_load_data.py +0 -0
  39. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/commands/test/test_run.py +0 -0
  40. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/__init__.py +0 -0
  41. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/git_odoo.py +0 -0
  42. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  43. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/git_repo.py +0 -0
  44. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/git_url.py +0 -0
  45. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/git/zip_download.py +0 -0
  46. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/__init__.py +0 -0
  47. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/cli.py +0 -0
  48. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/modules.py +0 -0
  49. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/modules_git.py +0 -0
  50. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/modules_py.py +0 -0
  51. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/odoo_files.py +0 -0
  52. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
  53. {godoo_cli-0.12.0 → godoo_cli-0.12.1}/src/godoo_cli/helpers/system.py +0 -0
@@ -1,43 +1,44 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gOdoo-cli
3
- Version: 0.12.0
3
+ Version: 0.12.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
7
7
  Keywords: odoo,godoo,devcontainer
8
8
  Author: Joshua Kreuder
9
9
  Author-email: Joshua_Kreuder@outlook.com
10
- Requires-Python: >=3.9,<3.12
10
+ Requires-Python: >=3.9
11
11
  Classifier: License :: Other/Proprietary License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.9
14
14
  Classifier: Programming Language :: Python :: 3.10
15
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
16
17
  Provides-Extra: codequality
17
18
  Provides-Extra: devcontainer
18
- Requires-Dist: black (>=22.10.0,<23.0.0) ; extra == "codequality"
19
- Requires-Dist: debugpy (>=1.6.0,<2.0.0) ; extra == "devcontainer"
20
- Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "codequality"
21
- Requires-Dist: gitpython (>=3.1.27,<4.0.0)
22
- Requires-Dist: godoo-rpc (>=0.1.2,<0.2.0)
23
- Requires-Dist: inotify (>=0.2.10,<0.3.0) ; extra == "devcontainer"
24
- Requires-Dist: ipdb (>=0.13.9,<0.14.0) ; extra == "devcontainer"
25
- Requires-Dist: isort (>=5.10.1,<6.0.0) ; extra == "codequality"
26
- Requires-Dist: mock (>=4.0.3,<5.0.0) ; extra == "devcontainer"
27
- Requires-Dist: openupgradelib (>=3.3.4,<4.0.0)
28
- Requires-Dist: passlib (>=1.7.3,<2.0.0)
29
- Requires-Dist: psycopg2 (>=2.8.6,<3.0.0)
30
- Requires-Dist: py-spy (>=0.3.11,<0.4.0) ; extra == "devcontainer"
31
- Requires-Dist: pydevd-odoo (>=1.2.1,<2.0.0) ; extra == "devcontainer"
32
- Requires-Dist: pylint-odoo (>=8.0.16,<9.0.0) ; extra == "codequality"
33
- Requires-Dist: pytest (>=7.2.1,<8.0.0) ; extra == "codequality"
34
- Requires-Dist: pytest-cov (>=4.0.0,<5.0.0) ; extra == "codequality"
35
- Requires-Dist: python-dotenv (>=0.20.0,<0.21.0)
36
- Requires-Dist: rope (>=0.23.0,<0.24.0) ; extra == "devcontainer"
37
- Requires-Dist: ruamel-yaml (>=0.17.21,<0.18.0)
38
- Requires-Dist: typer (>=0.9.0,<0.10.0)
39
- Requires-Dist: typer-common-functions (>=0.0.10,<0.0.11)
40
- Requires-Dist: watchdog (>=2.1.7,<3.0.0) ; extra == "devcontainer"
19
+ Requires-Dist: black (>=22.10.0) ; extra == "codequality"
20
+ Requires-Dist: debugpy (>=1.6.0) ; extra == "devcontainer"
21
+ Requires-Dist: flake8 (>=5.0.4) ; extra == "codequality"
22
+ Requires-Dist: gitpython (>=3.1.27)
23
+ Requires-Dist: godoo-rpc (>=0.1.4)
24
+ Requires-Dist: inotify (>=0.2.10) ; extra == "devcontainer"
25
+ Requires-Dist: ipdb (>=0.13.9) ; extra == "devcontainer"
26
+ Requires-Dist: isort (>=5.10.1) ; extra == "codequality"
27
+ Requires-Dist: mock (>=4.0.3) ; extra == "devcontainer"
28
+ Requires-Dist: openupgradelib (>=3.3.4)
29
+ Requires-Dist: passlib (>=1.7.3)
30
+ Requires-Dist: psycopg2 (>=2.8.6)
31
+ Requires-Dist: py-spy (>=0.3.11) ; extra == "devcontainer"
32
+ Requires-Dist: pydevd-odoo (>=1.2.1) ; extra == "devcontainer"
33
+ Requires-Dist: pylint-odoo (>=8.0.16) ; extra == "codequality"
34
+ Requires-Dist: pytest (>=7.2.1) ; extra == "codequality"
35
+ Requires-Dist: pytest-cov (>=4.0.0) ; extra == "codequality"
36
+ Requires-Dist: python-dotenv (>=0.20.0)
37
+ Requires-Dist: rope (>=0.23.0) ; extra == "devcontainer"
38
+ Requires-Dist: ruamel-yaml (>=0.17.21)
39
+ Requires-Dist: typer (>=0.9.0)
40
+ Requires-Dist: typer-common-functions (>=0.0.12)
41
+ Requires-Dist: watchdog (>=2.1.7) ; extra == "devcontainer"
41
42
  Project-URL: Repository, https://github.com/OpenJKSoftware/gOdoo
42
43
  Description-Content-Type: text/markdown
43
44
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.12.0"
3
+ version = "0.12.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"
@@ -10,7 +10,7 @@ repository = "https://github.com/OpenJKSoftware/gOdoo"
10
10
  keywords = ["odoo", "godoo","devcontainer"]
11
11
 
12
12
  [tool.poetry.group.dev.dependencies]
13
- pre-commit = "^3.4.0"
13
+ pre-commit = ">=3.4.0"
14
14
 
15
15
  [tool.poetry_bumpversion.file."src/godoo_cli/version.py"]
16
16
 
@@ -18,31 +18,31 @@ pre-commit = "^3.4.0"
18
18
  godoo = "godoo_cli:launch_cli"
19
19
 
20
20
  [tool.poetry.dependencies]
21
- python = ">=3.9,<3.12"
22
- python-dotenv = "^0.20.0"
23
- ruamel-yaml = "^0.17.21"
24
- gitpython = "^3.1.27"
25
- godoo-rpc = "^0.1.2"
26
- openupgradelib = "^3.3.4"
27
- psycopg2 = "^2.8.6" # Mirror Odoo Reqs
28
- passlib = "^1.7.3" # Mirror Odoo Reqs
29
- typer-common-functions = "^0.0.10"
30
- typer = "^0.9.0"
31
-
32
- pylint-odoo = { version="^8.0.16", optional = true}
33
- ipdb = { version="^0.13.9", optional = true}
34
- debugpy = { version="^1.6.0", optional = true}
35
- black = { version="^22.10.0", optional = true}
36
- isort = { version="^5.10.1", optional = true}
37
- watchdog = { version="^2.1.7", optional = true}
38
- py-spy = { version="^0.3.11", optional = true}
39
- rope = { version="^0.23.0", optional = true}
40
- flake8 = { version="^5.0.4", optional = true}
41
- inotify = { version="^0.2.10",optional = true}
42
- mock = { version="^4.0.3", optional= true}
43
- pytest = { version="^7.2.1", optional= true}
44
- pytest-cov = {version="^4.0.0",optional=true}
45
- pydevd-odoo = { version="^1.2.1",optional=true}
21
+ python = ">=3.9"
22
+ python-dotenv = ">=0.20.0"
23
+ ruamel-yaml = ">=0.17.21"
24
+ gitpython = ">=3.1.27"
25
+ godoo-rpc = ">=0.1.4"
26
+ openupgradelib = ">=3.3.4"
27
+ psycopg2 = ">=2.8.6" # Mirror Odoo Reqs
28
+ passlib = ">=1.7.3" # Mirror Odoo Reqs
29
+ typer-common-functions = ">=0.0.12"
30
+ typer = ">=0.9.0"
31
+
32
+ pylint-odoo = { version=">=8.0.16", optional = true}
33
+ ipdb = { version=">=0.13.9", optional = true}
34
+ debugpy = { version=">=1.6.0", optional = true}
35
+ black = { version=">=22.10.0", optional = true}
36
+ isort = { version=">=5.10.1", optional = true}
37
+ watchdog = { version=">=2.1.7", optional = true}
38
+ py-spy = { version=">=0.3.11", optional = true}
39
+ rope = { version=">=0.23.0", optional = true}
40
+ flake8 = { version=">=5.0.4", optional = true}
41
+ inotify = { version=">=0.2.10",optional = true}
42
+ mock = { version=">=4.0.3", optional= true}
43
+ pytest = { version=">=7.2.1", optional= true}
44
+ pytest-cov = {version=">=4.0.0",optional=true}
45
+ pydevd-odoo = { version=">=1.2.1",optional=true}
46
46
 
47
47
  [tool.poetry.extras]
48
48
  devcontainer = [
@@ -75,7 +75,7 @@ log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(linen
75
75
  log_cli_date_format = "%Y-%m-%d %H:%M:%S"
76
76
 
77
77
  [tool.pyright]
78
- ignore="**/__manifest__.py"
78
+ ignore=["**/__manifest__.py"]
79
79
 
80
80
  [tool.black]
81
81
  line-length = 120
@@ -0,0 +1,79 @@
1
+ import logging
2
+ import shutil
3
+ import subprocess
4
+ import zipfile
5
+ from pathlib import Path
6
+ from typing import Literal
7
+
8
+ import typer
9
+ from typing_extensions import Annotated
10
+
11
+ from ...cli_common import CommonCLI
12
+ from ...helpers.system import typer_ask_overwrite_path
13
+
14
+ LOGGER = logging.getLogger(__name__)
15
+ CLI = CommonCLI()
16
+
17
+
18
+ @CLI.arg_annotator
19
+ def run_upgrade(
20
+ dump_path: Annotated[
21
+ Path, typer.Argument(..., help="Path to SQL Dump", file_okay=True, dir_okay=False, exists=True)
22
+ ],
23
+ enterprise_subcode: Annotated[
24
+ str, typer.Option(help="Odoo.com Enterprise Subcode", envvar="ODOO_ENTERPRISE_SUBCODE")
25
+ ],
26
+ target_version: Annotated[str, typer.Option(help="Target Odoo Version", envvar="ODOO_UPGRADE_TARGET_VERSION")],
27
+ db_host=CLI.database.db_host,
28
+ db_port=CLI.database.db_port,
29
+ db_name=CLI.database.db_name,
30
+ db_user=CLI.database.db_user,
31
+ db_password=CLI.database.db_password,
32
+ upgrade_mode: Annotated[Literal["test", "prod"], typer.Option("test", help="Odoo.com Upgrade Mode")] = "test",
33
+ ):
34
+ """Send SQL Dump to upgrade.odoo.com"""
35
+ upgrade_zip_path = dump_path.parent / "upgrade.zip"
36
+
37
+ if typer_ask_overwrite_path(upgrade_zip_path):
38
+ backup_caches(upgrade_zip_path)
39
+ run_upgrade_online(
40
+ sql_dump_path=dump_path,
41
+ enterprise_subcode=enterprise_subcode,
42
+ target_version=target_version,
43
+ upgrade_mode=upgrade_mode,
44
+ )
45
+
46
+ if not upgrade_zip_path.exists():
47
+ LOGGER.error("Upgrade Failed: No upgrade.zip found")
48
+ raise typer.Exit(1)
49
+
50
+ LOGGER.info("Restoring Upgrade. Change Date: %s", upgrade_zip_path.stat().st_mtime)
51
+
52
+ LOGGER.info("Extracting Upgrade Zip")
53
+ ex_cache_path = upgrade_zip_path.parent / "upgrade_extract"
54
+ with zipfile.ZipFile(upgrade_zip_path, "r") as zip_ref:
55
+ zip_ref.extractall(ex_cache_path)
56
+
57
+ LOGGER.info("Ensuring DB Dump is pg_custom format for rapid loading")
58
+
59
+
60
+ def run_upgrade_online(sql_dump_path: Path, enterprise_subcode: str, target_version: str, upgrade_mode: str):
61
+ """Runs sql dump against upgrade.odoo.com"""
62
+ command = f"python <(curl -s https://upgrade.odoo.com/upgrade) {upgrade_mode} -i {sql_dump_path.absolute()} -t {target_version} -x -c {enterprise_subcode}"
63
+ LOGGER.info("Running Upgrade Command: %s", command)
64
+ ret = subprocess.run(command, shell=True)
65
+ if ret.returncode != 0:
66
+ LOGGER.error("Upgrade Failed: %s", ret)
67
+ raise typer.Exit(ret.returncode)
68
+
69
+
70
+ def backup_caches(upgrade_zip_path):
71
+ if upgrade_zip_path.exists():
72
+ LOGGER.info("Found existing upgrade.zip, backing up and Deleting")
73
+ shutil.move(upgrade_zip_path, upgrade_zip_path.with_suffix(".old.zip"))
74
+ log_path = upgrade_zip_path.parent / "upgrade.log"
75
+ if log_path.exists():
76
+ shutil.move(log_path, log_path.with_suffix(".old.log"))
77
+ report_path = upgrade_zip_path.parent / "upgrade-report.html"
78
+ if report_path.exists():
79
+ shutil.move(report_path, report_path.with_suffix(".old.html"))
@@ -92,17 +92,19 @@ def odoo_shell_run_script(
92
92
  if not script_path.exists():
93
93
  LOGGER.error("Script '%s' not found in %s", script_name, script_folder)
94
94
  return CLI.returner(1)
95
+
96
+ shell_cmd = f"{str(odoo_main_path.absolute())}/odoo-bin shell --no-http"
97
+ if odoo_conf_path.exists():
98
+ shell_cmd += f" -c {str(odoo_conf_path.absolute())}"
99
+ else:
100
+ LOGGER.warning("No Odoo Config File found at %s", odoo_conf_path)
101
+ if not all([db_host, db_port, db_name, db_user, db_password]):
102
+ LOGGER.error("Missing database options and Config File. Aborting.")
103
+ return CLI.returner(1)
104
+ shell_cmd += f" --db_host={db_host} --db_port={db_port} --database={db_name} --db_user={db_user} --db_password={db_password}"
105
+
95
106
  LOGGER.info("Running Script: %s", script_path)
96
- odoo_shell(
97
- pipe_in_command=script_path.read_text(),
98
- odoo_main_path=odoo_main_path,
99
- odoo_conf_path=odoo_conf_path,
100
- db_host=db_host,
101
- db_port=db_port,
102
- db_name=db_name,
103
- db_user=db_user,
104
- db_password=db_password,
105
- )
107
+ run_cmd(shell_cmd, stdin=script_path.open("r"))
106
108
 
107
109
 
108
110
  def odoo_pregenerate_assets(odoo_main_path: Path):
@@ -0,0 +1 @@
1
+ __version__ = "0.12.1"
@@ -1 +0,0 @@
1
- __version__ = "0.12.0"
File without changes
File without changes