gOdoo-cli 0.4.1__tar.gz → 0.4.3__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.1 → godoo_cli-0.4.3}/PKG-INFO +9 -8
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/pyproject.toml +16 -7
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/setup.py +9 -8
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/cli_common.py +6 -7
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/bootstrap.py +15 -7
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/launch.py +5 -3
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/git_repo.py +4 -1
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/helpers/bootstrap.py +4 -1
- godoo_cli-0.4.3/src/godoo_cli/helpers/cli.py +15 -0
- godoo_cli-0.4.3/src/godoo_cli/version.py +1 -0
- godoo_cli-0.4.1/src/godoo_cli/helpers/cli.py +0 -139
- godoo_cli-0.4.1/src/godoo_cli/version.py +0 -1
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/LICENSE +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/README.md +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/__main__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/cli.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/config.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/db/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/db/cli.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/db/connection.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/db/passwords.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/rpc/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/rpc/cli.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/rpc/importer.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/rpc/modules.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/rpc/translations.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/shell.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/source_get.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/commands/test.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/git_odoo.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/git_odoo_addons.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/git_url.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/git/zip_download.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/helpers/__init__.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/helpers/odoo_files.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
- {godoo_cli-0.4.1 → godoo_cli-0.4.3}/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.4.
|
|
3
|
+
Version: 0.4.3
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "gOdoo-cli"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.3"
|
|
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
|
|
|
@@ -17,20 +17,21 @@ package_data = \
|
|
|
17
17
|
|
|
18
18
|
install_requires = \
|
|
19
19
|
['gitpython>=3.1.27,<4.0.0',
|
|
20
|
-
'godoo-rpc
|
|
20
|
+
'godoo-rpc>=0.1.1,<0.2.0',
|
|
21
21
|
'openupgradelib>=3.3.4,<4.0.0',
|
|
22
|
-
'passlib>=1.7.
|
|
23
|
-
'psycopg2>=2.
|
|
22
|
+
'passlib>=1.7.3,<2.0.0',
|
|
23
|
+
'psycopg2>=2.8.6,<3.0.0',
|
|
24
24
|
'python-dotenv>=0.20.0,<0.21.0',
|
|
25
|
-
'rich>=12.6.0,<13.0.0',
|
|
26
25
|
'ruamel-yaml>=0.17.21,<0.18.0',
|
|
27
|
-
'typer
|
|
26
|
+
'typer-common-functions>=0.0.3,<0.0.4']
|
|
28
27
|
|
|
29
28
|
extras_require = \
|
|
30
29
|
{'codequality': ['pylint-odoo>=8.0.16,<9.0.0',
|
|
31
30
|
'black>=22.10.0,<23.0.0',
|
|
32
31
|
'isort>=5.10.1,<6.0.0',
|
|
33
|
-
'flake8>=5.0.4,<6.0.0'
|
|
32
|
+
'flake8>=5.0.4,<6.0.0',
|
|
33
|
+
'pytest>=7.2.1,<8.0.0',
|
|
34
|
+
'pytest-cov>=4.0.0,<5.0.0'],
|
|
34
35
|
'devcontainer': ['ipdb>=0.13.9,<0.14.0',
|
|
35
36
|
'debugpy>=1.6.0,<2.0.0',
|
|
36
37
|
'pre-commit>=2.20.0,<3.0.0',
|
|
@@ -45,7 +46,7 @@ entry_points = \
|
|
|
45
46
|
|
|
46
47
|
setup_kwargs = {
|
|
47
48
|
'name': 'godoo-cli',
|
|
48
|
-
'version': '0.4.
|
|
49
|
+
'version': '0.4.3',
|
|
49
50
|
'description': 'Wrapper around Odoo-Bin with some convinience RPC functions.',
|
|
50
51
|
'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
52
|
'author': 'Joshua Kreuder',
|
|
@@ -59,7 +60,7 @@ setup_kwargs = {
|
|
|
59
60
|
'install_requires': install_requires,
|
|
60
61
|
'extras_require': extras_require,
|
|
61
62
|
'entry_points': entry_points,
|
|
62
|
-
'python_requires': '>=3.8,<3.
|
|
63
|
+
'python_requires': '>=3.8.1,<3.12',
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
|
|
@@ -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(
|
|
@@ -170,10 +169,10 @@ class SourceGetArgs:
|
|
|
170
169
|
|
|
171
170
|
class CommonCLI:
|
|
172
171
|
def __init__(self) -> None:
|
|
173
|
-
self.odoo_paths = OdooPathCLIArgs
|
|
174
|
-
self.odoo_launch = OdooLaunchArgs
|
|
175
|
-
self.database = DatabaseCLIArgs
|
|
176
|
-
self.rpc = RpcCLIArgs
|
|
172
|
+
self.odoo_paths = OdooPathCLIArgs
|
|
173
|
+
self.odoo_launch = OdooLaunchArgs
|
|
174
|
+
self.database = DatabaseCLIArgs
|
|
175
|
+
self.rpc = RpcCLIArgs
|
|
177
176
|
self.source = SourceGetArgs
|
|
178
177
|
self.returner = typer_retuner
|
|
179
178
|
self.unpacker = typer_unpacker
|
|
@@ -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,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import re
|
|
2
3
|
import threading
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
from typing import List
|
|
@@ -158,10 +159,11 @@ def pre_launch(
|
|
|
158
159
|
no_install_workspace_modules=not install_workspace_addons,
|
|
159
160
|
multithread_worker_count=multithread_worker_count,
|
|
160
161
|
)
|
|
161
|
-
install_workspace_addons = True
|
|
162
162
|
bootstraped = ret == 0
|
|
163
163
|
if not bootstraped:
|
|
164
164
|
return ret
|
|
165
|
+
if install_workspace_addons and bootstraped:
|
|
166
|
+
install_workspace_addons = False
|
|
165
167
|
|
|
166
168
|
if launch_or_bootstrap:
|
|
167
169
|
return
|
|
@@ -182,7 +184,7 @@ def pre_launch(
|
|
|
182
184
|
odoo_conf_path=odoo_conf_path,
|
|
183
185
|
extra_cmd_args=extra_odoo_args,
|
|
184
186
|
workspace_addon_path=workspace_addon_path,
|
|
185
|
-
upgrade_workspace_modules=
|
|
187
|
+
upgrade_workspace_modules=install_workspace_addons,
|
|
186
188
|
)
|
|
187
189
|
|
|
188
190
|
|
|
@@ -300,7 +302,7 @@ def launch_import(
|
|
|
300
302
|
LOGGER.error("godoo Launch Failed. Bootstrap unsuccessfull. Aborting Launch...")
|
|
301
303
|
return CLI.returner(launch_cmd)
|
|
302
304
|
|
|
303
|
-
launch_cmd =
|
|
305
|
+
launch_cmd = re.sub(r"(--dev [\w,]+)(,reload)", r"\1", launch_cmd) # Remove reload option from CMD String
|
|
304
306
|
|
|
305
307
|
LOGGER.info("Starting Data Importer Thread for: '%s'", ", ".join(map(str, load_data_path)))
|
|
306
308
|
loader_thread = threading.Thread(
|
|
@@ -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.4.3"
|
|
@@ -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.1"
|
|
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
|
|
File without changes
|
|
File without changes
|