gOdoo-cli 0.4.2__tar.gz → 0.5.0__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.
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/PKG-INFO +15 -11
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/README.md +6 -3
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/pyproject.toml +16 -7
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/cli_common.py +2 -3
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/bootstrap.py +15 -7
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/db/cli.py +2 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/db/connection.py +17 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/git_repo.py +4 -1
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/helpers/bootstrap.py +4 -1
- godoo_cli-0.5.0/src/godoo_cli/helpers/cli.py +15 -0
- godoo_cli-0.5.0/src/godoo_cli/version.py +1 -0
- godoo_cli-0.4.2/setup.py +0 -66
- godoo_cli-0.4.2/src/godoo_cli/helpers/cli.py +0 -139
- godoo_cli-0.4.2/src/godoo_cli/version.py +0 -1
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/LICENSE +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/__main__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/cli.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/config.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/db/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/db/passwords.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/launch.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/rpc/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/rpc/cli.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/rpc/importer.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/rpc/modules.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/rpc/translations.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/shell.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/source_get.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/commands/test.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/git_odoo.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/git_odoo_addons.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/git_url.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/git/zip_download.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/helpers/__init__.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/helpers/odoo_files.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
- {godoo_cli-0.4.2 → godoo_cli-0.5.0}/src/godoo_cli/helpers/system.py +0 -0
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: godoo-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
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.8,<3.
|
|
10
|
+
Requires-Python: >=3.8.1,<3.12
|
|
11
11
|
Classifier: License :: Other/Proprietary License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Provides-Extra: codequality
|
|
17
17
|
Provides-Extra: devcontainer
|
|
18
18
|
Requires-Dist: black (>=22.10.0,<23.0.0) ; extra == "codequality"
|
|
19
19
|
Requires-Dist: debugpy (>=1.6.0,<2.0.0) ; extra == "devcontainer"
|
|
20
20
|
Requires-Dist: flake8 (>=5.0.4,<6.0.0) ; extra == "codequality"
|
|
21
21
|
Requires-Dist: gitpython (>=3.1.27,<4.0.0)
|
|
22
|
-
Requires-Dist: godoo-rpc (
|
|
22
|
+
Requires-Dist: godoo-rpc (>=0.1.1,<0.2.0)
|
|
23
23
|
Requires-Dist: inotify (>=0.2.10,<0.3.0) ; extra == "devcontainer"
|
|
24
24
|
Requires-Dist: ipdb (>=0.13.9,<0.14.0) ; extra == "devcontainer"
|
|
25
25
|
Requires-Dist: isort (>=5.10.1,<6.0.0) ; extra == "codequality"
|
|
26
26
|
Requires-Dist: mock (>=4.0.3,<5.0.0) ; extra == "devcontainer"
|
|
27
27
|
Requires-Dist: openupgradelib (>=3.3.4,<4.0.0)
|
|
28
|
-
Requires-Dist: passlib (>=1.7.
|
|
28
|
+
Requires-Dist: passlib (>=1.7.3,<2.0.0)
|
|
29
29
|
Requires-Dist: pre-commit (>=2.20.0,<3.0.0) ; extra == "devcontainer"
|
|
30
|
-
Requires-Dist: psycopg2 (>=2.
|
|
30
|
+
Requires-Dist: psycopg2 (>=2.8.6,<3.0.0)
|
|
31
31
|
Requires-Dist: py-spy (>=0.3.11,<0.4.0) ; extra == "devcontainer"
|
|
32
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"
|
|
33
35
|
Requires-Dist: python-dotenv (>=0.20.0,<0.21.0)
|
|
34
|
-
Requires-Dist: rich (>=12.6.0,<13.0.0)
|
|
35
36
|
Requires-Dist: rope (>=0.23.0,<0.24.0) ; extra == "devcontainer"
|
|
36
37
|
Requires-Dist: ruamel-yaml (>=0.17.21,<0.18.0)
|
|
37
|
-
Requires-Dist: typer
|
|
38
|
+
Requires-Dist: typer-common-functions (>=0.0.3,<0.0.4)
|
|
38
39
|
Requires-Dist: watchdog (>=2.1.7,<3.0.0) ; extra == "devcontainer"
|
|
39
40
|
Project-URL: Repository, https://github.com/OpenJKSoftware/gOdoo
|
|
40
41
|
Description-Content-Type: text/markdown
|
|
@@ -53,6 +54,8 @@ with Python CLI `godoo` convenience wrapper around `odoo-bin`.
|
|
|
53
54
|
This repository is the base source for the Python package [godoo-cli](https://pypi.org/project/godoo-cli/) and serves as
|
|
54
55
|
an all batteries included development environment.
|
|
55
56
|
|
|
57
|
+
This is the source repository for `gOdoo`. If you want to use `gOdoo` please refer to [./docker/Dockerfile](./docker/Dockerfile) and modify it to install godoo using Pip.
|
|
58
|
+
|
|
56
59
|
Made Possible by: [WEMPE Elektronic GmbH](https://wetech.de)
|
|
57
60
|
|
|
58
61
|
# gOdoo-cli
|
|
@@ -70,7 +73,7 @@ Use `godoo --help` to find out more. HINT: Install tab-completion with `godoo --
|
|
|
70
73
|
This workspace also contains Docker and Docker-Compose files. \
|
|
71
74
|
|
|
72
75
|
They are used to provide either easy Odoo instances where the source is pulled according to
|
|
73
|
-
[ODOO_MANIFEST.yml](
|
|
76
|
+
[ODOO_MANIFEST.yml](odoo_manifest.yml), or as a all batteries included devcontainer for VScode.
|
|
74
77
|
|
|
75
78
|
## Requirements
|
|
76
79
|
|
|
@@ -78,7 +81,7 @@ They are used to provide either easy Odoo instances where the source is pulled a
|
|
|
78
81
|
- [Traefik](https://doc.traefik.io/traefik/) container running with docker provider and "traefik" named docker network.
|
|
79
82
|
Example: [Traefik Devproxy](https://github.com/joshkreud/traefik_devproxy)
|
|
80
83
|
- SSH Agent running. (check `echo $SSH_AUTH_SOCK`)\
|
|
81
|
-
This gets passed trough in the Buildprocess to clone Thirdparty repos.
|
|
84
|
+
This gets passed trough in the Buildprocess to clone Thirdparty repos (Optional).
|
|
82
85
|
|
|
83
86
|
## Just wanna have a quick and easy Odoo Instance?
|
|
84
87
|
|
|
@@ -104,6 +107,7 @@ docker-compose up
|
|
|
104
107
|
- Easy fully working Odoo instance by `docker-compose up` with https access.
|
|
105
108
|
- `godoo` CLI wrapper around Odoo. (Most flags can be configured by Environment Variables and are already preconfigured
|
|
106
109
|
in the Containers. See [.env.sample](./.env.sample))
|
|
110
|
+
- Cups Container, that provides a CUPS Printserver
|
|
107
111
|
- `odoo-bin` is added to PATH and can thus be invoked from every folder.
|
|
108
112
|
- Odoo will run in Proxy_Mode behind a Traefik reverse proxy for easy access on
|
|
109
113
|
`https://$COMPOSE_PROJECT_NAME.docker.localhost`
|
|
@@ -185,7 +189,7 @@ Use `godoo shell` to enter an interactive shell on the Database.
|
|
|
185
189
|
## Third Party Modules (manifest.yml)
|
|
186
190
|
|
|
187
191
|
The `godoo` bootstrap function, will download some modules using git. \
|
|
188
|
-
Which Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](
|
|
192
|
+
Which Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](odoo_manifest.yml)) \
|
|
189
193
|
Not all of the cloned addons are automatically installed. \
|
|
190
194
|
Install them via the Apps Page in Odoo using `godoo rpc modules install` or using `odoo-bin`.\
|
|
191
195
|
Modules downloaded on the Odoo Marketplace can be dropped as a `.zip` archive in [./thirdparty](./thirdparty)
|
|
@@ -12,6 +12,8 @@ with Python CLI `godoo` convenience wrapper around `odoo-bin`.
|
|
|
12
12
|
This repository is the base source for the Python package [godoo-cli](https://pypi.org/project/godoo-cli/) and serves as
|
|
13
13
|
an all batteries included development environment.
|
|
14
14
|
|
|
15
|
+
This is the source repository for `gOdoo`. If you want to use `gOdoo` please refer to [./docker/Dockerfile](./docker/Dockerfile) and modify it to install godoo using Pip.
|
|
16
|
+
|
|
15
17
|
Made Possible by: [WEMPE Elektronic GmbH](https://wetech.de)
|
|
16
18
|
|
|
17
19
|
# gOdoo-cli
|
|
@@ -29,7 +31,7 @@ Use `godoo --help` to find out more. HINT: Install tab-completion with `godoo --
|
|
|
29
31
|
This workspace also contains Docker and Docker-Compose files. \
|
|
30
32
|
|
|
31
33
|
They are used to provide either easy Odoo instances where the source is pulled according to
|
|
32
|
-
[ODOO_MANIFEST.yml](
|
|
34
|
+
[ODOO_MANIFEST.yml](odoo_manifest.yml), or as a all batteries included devcontainer for VScode.
|
|
33
35
|
|
|
34
36
|
## Requirements
|
|
35
37
|
|
|
@@ -37,7 +39,7 @@ They are used to provide either easy Odoo instances where the source is pulled a
|
|
|
37
39
|
- [Traefik](https://doc.traefik.io/traefik/) container running with docker provider and "traefik" named docker network.
|
|
38
40
|
Example: [Traefik Devproxy](https://github.com/joshkreud/traefik_devproxy)
|
|
39
41
|
- SSH Agent running. (check `echo $SSH_AUTH_SOCK`)\
|
|
40
|
-
This gets passed trough in the Buildprocess to clone Thirdparty repos.
|
|
42
|
+
This gets passed trough in the Buildprocess to clone Thirdparty repos (Optional).
|
|
41
43
|
|
|
42
44
|
## Just wanna have a quick and easy Odoo Instance?
|
|
43
45
|
|
|
@@ -63,6 +65,7 @@ docker-compose up
|
|
|
63
65
|
- Easy fully working Odoo instance by `docker-compose up` with https access.
|
|
64
66
|
- `godoo` CLI wrapper around Odoo. (Most flags can be configured by Environment Variables and are already preconfigured
|
|
65
67
|
in the Containers. See [.env.sample](./.env.sample))
|
|
68
|
+
- Cups Container, that provides a CUPS Printserver
|
|
66
69
|
- `odoo-bin` is added to PATH and can thus be invoked from every folder.
|
|
67
70
|
- Odoo will run in Proxy_Mode behind a Traefik reverse proxy for easy access on
|
|
68
71
|
`https://$COMPOSE_PROJECT_NAME.docker.localhost`
|
|
@@ -144,7 +147,7 @@ Use `godoo shell` to enter an interactive shell on the Database.
|
|
|
144
147
|
## Third Party Modules (manifest.yml)
|
|
145
148
|
|
|
146
149
|
The `godoo` bootstrap function, will download some modules using git. \
|
|
147
|
-
Which Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](
|
|
150
|
+
Which Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](odoo_manifest.yml)) \
|
|
148
151
|
Not all of the cloned addons are automatically installed. \
|
|
149
152
|
Install them via the Apps Page in Odoo using `godoo rpc modules install` or using `odoo-bin`.\
|
|
150
153
|
Modules downloaded on the Odoo Marketplace can be dropped as a `.zip` archive in [./thirdparty](./thirdparty)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "gOdoo-cli"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.0"
|
|
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"
|
|
@@ -15,16 +15,15 @@ keywords = ["odoo", "godoo","devcontainer"]
|
|
|
15
15
|
godoo = "godoo_cli:launch_cli"
|
|
16
16
|
|
|
17
17
|
[tool.poetry.dependencies]
|
|
18
|
-
python = ">=3.8,<3.
|
|
18
|
+
python = ">=3.8.1,<3.12"
|
|
19
19
|
python-dotenv = "^0.20.0"
|
|
20
20
|
ruamel-yaml = "^0.17.21"
|
|
21
|
-
typer = {extras = ["all"], version = "^0.7.0"}
|
|
22
21
|
gitpython = "^3.1.27"
|
|
23
|
-
|
|
24
|
-
godoo-rpc = "0.0.3"
|
|
22
|
+
godoo-rpc = "^0.1.1"
|
|
25
23
|
openupgradelib = "^3.3.4"
|
|
26
|
-
psycopg2 = "^2.
|
|
27
|
-
passlib = "^1.7.
|
|
24
|
+
psycopg2 = "^2.8.6" # Mirror Odoo Reqs
|
|
25
|
+
passlib = "^1.7.3" # Mirror Odoo Reqs
|
|
26
|
+
typer-common-functions = "^0.0.3"
|
|
28
27
|
|
|
29
28
|
pylint-odoo = { version="^8.0.16", optional = true}
|
|
30
29
|
ipdb = { version="^0.13.9", optional = true}
|
|
@@ -38,6 +37,8 @@ rope = { version="^0.23.0", optional = true}
|
|
|
38
37
|
flake8 = { version="^5.0.4", optional = true}
|
|
39
38
|
inotify = { version="^0.2.10",optional = true}
|
|
40
39
|
mock = { version="^4.0.3", optional= true}
|
|
40
|
+
pytest = { version="^7.2.1", optional= true}
|
|
41
|
+
pytest-cov = {version="^4.0.0",optional=true}
|
|
41
42
|
|
|
42
43
|
[tool.poetry.extras]
|
|
43
44
|
devcontainer = [
|
|
@@ -55,12 +56,20 @@ codequality = [
|
|
|
55
56
|
"black",
|
|
56
57
|
"isort",
|
|
57
58
|
"flake8",
|
|
59
|
+
"pytest",
|
|
60
|
+
"pytest-cov"
|
|
58
61
|
]
|
|
59
62
|
|
|
60
63
|
[build-system]
|
|
61
64
|
requires = ["poetry-core>=1.0.0"]
|
|
62
65
|
build-backend = "poetry.core.masonry.api"
|
|
63
66
|
|
|
67
|
+
[tool.pytest.ini_options]
|
|
68
|
+
log_cli = true
|
|
69
|
+
log_cli_level = "INFO"
|
|
70
|
+
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
|
|
71
|
+
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
72
|
+
|
|
64
73
|
[tool.pyright]
|
|
65
74
|
ignore="**/__manifest__.py"
|
|
66
75
|
|
|
@@ -3,15 +3,14 @@ from pathlib import Path
|
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
|
|
5
5
|
from typer import Option
|
|
6
|
-
|
|
7
|
-
from .helpers.cli import get_type_from_default, typer_retuner, typer_unpacker
|
|
6
|
+
from typer_common_functions import get_type_from_default, typer_retuner, typer_unpacker
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
@dataclass
|
|
11
10
|
class OdooLaunchArgs:
|
|
12
11
|
extra_cmd_args: List[str] = Option(None, help="extra agruments to pass to odoo-bin", rich_help_panel="Odoo")
|
|
13
12
|
multithread_worker_count: int = Option(
|
|
14
|
-
|
|
13
|
+
-1, help="count of worker threads. will enable proxy_mode if >0. (Autodetect with -1)", rich_help_panel="Odoo"
|
|
15
14
|
)
|
|
16
15
|
languages: str = Option("de_DE,en_US", help="languages to load by default", rich_help_panel="Odoo")
|
|
17
16
|
no_install_base: bool = Option(
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
import re
|
|
3
4
|
from pathlib import Path
|
|
4
|
-
from typing import List
|
|
5
|
+
from typing import Any, List
|
|
5
6
|
|
|
6
7
|
from ..cli_common import CommonCLI
|
|
7
8
|
from ..helpers.bootstrap import _install_py_reqs_by_odoo_cmd
|
|
@@ -13,6 +14,11 @@ CLI = CommonCLI()
|
|
|
13
14
|
LOGGER = logging.getLogger(__name__)
|
|
14
15
|
|
|
15
16
|
|
|
17
|
+
def _add_default_argument(cmd_list: List[str], arg: str, arg_val: Any):
|
|
18
|
+
if not any([arg in s for s in cmd_list]):
|
|
19
|
+
cmd_list.append(f'{arg}="{arg_val}"')
|
|
20
|
+
|
|
21
|
+
|
|
16
22
|
def _boostrap_command(
|
|
17
23
|
odoo_main_path: Path,
|
|
18
24
|
odoo_conf_path: Path,
|
|
@@ -27,7 +33,7 @@ def _boostrap_command(
|
|
|
27
33
|
extra_cmd_args: List[str] = None,
|
|
28
34
|
install_base: bool = True,
|
|
29
35
|
install_workspace_modules: bool = True,
|
|
30
|
-
multithread_worker_count: int =
|
|
36
|
+
multithread_worker_count: int = -1,
|
|
31
37
|
languages: str = "de_DE,en_US",
|
|
32
38
|
) -> str:
|
|
33
39
|
"""
|
|
@@ -104,16 +110,18 @@ def _boostrap_command(
|
|
|
104
110
|
f"--config {str(odoo_conf_path.absolute())}",
|
|
105
111
|
"--save",
|
|
106
112
|
f"--load-language {languages}",
|
|
107
|
-
"--log-level info",
|
|
108
|
-
"--limit-time-cpu 360",
|
|
109
|
-
"--limit-time-real 420",
|
|
110
|
-
"--data-dir /var/lib/odoo",
|
|
111
113
|
"--stop-after-init",
|
|
112
114
|
f"--addons-path '{addon_paths}'",
|
|
113
115
|
]
|
|
114
116
|
odoo_cmd = base_cmds + db_command
|
|
115
117
|
if extra_cmd_args:
|
|
116
|
-
odoo_cmd
|
|
118
|
+
odoo_cmd += extra_cmd_args
|
|
119
|
+
|
|
120
|
+
_add_default_argument(cmd_list=odoo_cmd, arg="--data-dir", arg_val="/var/lib/odoo")
|
|
121
|
+
|
|
122
|
+
if multithread_worker_count == -1:
|
|
123
|
+
multithread_worker_count = os.cpu_count() or 0 + 1
|
|
124
|
+
|
|
117
125
|
if multithread_worker_count > 0:
|
|
118
126
|
odoo_cmd += [
|
|
119
127
|
"--proxy-mode",
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import subprocess
|
|
2
3
|
from contextlib import contextmanager
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
|
|
5
6
|
import psycopg2
|
|
6
7
|
|
|
8
|
+
from ...cli_common import CommonCLI
|
|
9
|
+
|
|
7
10
|
LOGGER = logging.getLogger(__name__)
|
|
11
|
+
CLI = CommonCLI()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@CLI.arg_annotator
|
|
15
|
+
def login_db(
|
|
16
|
+
db_host=CLI.database.db_host,
|
|
17
|
+
db_port=CLI.database.db_port,
|
|
18
|
+
db_name=CLI.database.db_name,
|
|
19
|
+
db_user=CLI.database.db_user,
|
|
20
|
+
db_password=CLI.database.db_password,
|
|
21
|
+
):
|
|
22
|
+
"""Login Interactive psql CLI using provided credentials"""
|
|
23
|
+
command = ["psql", f"-h{db_host}", f"-p{db_port}", f"-U{db_user}", f"-d{db_name}"]
|
|
24
|
+
subprocess.run(command, env={"PGPASSWORD": db_password})
|
|
8
25
|
|
|
9
26
|
|
|
10
27
|
@dataclass
|
|
@@ -131,7 +131,7 @@ def git_ensure_ref(
|
|
|
131
131
|
if str(remote_commit) != current:
|
|
132
132
|
pull = str(branch)
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
git_pull_checkout_reset(repo=repo, branch=branch, commit=commit, pull=pull)
|
|
135
135
|
|
|
136
136
|
if current == str(repo.head.commit):
|
|
137
137
|
LOGGER.info("Repo Commit matches. Skipping: '%s' --> '%s'", repo_src, target_folder)
|
|
@@ -179,6 +179,9 @@ def git_ensure_repo(
|
|
|
179
179
|
get passed to git clone
|
|
180
180
|
"""
|
|
181
181
|
|
|
182
|
+
if isinstance(target_folder, str):
|
|
183
|
+
target_folder = Path(target_folder)
|
|
184
|
+
|
|
182
185
|
if target_folder.exists() and any(target_folder.iterdir()) and not target_folder.glob(".git"):
|
|
183
186
|
LOGGER.info("Assuming '%s' got pulled in .Zip mode. Skipping Clone and commit check.", target_folder)
|
|
184
187
|
zip_mode = True
|
|
@@ -33,7 +33,10 @@ def _install_py_reqs_for_modules(addon_paths: List[Path], module_names: List[str
|
|
|
33
33
|
installed_packages = [m.get("name") for m in literal_eval(installed_packages)]
|
|
34
34
|
if missing_packages := [p for p in py_reqs if p not in installed_packages]:
|
|
35
35
|
LOGGER.info("Installing Python requirements: '%s'", ", ".join(missing_packages))
|
|
36
|
-
|
|
36
|
+
res = run_cmd(f"pip install {' '.join(missing_packages)} --disable-pip-version-check", shell=True)
|
|
37
|
+
if res.returncode != 0:
|
|
38
|
+
raise FileNotFoundError("Pip installation error at: %s" % ", ".join(missing_packages))
|
|
39
|
+
return res
|
|
37
40
|
LOGGER.debug("No py Requirements to be installed")
|
|
38
41
|
|
|
39
42
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
LOGGER = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def check_dangerous_command():
|
|
8
|
+
isdev = str(os.getenv("WORKSPACE_IS_DEV"))
|
|
9
|
+
if not isdev.lower() == "true":
|
|
10
|
+
LOGGER.warning(
|
|
11
|
+
"""This function is dangerous in Production environments.
|
|
12
|
+
Please set 'WORKSPACE_IS_DEV=true' as environment Variable to continue
|
|
13
|
+
"""
|
|
14
|
+
)
|
|
15
|
+
exit(1)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.5.0"
|
godoo_cli-0.4.2/setup.py
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
from setuptools import setup
|
|
3
|
-
|
|
4
|
-
package_dir = \
|
|
5
|
-
{'': 'src'}
|
|
6
|
-
|
|
7
|
-
packages = \
|
|
8
|
-
['godoo_cli',
|
|
9
|
-
'godoo_cli.commands',
|
|
10
|
-
'godoo_cli.commands.db',
|
|
11
|
-
'godoo_cli.commands.rpc',
|
|
12
|
-
'godoo_cli.git',
|
|
13
|
-
'godoo_cli.helpers']
|
|
14
|
-
|
|
15
|
-
package_data = \
|
|
16
|
-
{'': ['*']}
|
|
17
|
-
|
|
18
|
-
install_requires = \
|
|
19
|
-
['gitpython>=3.1.27,<4.0.0',
|
|
20
|
-
'godoo-rpc==0.0.3',
|
|
21
|
-
'openupgradelib>=3.3.4,<4.0.0',
|
|
22
|
-
'passlib>=1.7.4,<2.0.0',
|
|
23
|
-
'psycopg2>=2.9.5,<3.0.0',
|
|
24
|
-
'python-dotenv>=0.20.0,<0.21.0',
|
|
25
|
-
'rich>=12.6.0,<13.0.0',
|
|
26
|
-
'ruamel-yaml>=0.17.21,<0.18.0',
|
|
27
|
-
'typer[all]>=0.7.0,<0.8.0']
|
|
28
|
-
|
|
29
|
-
extras_require = \
|
|
30
|
-
{'codequality': ['pylint-odoo>=8.0.16,<9.0.0',
|
|
31
|
-
'black>=22.10.0,<23.0.0',
|
|
32
|
-
'isort>=5.10.1,<6.0.0',
|
|
33
|
-
'flake8>=5.0.4,<6.0.0'],
|
|
34
|
-
'devcontainer': ['ipdb>=0.13.9,<0.14.0',
|
|
35
|
-
'debugpy>=1.6.0,<2.0.0',
|
|
36
|
-
'pre-commit>=2.20.0,<3.0.0',
|
|
37
|
-
'watchdog>=2.1.7,<3.0.0',
|
|
38
|
-
'py-spy>=0.3.11,<0.4.0',
|
|
39
|
-
'rope>=0.23.0,<0.24.0',
|
|
40
|
-
'inotify>=0.2.10,<0.3.0',
|
|
41
|
-
'mock>=4.0.3,<5.0.0']}
|
|
42
|
-
|
|
43
|
-
entry_points = \
|
|
44
|
-
{'console_scripts': ['godoo = godoo_cli:launch_cli']}
|
|
45
|
-
|
|
46
|
-
setup_kwargs = {
|
|
47
|
-
'name': 'godoo-cli',
|
|
48
|
-
'version': '0.4.2',
|
|
49
|
-
'description': 'Wrapper around Odoo-Bin with some convinience RPC functions.',
|
|
50
|
-
'long_description': '# gOdoo Dev Environment\n\n\n\n\n[<img src="https://raw.githubusercontent.com/OpenJKSoftware/gOdoo/main/assets/godoo-main-cli.png" width="1000"/>](image.png)\n\n**gOdoo** is short for **go Odoo**. \\\nIt is a [Vscode Devcontainer](https://code.visualstudio.com/docs/remote/containers) Environment for [Odoo](https://odoo.com/)\nwith Python CLI `godoo` convenience wrapper around `odoo-bin`.\n\nThis repository is the base source for the Python package [godoo-cli](https://pypi.org/project/godoo-cli/) and serves as\nan all batteries included development environment.\n\nMade Possible by: [WEMPE Elektronic GmbH](https://wetech.de)\n\n# gOdoo-cli\n\nPython package that provides `godoo` command line interface around `odoo-bin`.\n\nIt\'s build with [Typer](https://github.com/tiangolo/typer) to provide some convenience Wrappers for Odoo development and\nDeployment.\n\nMost flags can be configured by Env variables. \\\nUse `godoo --help` to find out more. HINT: Install tab-completion with `godoo --install-completion`\n\n# Docker\n\nThis workspace also contains Docker and Docker-Compose files. \\\n\nThey are used to provide either easy Odoo instances where the source is pulled according to\n[ODOO_MANIFEST.yml](./ODOO_MANIFEST.yml), or as a all batteries included devcontainer for VScode.\n\n## Requirements\n\n- [Docker Compose](https://github.com/docker/compose)\n- [Traefik](https://doc.traefik.io/traefik/) container running with docker provider and "traefik" named docker network.\n Example: [Traefik Devproxy](https://github.com/joshkreud/traefik_devproxy)\n- SSH Agent running. (check `echo $SSH_AUTH_SOCK`)\\\n This gets passed trough in the Buildprocess to clone Thirdparty repos.\n\n## Just wanna have a quick and easy Odoo Instance?\n\n```bash\ngit clone https://github.com/OpenJKSoftware/gOdoo\ncd godoo\n. scripts/container_requirements.sh # Check Requirements\ndocker-compose build\ndocker-compose up\n# wait......\n# wait a bit mode ...\n# just a little bit longer ..\n# There we go.\n# Odoo should be reachable on \'https://godoo.docker.localhost\' assuming you didn\'t change .env TRAEFIK_HOST_RULE or COMPOSE_PROJECT_NAME\n```\n\n# Devcontainer\n\n## Features\n\n- All batteries included [Devcontainer](https://code.visualstudio.com/docs/remote/containers) with postgres service\n Container and local DNS resolvig managed by [Traefik](https://doc.traefik.io/traefik/).\n- Easy fully working Odoo instance by `docker-compose up` with https access.\n- `godoo` CLI wrapper around Odoo. (Most flags can be configured by Environment Variables and are already preconfigured\n in the Containers. See [.env.sample](./.env.sample))\n- `odoo-bin` is added to PATH and can thus be invoked from every folder.\n- Odoo will run in Proxy_Mode behind a Traefik reverse proxy for easy access on\n `https://$COMPOSE_PROJECT_NAME.docker.localhost`\n- [Odoo Pylint plugin](https://github.com/OCA/pylint-odoo) preconfigured in vscode\n- Preinstalled vscode Extensions Highlights:\n - [SQL Tools](https://marketplace.visualstudio.com/items?itemName=mtxr.sqltools) with preconfigured connection for\n easy Database access in the Sidebar.\n - [Docker Extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker) controls\n container host.\n - [Odoo Snippets](https://marketplace.visualstudio.com/items?itemName=mstuttgart.odoo-snippets)\n - [Odoo Developments](https://marketplace.visualstudio.com/items?itemName=scapigliato.vsc-odoo-development) can Grab\n Odoo Model information from a running Server\n - [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree)\n\n## Usage\n\n1. For Docker on windows: Clone the repo into the WSL2 Filesystem for better IO performance\n2. Have [Traefik](https://github.com/traefik/traefik) Running on `docker.localhost`\n [Example](https://github.com/joshkreud/traefik_devproxy) \\\n There must be a Docker network called `traefik` that can reach traefik.\n3. Open Devcontianer:\n - If you have the Devcontainer CLI: `devcontainer open .`\n - If not open the workspace in Local Vscode. In the Command pallete search for `Reopen in container`\n4. From **within the container** start Odoo using one of the following commands:\n - You can enable godoo tab-completion by `godoo --install-completion`\n - `make` -> Loads Odoo + Workspace Addons\n - `make bare` -> Loads Odoo with ony `web` installed.\n - `make kill` -> Search for `odoo-bin` processes and kill them\n - `make reset` -> Drops DB, deletes config file and datafolder\n - The full init script is available via "`godoo`". (See --help for Options)\n5. Open Odoo `https://$COMPOSE_PROJECT_NAME.docker.localhost`\\\n For example `COMPOSE_PROJECT_NAME=godoo` --> [https://godoo.docker.localhost](https://godoo.docker.localhost)\n6. Login with `admin:admin`\n7. Profit!\n\n### Access to Odoo and Thirdparty addon Source\n\nYou can access the Odoo source by opening the VsCode workspace [full.code-workspace](full.code-workspace) from within\nthe Container. This will open a [Multi-Root Workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces).\nReally waiting for https://github.com/microsoft/vscode-remote-release/issues/3665 here.\n\n## Reset Devcontainer Data\n\nWhen you screwed up so bad its time to just start Over godoo has you covered:\n\n### Automatic Reset\n\nThere are 3 Options to reset the Dev Env.\n\n1. From **Outside** the Container run `make reset` in the project root to delete docker volumes and restart the\n container. (Vscode will prompt to reconnect if still open)\n2. From **Outside** the Container run `make reset-hard` in the project root to force rebuild the main Odoo container and\n then do the same as `make reset`\n3. From **Inside** the Container run `make reset` to drop the DB and delete varlib and the bootstrap flag, which is way\n quicker than the other options.\n\n### Manual Reset\n\n1. Close vscode\n2. Remove `app` and `db` container from docker.\n3. Remove volumes: `db, odoo_thirdparty, odoo_web, vscode_extensions`\n4. Restart Devcontainer\n\n## Python Debugging\n\n### VsCode Debugging\n\nDebugging doesn\'t reliably work with\n[Odoo Multiprocess](https://www.odoo.com/documentation/14.0/developer/misc/other/cmdline.html#multiprocessing) mode\nenabled. \\\nThe container ships with a Vscode Debug profile, that sets `--workers 0` to allow for Debugging Breakpoints. See [.vscode/launch.json](./.vscode/launch.json)\n\n### Interactive Shell\n\nUse `godoo shell` to enter an interactive shell on the Database.\n\n# Odoo Modules\n\n## Third Party Modules (manifest.yml)\n\nThe `godoo` bootstrap function, will download some modules using git. \\\nWhich Repos to download is specified in `ODOO_MANIFEST.yml` ([Default](./ODOO_MANIFEST.yml)) \\\nNot all of the cloned addons are automatically installed. \\\nInstall them via the Apps Page in Odoo using `godoo rpc modules install` or using `odoo-bin`.\\\nModules downloaded on the Odoo Marketplace can be dropped as a `.zip` archive in [./thirdparty](./thirdparty)\n',
|
|
51
|
-
'author': 'Joshua Kreuder',
|
|
52
|
-
'author_email': 'Joshua_Kreuder@outlook.com',
|
|
53
|
-
'maintainer': 'None',
|
|
54
|
-
'maintainer_email': 'None',
|
|
55
|
-
'url': 'https://github.com/OpenJKSoftware/gOdoo',
|
|
56
|
-
'package_dir': package_dir,
|
|
57
|
-
'packages': packages,
|
|
58
|
-
'package_data': package_data,
|
|
59
|
-
'install_requires': install_requires,
|
|
60
|
-
'extras_require': extras_require,
|
|
61
|
-
'entry_points': entry_points,
|
|
62
|
-
'python_requires': '>=3.8,<3.11',
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
setup(**setup_kwargs)
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import functools
|
|
2
|
-
import inspect
|
|
3
|
-
import logging
|
|
4
|
-
import os
|
|
5
|
-
import sys
|
|
6
|
-
from typing import Callable
|
|
7
|
-
|
|
8
|
-
import typer
|
|
9
|
-
from typer.models import ParameterInfo
|
|
10
|
-
|
|
11
|
-
LOGGER = logging.getLogger(__name__)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def check_dangerous_command():
|
|
15
|
-
isdev = str(os.getenv("WORKSPACE_IS_DEV"))
|
|
16
|
-
if not isdev.lower() == "true":
|
|
17
|
-
LOGGER.warning(
|
|
18
|
-
"""This function is dangerous in Production environments.
|
|
19
|
-
Please set 'WORKSPACE_IS_DEV=true' as environment Variable to continue
|
|
20
|
-
"""
|
|
21
|
-
)
|
|
22
|
-
exit(1)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def get_type_from_default(*args):
|
|
26
|
-
"""Decorator to add type annotations to function by Dataclass default values.
|
|
27
|
-
|
|
28
|
-
Used to tell typer CLI about the Argument types if they are applied via a Dataclass.
|
|
29
|
-
|
|
30
|
-
Default values are being searched on the dataclasses provided by *args.
|
|
31
|
-
If they are found, adds type to function annotations so that typer can read them later.
|
|
32
|
-
|
|
33
|
-
Parameters
|
|
34
|
-
----------
|
|
35
|
-
*args :
|
|
36
|
-
one or many dataclasses on which to search for default values
|
|
37
|
-
"""
|
|
38
|
-
annotation_source = args
|
|
39
|
-
|
|
40
|
-
def decorator(fun):
|
|
41
|
-
def wrapper():
|
|
42
|
-
fun_params = inspect.signature(fun).parameters
|
|
43
|
-
missing_annot = []
|
|
44
|
-
for param_name, param_val in fun_params.items():
|
|
45
|
-
param_default = param_val.default
|
|
46
|
-
if hasattr(param_default, "default") and isinstance(param_default.default, type(...)):
|
|
47
|
-
# Disable "default" in --help when Arg is required
|
|
48
|
-
param_default.show_default = False
|
|
49
|
-
if param_name not in fun.__annotations__:
|
|
50
|
-
missing_annot.append((param_name, param_default))
|
|
51
|
-
|
|
52
|
-
for param_name, param_default in missing_annot:
|
|
53
|
-
for source_class in annotation_source:
|
|
54
|
-
if source_param_name := next(
|
|
55
|
-
(k for k, v in source_class.__dict__.items() if v == param_default),
|
|
56
|
-
None,
|
|
57
|
-
):
|
|
58
|
-
if typ := source_class.__annotations__.get(source_param_name):
|
|
59
|
-
fun.__annotations__[param_name] = typ
|
|
60
|
-
break
|
|
61
|
-
return fun
|
|
62
|
-
|
|
63
|
-
return wrapper()
|
|
64
|
-
|
|
65
|
-
return decorator
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def typer_retuner(ret):
|
|
69
|
-
"""Exit Typer command with return code, if parent of calling function is not the typer_unpacker wrapper.
|
|
70
|
-
Will just return ret if ret is either not an integer, or the parent function was another python func.
|
|
71
|
-
|
|
72
|
-
Ensures, that we exit the CLI with a return code, only if the function is the CLI base command.
|
|
73
|
-
|
|
74
|
-
Parameters
|
|
75
|
-
----------
|
|
76
|
-
ret : Any
|
|
77
|
-
Value to either return or Exit
|
|
78
|
-
|
|
79
|
-
Returns
|
|
80
|
-
-------
|
|
81
|
-
Any
|
|
82
|
-
ret
|
|
83
|
-
"""
|
|
84
|
-
parent_func = sys._getframe(1).f_code.co_name
|
|
85
|
-
if isinstance(ret, int):
|
|
86
|
-
parent_name = sys._getframe(2).f_code.co_name
|
|
87
|
-
if parent_name != "typer_unwrapper":
|
|
88
|
-
LOGGER.debug("Exiting Typer Command: %s with code %s", parent_func, ret)
|
|
89
|
-
if ret > 255:
|
|
90
|
-
LOGGER.debug("Capping exit code to 255")
|
|
91
|
-
ret = 255
|
|
92
|
-
raise typer.Exit(code=ret)
|
|
93
|
-
LOGGER.debug("Returning Typer Command: %s", parent_func)
|
|
94
|
-
return ret
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def typer_unpacker(f: Callable):
|
|
98
|
-
"""
|
|
99
|
-
Apply as decorator to typer command function to make the function callable from python
|
|
100
|
-
if you used typer.Argument or typer.Option.
|
|
101
|
-
|
|
102
|
-
"""
|
|
103
|
-
|
|
104
|
-
@functools.wraps(f)
|
|
105
|
-
def typer_unwrapper(*args, **kwargs):
|
|
106
|
-
# Get the default function argument that aren't passed in kwargs via the
|
|
107
|
-
# inspect module: https://stackoverflow.com/a/12627202
|
|
108
|
-
missing_default_values = {
|
|
109
|
-
k: (v.default, v._annotation)
|
|
110
|
-
for k, v in inspect.signature(f).parameters.items()
|
|
111
|
-
if v.default is not inspect.Parameter.empty and k not in kwargs
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for name, (func_default, target_type) in missing_default_values.items():
|
|
115
|
-
# If the default value is a typer.Option or typer.Argument, we have to
|
|
116
|
-
# pull either the .default attribute and pass it in the function
|
|
117
|
-
# invocation, or call it first.
|
|
118
|
-
if isinstance(func_default, ParameterInfo):
|
|
119
|
-
if ev := func_default.envvar:
|
|
120
|
-
env_var = os.getenv(ev)
|
|
121
|
-
try:
|
|
122
|
-
if env_res := target_type(env_var) if target_type else env_var:
|
|
123
|
-
kwargs[name] = env_res
|
|
124
|
-
continue
|
|
125
|
-
except TypeError as e:
|
|
126
|
-
raise TypeError(
|
|
127
|
-
f"Type mismatch in: '{ev}' Expected: '{target_type}' Got: '{type(env_var)}"
|
|
128
|
-
) from e
|
|
129
|
-
if callable(func_default.default):
|
|
130
|
-
kwargs[name] = func_default.default()
|
|
131
|
-
else:
|
|
132
|
-
if func_default.default is Ellipsis:
|
|
133
|
-
raise ValueError(f"Missing required Argument for: {name}")
|
|
134
|
-
kwargs[name] = func_default.default
|
|
135
|
-
|
|
136
|
-
# Call the wrapped function with the defaults injected if not specified.
|
|
137
|
-
return f(*args, **kwargs)
|
|
138
|
-
|
|
139
|
-
return typer_unwrapper
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|