gOdoo-cli 0.1.2__tar.gz → 0.1.5__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 (32) hide show
  1. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/PKG-INFO +4 -2
  2. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/README.md +0 -1
  3. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/pyproject.toml +6 -1
  4. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/setup.py +3 -3
  5. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/__init__.py +1 -1
  6. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/bootstrap.py +64 -16
  7. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/launch.py +10 -45
  8. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/translations.py +2 -2
  9. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/shell.py +3 -3
  10. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/test.py +8 -3
  11. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/helpers/__init__.py +19 -0
  12. godoo_cli-0.1.5/src/godoo_cli/helpers/odoo_files.py +202 -0
  13. godoo_cli-0.1.2/src/godoo_cli/helpers/odoo_files.py +0 -141
  14. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/LICENSE +0 -0
  15. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/__main__.py +0 -0
  16. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/cli.py +0 -0
  17. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/__init__.py +0 -0
  18. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/makedev.py +0 -0
  19. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/__init__.py +0 -0
  20. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/cli.py +0 -0
  21. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/cli_callbacks.py +0 -0
  22. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/importer.py +0 -0
  23. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/rpc/modules.py +0 -0
  24. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/commands/source_get.py +0 -0
  25. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/__init__.py +0 -0
  26. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/git_odoo.py +0 -0
  27. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/git_odoo_addons.py +0 -0
  28. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/git_repo.py +0 -0
  29. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/git_url.py +0 -0
  30. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/git/zip_download.py +0 -0
  31. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/helpers/cli.py +0 -0
  32. {godoo_cli-0.1.2 → godoo_cli-0.1.5}/src/godoo_cli/helpers/odoo_manifest.py +0 -0
@@ -1,8 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: godoo-cli
3
- Version: 0.1.2
3
+ Version: 0.1.5
4
4
  Summary: Wrapper around Odoo-Bin with some convinience RPC functions.
5
+ Home-page: https://github.com/OpenJKSoftware/gOdoo
5
6
  License: LGPL-3
7
+ Keywords: odoo,godoo,devcontainer
6
8
  Author: Joshua Kreuder
7
9
  Author-email: Joshua_Kreuder@outlook.com
8
10
  Requires-Python: >=3.8,<3.11
@@ -30,6 +32,7 @@ Requires-Dist: rope (==0.23.0); extra == "devcontainer"
30
32
  Requires-Dist: ruamel-yaml (==0.17.21)
31
33
  Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
32
34
  Requires-Dist: watchdog (==2.1.7); extra == "devcontainer"
35
+ Project-URL: Repository, https://github.com/OpenJKSoftware/gOdoo
33
36
  Description-Content-Type: text/markdown
34
37
 
35
38
  # gOdoo Dev Environment
@@ -124,7 +127,6 @@ docker-compose up
124
127
  - You can enable godoo tab-completion by `godoo --install-completion`
125
128
  - `make` -> Loads Odoo + Workspace Addons
126
129
  - `make bare` -> Loads Odoo with ony `web` installed.
127
- - `make enterprise` -> godoo launch with `-i web_enterprise` parameter
128
130
  - `make kill` -> Search for `odoo-bin` processes and kill them
129
131
  - `make reset` -> Drops DB, deletes config file and datafolder
130
132
  - The full init script is available via "`godoo`". (See --help for Options)
@@ -90,7 +90,6 @@ docker-compose up
90
90
  - You can enable godoo tab-completion by `godoo --install-completion`
91
91
  - `make` -> Loads Odoo + Workspace Addons
92
92
  - `make bare` -> Loads Odoo with ony `web` installed.
93
- - `make enterprise` -> godoo launch with `-i web_enterprise` parameter
94
93
  - `make kill` -> Search for `odoo-bin` processes and kill them
95
94
  - `make reset` -> Drops DB, deletes config file and datafolder
96
95
  - The full init script is available via "`godoo`". (See --help for Options)
@@ -1,11 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "gOdoo-cli"
3
- version = "0.1.2"
3
+ version = "0.1.5"
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"
7
7
  readme = "README.md"
8
8
  packages = [{include = "godoo_cli", from = "src"}]
9
+ repository = "https://github.com/OpenJKSoftware/gOdoo"
10
+ keywords = ["odoo", "godoo","devcontainer"]
9
11
 
10
12
  [tool.poetry_bumpversion.file."src/godoo_cli/__init__.py"]
11
13
 
@@ -53,6 +55,9 @@ codequality = [
53
55
  requires = ["poetry-core>=1.0.0"]
54
56
  build-backend = "poetry.core.masonry.api"
55
57
 
58
+ [tool.pyright]
59
+ ignore="**/__manifest__.py"
60
+
56
61
  [tool.black]
57
62
  line-length = 120
58
63
 
@@ -40,14 +40,14 @@ entry_points = \
40
40
 
41
41
  setup_kwargs = {
42
42
  'name': 'godoo-cli',
43
- 'version': '0.1.2',
43
+ 'version': '0.1.5',
44
44
  'description': 'Wrapper around Odoo-Bin with some convinience RPC functions.',
45
- 'long_description': '# gOdoo Dev Environment\n\n![OdooLogo](https://raw.githubusercontent.com/OpenJKSoftware/gOdoo/main/assets/odoo_logo.png)\n![ComposeLogo](https://raw.githubusercontent.com/docker/compose/v2/logo.png)\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 enterprise` -> godoo launch with `-i web_enterprise` parameter\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',
45
+ 'long_description': '# gOdoo Dev Environment\n\n![OdooLogo](https://raw.githubusercontent.com/OpenJKSoftware/gOdoo/main/assets/odoo_logo.png)\n![ComposeLogo](https://raw.githubusercontent.com/docker/compose/v2/logo.png)\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',
46
46
  'author': 'Joshua Kreuder',
47
47
  'author_email': 'Joshua_Kreuder@outlook.com',
48
48
  'maintainer': 'None',
49
49
  'maintainer_email': 'None',
50
- 'url': 'None',
50
+ 'url': 'https://github.com/OpenJKSoftware/gOdoo',
51
51
  'package_dir': package_dir,
52
52
  'packages': packages,
53
53
  'package_data': package_data,
@@ -1,2 +1,2 @@
1
- __version__ = "0.1.2"
1
+ __version__ = "0.1.5"
2
2
  from .cli import launch_cli
@@ -1,21 +1,64 @@
1
1
  import logging
2
- import os
2
+ import re
3
3
  from pathlib import Path
4
4
  from typing import List
5
5
 
6
6
  import typer
7
7
 
8
+ from ..helpers import run_cmd
8
9
  from ..helpers.cli import typer_retuner, typer_unpacker
9
- from ..helpers.odoo_files import get_addon_paths, get_odoo_addons_in_folder
10
+ from ..helpers.odoo_files import _get_python_requirements_of_modules, get_addon_paths, get_odoo_module_paths
10
11
  from .source_get import get_source
11
12
 
12
13
  LOGGER = logging.getLogger(__name__)
13
14
 
14
15
 
16
+ def _install_py_reqs_for_modules(addon_paths: List[Path], module_names: List[str] = None):
17
+ """Install Python Requirements mentioned in odoo module manifests of given modules
18
+
19
+ Parameters
20
+ ----------
21
+ addon_paths : List[Path]
22
+ odoo-bin addons path
23
+ module_names : List[str], Optional
24
+ List of modules to filter for, by default "all available modules"
25
+
26
+ Returns
27
+ -------
28
+ CompletedProcess
29
+ """
30
+ py_reqs = _get_python_requirements_of_modules(addon_paths=addon_paths, filter_module_names=module_names)
31
+ if py_reqs:
32
+ LOGGER.info("Installing Python requirements: %s", ", ".join(py_reqs))
33
+ return run_cmd(f"pip install {' '.join(py_reqs)}")
34
+ LOGGER.debug("No py Requirements to be installed")
35
+
36
+
37
+ def _install_py_reqs_by_odoo_cmd(addon_paths: List[Path], odoo_bin_cmd: str):
38
+ """Install Python reqs for modules mentioned in odoo-bin commandline --init or -i directives.
39
+
40
+ Parameters
41
+ ----------
42
+ addon_paths : List[Path]
43
+ odoo-bin addons-path
44
+ odoo_bin_cmd : str
45
+ odoo-bin commandline
46
+
47
+ Returns
48
+ -------
49
+ CompletedProcess
50
+ """
51
+ install_modules = []
52
+ for m in re.finditer(r'(--init|-i) "?([^ \n]+)"?', odoo_bin_cmd):
53
+ install_modules += m.group(2).split(",")
54
+ if install_modules:
55
+ return _install_py_reqs_for_modules(addon_paths=addon_paths, module_names=install_modules)
56
+
57
+
15
58
  def _boostrap_command(
16
59
  odoo_main_path: Path,
17
60
  odoo_conf_path: Path,
18
- thirdparty_addon_path: Path,
61
+ addon_paths: List[Path],
19
62
  workspace_addon_path: Path,
20
63
  db_host: str,
21
64
  db_filter: str,
@@ -38,8 +81,8 @@ def _boostrap_command(
38
81
  folder with odoo-bin
39
82
  odoo_conf_path : Path
40
83
  path to odoo.conf
41
- thirdparty_addon_path : Path
42
- path that contains thirdparty addon repo folders
84
+ addon_paths : List[Path]
85
+ odoo bin --addons-path
43
86
  workspace_addon_path : Path
44
87
  path to addons in dev repo
45
88
  db_host : str
@@ -85,8 +128,8 @@ def _boostrap_command(
85
128
 
86
129
  LOGGER.info("Getting Addon Paths")
87
130
 
88
- workspace_addons = get_odoo_addons_in_folder(workspace_addon_path)
89
- if any(["-i" in i or "--init" in i for i in extra_cmd_args]):
131
+ workspace_addons = get_odoo_module_paths(workspace_addon_path)
132
+ if any([re.match(r"( |^)(-i|--init)", i) for i in extra_cmd_args]):
90
133
  init_modules = []
91
134
  else:
92
135
  init_modules = ["base", "web"] if install_base else []
@@ -94,12 +137,6 @@ def _boostrap_command(
94
137
  init_modules += [f.name for f in workspace_addons]
95
138
  init_cmd = "--init " + ",".join(init_modules) if init_modules else ""
96
139
 
97
- addon_paths = get_addon_paths(
98
- odoo_main_repo=odoo_main_path,
99
- workspace_addon_path=workspace_addon_path,
100
- zip_addon_path=thirdparty_addon_path / "custom", # !Todo Pull out into variable
101
- thirdparty_addon_path=thirdparty_addon_path,
102
- )
103
140
  addon_paths = [str(p.absolute()) for p in addon_paths]
104
141
  addon_paths = ", ".join(list(filter(None, addon_paths)))
105
142
 
@@ -155,11 +192,18 @@ def bootstrap_odoo(
155
192
  if update_source:
156
193
  get_source(ctx=ctx, remove_unspecified_addons=addons_remove_unspecified)
157
194
 
195
+ addon_paths = get_addon_paths(
196
+ odoo_main_repo=ctx.obj.odoo_main_path,
197
+ workspace_addon_path=ctx.obj.workspace_addon_path,
198
+ zip_addon_path=thirdparty_addon_path / "custom", # !Todo Pull out into variable
199
+ thirdparty_addon_path=thirdparty_addon_path,
200
+ )
201
+
158
202
  cmd_string = _boostrap_command(
159
203
  odoo_main_path=ctx.obj.odoo_main_path,
160
204
  odoo_conf_path=ctx.obj.odoo_conf_path,
161
- thirdparty_addon_path=thirdparty_addon_path,
162
205
  workspace_addon_path=ctx.obj.workspace_addon_path,
206
+ addon_paths=addon_paths,
163
207
  db_host=db_host,
164
208
  db_name=db_name,
165
209
  db_filter=db_filter,
@@ -172,8 +216,12 @@ def bootstrap_odoo(
172
216
  multithread_worker_count=multithread_worker_count,
173
217
  languages=languages,
174
218
  )
175
- LOGGER.info('Launching Bootstrap Commandline: "%s"', cmd_string)
176
- ret = os.system(cmd_string)
219
+
220
+ if update_source:
221
+ _install_py_reqs_by_odoo_cmd(addon_paths=addon_paths, odoo_bin_cmd=cmd_string)
222
+
223
+ LOGGER.info("Launching Bootstrap Commandline")
224
+ ret = run_cmd(cmd_string).returncode
177
225
  if ret == 0:
178
226
  ctx.obj.bootstrap_flag_location.touch()
179
227
  else:
@@ -1,5 +1,4 @@
1
1
  import logging
2
- import os
3
2
  import threading
4
3
  from pathlib import Path
5
4
  from typing import List
@@ -7,8 +6,9 @@ from typing import List
7
6
  import typer
8
7
 
9
8
  from ..commands.rpc.cli import rpc_callback
9
+ from ..helpers import run_cmd
10
10
  from ..helpers.cli import typer_retuner, typer_unpacker
11
- from ..helpers.odoo_files import get_odoo_addons_in_folder
11
+ from ..helpers.odoo_files import get_odoo_module_paths
12
12
  from .bootstrap import bootstrap_odoo
13
13
  from .makedev import makedev_config, makedev_rpc
14
14
  from .rpc import import_to_odoo
@@ -38,9 +38,7 @@ def _launch_command(
38
38
  upgrade_workspace_modules : bool, optional
39
39
  upgrade workspace addons, by default True
40
40
  """
41
- upgrade_addons = (
42
- [f.name for f in get_odoo_addons_in_folder(workspace_addon_path)] if upgrade_workspace_modules else []
43
- )
41
+ upgrade_addons = [f.name for f in get_odoo_module_paths(workspace_addon_path)] if upgrade_workspace_modules else []
44
42
  if any(["-u" in i or "--update" in i for i in extra_cmd_args]):
45
43
  upgrade_addons = []
46
44
  update_addon_string = "--update " + ",".join(upgrade_addons) if upgrade_addons else ""
@@ -54,39 +52,6 @@ def _launch_command(
54
52
  return " ".join(odoo_cmd)
55
53
 
56
54
 
57
- def _launch(
58
- odoo_path: Path,
59
- odoo_conf_path: Path,
60
- extra_cmd_args: List[str],
61
- workspace_addon_path: Path,
62
- upgrade_workspace_modules: bool = True,
63
- ):
64
- """Launches Odoo
65
-
66
- Parameters
67
- ----------
68
- odoo_path : Path
69
- Path to odoo-bin folder
70
- odoo_conf_path : Path
71
- Path to odoo.conf
72
- extra_cmd_args : List[str]
73
- extra args to pass to odoo-bin
74
- workspace_addon_path : Path
75
- Path to dev workspace addons folder
76
- upgrade_workspace_modules : bool, optional
77
- upgrade workspace addons, by default True
78
- """
79
- cmd_string = _launch_command(
80
- odoo_path=odoo_path,
81
- odoo_conf_path=odoo_conf_path,
82
- extra_cmd_args=extra_cmd_args,
83
- workspace_addon_path=workspace_addon_path,
84
- upgrade_workspace_modules=upgrade_workspace_modules,
85
- )
86
- LOGGER.info("Launching Odoo: '%s'", cmd_string)
87
- return os.system(cmd_string)
88
-
89
-
90
55
  @typer_unpacker
91
56
  def launch_odoo(
92
57
  ctx: typer.Context,
@@ -116,20 +81,19 @@ def launch_odoo(
116
81
 
117
82
  if ctx.obj.odoo_conf_path.exists() and prep_stage:
118
83
  makedev_config(ctx)
119
-
120
84
  LOGGER.info("Bootstrap Flag Status: %s", ctx.obj.bootstrap_flag_location.exists())
121
85
  bootstraped = False
122
86
  ret = ""
123
87
  if not ctx.obj.bootstrap_flag_location.exists():
124
- extra_odoo_args_bootstrap = extra_odoo_args.copy()
88
+ _extra_bootstrap_args = extra_odoo_args.copy()
125
89
  if ea := extra_bootstrap_args:
126
- extra_odoo_args_bootstrap += ea
90
+ _extra_bootstrap_args += ea
127
91
  if not odoo_demo:
128
- extra_odoo_args_bootstrap += ["--without-demo all"]
92
+ _extra_bootstrap_args += ["--without-demo all"]
129
93
 
130
94
  ret = bootstrap_odoo(
131
95
  ctx=ctx,
132
- extra_cmd_args=extra_odoo_args_bootstrap,
96
+ extra_cmd_args=_extra_bootstrap_args,
133
97
  install_base=install_modules,
134
98
  install_workspace_modules=install_workspace_addons and install_modules,
135
99
  multithread_worker_count=multithread_worker_count,
@@ -172,14 +136,15 @@ def launch_odoo(
172
136
  )
173
137
  loader_thread.start()
174
138
 
175
- ret = _launch(
139
+ cmd_string = _launch_command(
176
140
  odoo_path=ctx.obj.odoo_main_path,
177
141
  odoo_conf_path=ctx.obj.odoo_conf_path,
178
142
  extra_cmd_args=extra_odoo_args,
179
143
  workspace_addon_path=ctx.obj.workspace_addon_path,
180
144
  upgrade_workspace_modules=install_workspace_addons,
181
145
  )
182
- return typer_retuner(ret)
146
+ LOGGER.info("Launching Odoo")
147
+ return typer_retuner(run_cmd(cmd_string).returncode)
183
148
 
184
149
 
185
150
  def launch_cli_app():
@@ -6,7 +6,7 @@ import typer
6
6
  from godoo_rpc.login import wait_for_odoo
7
7
 
8
8
  from ...helpers.cli import typer_retuner
9
- from ...helpers.odoo_files import get_odoo_addons_in_folder
9
+ from ...helpers.odoo_files import get_odoo_module_paths
10
10
  from .cli import rpc_callback
11
11
  from .modules import rpc_get_modules
12
12
 
@@ -71,7 +71,7 @@ def dump_translations(
71
71
  ):
72
72
 
73
73
  addon_path = ctx.obj.workspace_addon_path
74
- addon_folders = get_odoo_addons_in_folder(addon_path)
74
+ addon_folders = get_odoo_module_paths(addon_path)
75
75
  valid_module_names = [str(p.stem) for p in addon_folders]
76
76
  LOGGER.debug("Found modules:\n%s", "\n".join(["\t" + mn for mn in valid_module_names]))
77
77
 
@@ -1,9 +1,9 @@
1
1
  import logging
2
- import os
3
2
  from typing import List
4
3
 
5
4
  import typer
6
5
 
6
+ from ..helpers import run_cmd
7
7
  from ..helpers.cli import typer_retuner, typer_unpacker
8
8
 
9
9
  LOGGER = logging.getLogger(__name__)
@@ -21,7 +21,7 @@ def uninstall_modules(
21
21
  uninstall_cmd = f"env['ir.module.module'].search([('name','in',{module_list_str})]).filtered(lambda m: m.state not in ['uninstallable','uninstalled']).button_immediate_uninstall()"
22
22
  uninstall_shell = f'echo "{uninstall_cmd}" | {str(ctx.obj.odoo_main_path.absolute())}/odoo-bin shell -c {str(ctx.obj.odoo_conf_path.absolute())} --no-http'
23
23
  LOGGER.info("Launching Uninstaller: '%s'", uninstall_shell)
24
- ret = os.system(uninstall_shell)
24
+ ret = run_cmd(uninstall_shell).returncode
25
25
  return typer_retuner(ret)
26
26
 
27
27
 
@@ -39,4 +39,4 @@ def odoo_shell(
39
39
  if pipe_in_command:
40
40
  shell_cmd = f'echo "{pipe_in_command}" |' + shell_cmd
41
41
  LOGGER.debug("Running Command: %s", shell_cmd)
42
- os.system(shell_cmd)
42
+ return typer_retuner(run_cmd(shell_cmd).returncode)
@@ -6,7 +6,7 @@ from typing import List
6
6
  import typer
7
7
 
8
8
  from ..helpers.cli import typer_retuner
9
- from ..helpers.odoo_files import get_changed_modules, get_depends_of_modules, get_odoo_addons_in_folder
9
+ from ..helpers.odoo_files import get_changed_modules, get_depends_of_module, get_odoo_module_paths
10
10
  from .launch import launch_odoo as launch_odoo
11
11
 
12
12
  LOGGER = logging.getLogger(__name__)
@@ -17,14 +17,19 @@ def _test_modules_special_cases(in_modules: List[str], workspace_addon_path: Pat
17
17
  command = in_modules[0]
18
18
  out_modules = []
19
19
  if command == "all":
20
- out_modules = get_odoo_addons_in_folder(workspace_addon_path)
20
+ out_modules = get_odoo_module_paths(workspace_addon_path)
21
21
 
22
22
  if re_match := re.match(r"changes\:(.*)", command):
23
23
  compare_branch = re_match.group(1)
24
24
  changed_modules = get_changed_modules(addon_path=workspace_addon_path, diff_branch=compare_branch)
25
25
  if not changed_modules:
26
26
  return []
27
- out_modules = get_depends_of_modules(workspace_addon_path, changed_modules)
27
+ change_modules_depends = []
28
+ for module in changed_modules:
29
+ change_modules_depends += get_depends_of_module(
30
+ out_modules, module, already_done_modules=change_modules_depends
31
+ )
32
+ out_modules = changed_modules + change_modules_depends
28
33
  if out_modules:
29
34
  out_modules_with_tests = [p for p in out_modules if any(p.rglob("tests/__init__.py"))]
30
35
  return [p.stem for p in out_modules_with_tests]
@@ -2,6 +2,7 @@
2
2
 
3
3
  import logging
4
4
  import os
5
+ import subprocess
5
6
  import sys
6
7
  from pathlib import Path
7
8
 
@@ -11,6 +12,24 @@ from rich.logging import RichHandler
11
12
  LOGGER = logging.getLogger(__name__)
12
13
 
13
14
 
15
+ def run_cmd(command: str) -> subprocess.CompletedProcess:
16
+ """Runs command via subprocess
17
+
18
+ Parameters
19
+ ----------
20
+ command : str
21
+ _description_
22
+
23
+ Returns
24
+ -------
25
+ _type_
26
+ _description_
27
+ """
28
+ LOGGER.debug("Launching Commandline: '%s'", command)
29
+ proc = subprocess.run(command, shell=True)
30
+ return proc
31
+
32
+
14
33
  def ensure_dotenv(varname: str) -> str:
15
34
  """
16
35
  Load Env Var.
@@ -0,0 +1,202 @@
1
+ """Functions that operate on Odoos Source Code."""
2
+ import logging
3
+ from ast import literal_eval
4
+ from pathlib import Path
5
+ from typing import List, Union
6
+
7
+ from git import Repo
8
+
9
+ LOGGER = logging.getLogger(__name__)
10
+
11
+
12
+ def get_odoo_module_paths(search_folders: Union[List[Path], Path]) -> List[Path]:
13
+ """List all Valid odoo module names in one or many Odoo addons folder.
14
+
15
+ Parameters
16
+ ----------
17
+ search_folders : Path
18
+ Folder(s) to search in.
19
+
20
+ Returns
21
+ -------
22
+ List[Path]
23
+ List of Valid Module Folders within search_folder
24
+ """
25
+ if not isinstance(search_folders, List):
26
+ search_folders = [search_folders]
27
+
28
+ module_paths = []
29
+ for folder in search_folders:
30
+ if not folder.exists():
31
+ return
32
+ for folder in folder.iterdir():
33
+ if folder.is_dir() and any(folder.glob("__manifest__.py")):
34
+ module_paths.append(folder)
35
+ return module_paths
36
+
37
+
38
+ def get_changed_modules(
39
+ addon_path: Path,
40
+ diff_branch: str,
41
+ ) -> List[Path]:
42
+ """Get Paths of changed modules since git diff.
43
+
44
+ Parameters
45
+ ----------
46
+ addon_path : Path
47
+ Folder in git repo where to look for changes
48
+ diff_branch : str
49
+ Branch or diffable ref for git
50
+
51
+ Returns
52
+ -------
53
+ List[Path]
54
+ List of Paths where something has changed since git diff
55
+ """
56
+ addon_path = addon_path.absolute()
57
+ repo = Repo(addon_path, search_parent_directories=True)
58
+ git_root = Path(repo.git.rev_parse("--show-toplevel"))
59
+ changed_module_files = []
60
+ for change in repo.git.diff("--name-status", diff_branch).split("\n"):
61
+ path = git_root / change.split("\t")[1]
62
+ if addon_path in path.parents:
63
+ changed_module_files.append(path)
64
+ changed_module_folders = list(set([f.parent.absolute() for f in changed_module_files]))
65
+ if changed_module_folders:
66
+ LOGGER.debug(
67
+ "Found Modules changed to branch '%s':\n %s",
68
+ diff_branch,
69
+ "\n".join(["\t" + str(f) for f in changed_module_folders]),
70
+ )
71
+ return changed_module_folders
72
+
73
+
74
+ def get_depends_of_module(
75
+ all_modules: List[Path],
76
+ module_to_check: Path,
77
+ already_done_modules: List[Path] = None,
78
+ ):
79
+ """Recursively Searches sub dependencies for Odoo modules.
80
+
81
+
82
+ Parameters
83
+ ----------
84
+ all_modules : List[Path]
85
+ List of Path objects pointing to odoo modules
86
+ module_to_check : Path
87
+ path with odoo module
88
+ already_done_modules : List[Path], optional
89
+ Only used internally for recursion caching, by default None
90
+
91
+ Returns
92
+ -------
93
+ List[Path]
94
+ Paths to dependency modules
95
+ """
96
+ manifest_path = module_to_check / "__manifest__.py"
97
+
98
+ if not already_done_modules:
99
+ already_done_modules = []
100
+ if module_to_check.absolute() in already_done_modules:
101
+ return []
102
+ already_done_modules.append(module_to_check.absolute())
103
+
104
+ LOGGER.debug("Loading Manifest: %s", manifest_path.absolute())
105
+ manifest = literal_eval(manifest_path.read_text())
106
+ module_depends = manifest.get("depends", [])
107
+ sub_depends = []
108
+ for dep in module_depends:
109
+ dep_path = [p for p in all_modules if p.stem == dep]
110
+ if dep_path:
111
+ dep_path = dep_path[0]
112
+ if dep_path.absolute() in already_done_modules:
113
+ continue
114
+ sub_depends.append(dep_path.absolute())
115
+ sub_depends += get_depends_of_module(all_modules, dep_path, already_done_modules)
116
+ elif dep != "base":
117
+ LOGGER.warn("Could not find Dependency: '%s' in available modules", dep)
118
+
119
+ return list(set(sub_depends))
120
+
121
+
122
+ def get_addon_paths(
123
+ odoo_main_repo: Path,
124
+ workspace_addon_path: Path,
125
+ zip_addon_path: Path,
126
+ thirdparty_addon_path: Path,
127
+ ) -> List[Path]:
128
+ """Get Odoo Addon Paths for odoo.conf.
129
+
130
+ Parameters
131
+ ----------
132
+ odoo_main_repo : Path
133
+ Path to main odoo repo
134
+ workspace_addon_path : Path
135
+ Path to workspace addons
136
+ zip_addon_path : Path
137
+ path to zip addons
138
+ thirdparty_addon_path : Path
139
+ path to git cloned addon repos
140
+
141
+ Returns
142
+ -------
143
+ List[Path]
144
+ List of valid addon Paths
145
+ """
146
+ odoo_addon_paths = [odoo_main_repo / "addons"]
147
+ if get_odoo_module_paths(workspace_addon_path):
148
+ odoo_addon_paths.append(workspace_addon_path)
149
+ zip_addon_repos = [f for f in zip_addon_path.iterdir() if f.is_dir() and get_odoo_module_paths(f)]
150
+ odoo_addon_paths += zip_addon_repos
151
+ git_thirdparty_addon_repos = [
152
+ p for p in thirdparty_addon_path.iterdir() if p.is_dir() and not p.resolve() == zip_addon_path.resolve()
153
+ ]
154
+ odoo_addon_paths += git_thirdparty_addon_repos
155
+ return odoo_addon_paths
156
+
157
+
158
+ def _get_python_requirements_of_modules(addon_paths: List[Path], filter_module_names: List[str] = None):
159
+ """Install python requirements mentioned in module manifests
160
+
161
+ Parameters
162
+ ----------
163
+ addon_paths : List[Path]
164
+ Paths to look for addons. (same as odoo-bin)
165
+ filter_module_names : List[str], optional
166
+ Modules to look for manifests, by default all available modules
167
+ """
168
+ available_modules = get_odoo_module_paths(addon_paths)
169
+ available_module_names = [p.stem for p in available_modules]
170
+
171
+ if not filter_module_names:
172
+ filter_module_names = available_module_names
173
+ filter_module_names = [f for f in filter_module_names if f not in ["base", "web"]]
174
+ LOGGER.info("Checking python requirements of Modules: %s", ", ".join(sorted(filter_module_names)))
175
+
176
+ if unavailable_modules := [m for m in filter_module_names if m not in available_module_names]:
177
+ LOGGER.warning("Couldn't search Python reqs for unavailable Modules: %s", ", ".join(unavailable_modules))
178
+
179
+ check_modules = [mp for mp in available_modules if mp.stem in filter_module_names]
180
+ check_modules_dependencies = []
181
+ for module in check_modules:
182
+ check_modules_dependencies += get_depends_of_module(
183
+ available_modules, module, already_done_modules=check_modules_dependencies
184
+ )
185
+ LOGGER.debug(
186
+ "adding child modules to check list: %s", ", ".join(sorted([p.stem for p in check_modules_dependencies]))
187
+ )
188
+
189
+ check_modules += check_modules_dependencies
190
+
191
+ if not check_modules:
192
+ LOGGER.debug("No Modules provided to check for python Requirements")
193
+ return
194
+ python_depends = []
195
+ for module_path in check_modules:
196
+ manifest_path = module_path / "__manifest__.py"
197
+ LOGGER.debug("Loading Manifest: %s", manifest_path.absolute())
198
+ manifest = literal_eval(manifest_path.read_text())
199
+ if module_depends := manifest.get("external_dependencies", {}).get("python"):
200
+ python_depends += module_depends
201
+
202
+ return list(set(python_depends))
@@ -1,141 +0,0 @@
1
- """Functions that operate on Odoos Source Code."""
2
- import logging
3
- from ast import literal_eval
4
- from pathlib import Path
5
- from typing import List
6
-
7
- from git import Repo
8
-
9
- LOGGER = logging.getLogger(__name__)
10
-
11
-
12
- def get_odoo_addons_in_folder(search_folder: Path) -> List[Path]:
13
- """List all Valid odoo module names in the Workspace addon folder.
14
-
15
- Parameters
16
- ----------
17
- search_folder : Path
18
- Folder to search in.
19
-
20
- Returns
21
- -------
22
- List[Path]
23
- List of Valid Module Folders within search_folder
24
- """
25
- module_paths = []
26
- if not search_folder.exists():
27
- return
28
- for folder in search_folder.iterdir():
29
- if folder.is_dir() and any(folder.glob("__manifest__.py")):
30
- module_paths.append(folder)
31
- return module_paths
32
-
33
-
34
- def get_changed_modules(
35
- addon_path: Path,
36
- diff_branch: str,
37
- ) -> List[Path]:
38
- """Get Paths of changed modules since git diff.
39
-
40
- Parameters
41
- ----------
42
- addon_path : Path
43
- Folder in git repo where to look for changes
44
- diff_branch : str
45
- Branch or diffable ref for git
46
-
47
- Returns
48
- -------
49
- List[Path]
50
- List of Paths where something has changed since git diff
51
- """
52
- addon_path = addon_path.absolute()
53
- repo = Repo(addon_path, search_parent_directories=True)
54
- git_root = Path(repo.git.rev_parse("--show-toplevel"))
55
- changed_module_files = []
56
- for change in repo.git.diff("--name-status", diff_branch).split("\n"):
57
- path = git_root / change.split("\t")[1]
58
- if addon_path in path.parents:
59
- changed_module_files.append(path)
60
- changed_module_folders = list(set([f.parent.absolute() for f in changed_module_files]))
61
- if changed_module_folders:
62
- LOGGER.debug(
63
- "Found Modules changed to branch '%s':\n %s",
64
- diff_branch,
65
- "\n".join(["\t" + str(f) for f in changed_module_folders]),
66
- )
67
- return changed_module_folders
68
-
69
-
70
- def get_depends_of_modules(addon_path: Path, in_module_paths: List[Path]) -> List[Path]:
71
- """Get Modules which do depend on given modules. Recursive.
72
-
73
- Parameters
74
- ----------
75
- addon_path : Path
76
- Folder where to look for Depends of in_module_paths
77
- in_module_paths : List[Path]
78
- List of Module Paths of which we want to get the downstream dependencies
79
-
80
- Returns
81
- -------
82
- List[Path]
83
- Union of in_module_paths and all their downstream depends.
84
- """
85
- all_modules = get_odoo_addons_in_folder(addon_path)
86
- if not in_module_paths:
87
- return
88
- added = True
89
- LOGGER.debug("Searching Depends for: %s", ", ".join([str(p) for p in in_module_paths]))
90
- out_depends = in_module_paths.copy()
91
- while added:
92
- added = False
93
- for module in all_modules:
94
- manifest_path = module / "__manifest__.py"
95
- current_module = module.absolute()
96
- if current_module in out_depends:
97
- continue
98
- LOGGER.debug("Loading Manifest: %s", manifest_path.absolute())
99
- manifest = literal_eval(manifest_path.read_text())
100
- module_depends = manifest.get("depends", [])
101
- if any(item.stem in module_depends for item in out_depends):
102
- out_depends.append(module.absolute())
103
- added = True
104
- LOGGER.debug("Found Depends: %s", ", ".join([str(d) for d in out_depends if d not in in_module_paths]))
105
- return out_depends
106
-
107
-
108
- def get_addon_paths(
109
- odoo_main_repo: Path,
110
- workspace_addon_path: Path,
111
- zip_addon_path: Path,
112
- thirdparty_addon_path: Path,
113
- ) -> List[Path]:
114
- """Get Odoo Addon Paths for odoo.conf.
115
-
116
- Parameters
117
- ----------
118
- odoo_main_repo : Path
119
- Path to main odoo repo
120
- workspace_addon_path : Path
121
- Path to workspace addons
122
- zip_addon_path : Path
123
- path to zip addons
124
- thirdparty_addon_path : Path
125
- path to git cloned addon repos
126
-
127
- Returns
128
- -------
129
- List[Path]
130
- List of valid addon Paths
131
- """
132
- odoo_addon_paths = [odoo_main_repo / "addons"]
133
- if get_odoo_addons_in_folder(workspace_addon_path):
134
- odoo_addon_paths.append(workspace_addon_path)
135
- zip_addon_repos = [f for f in zip_addon_path.iterdir() if f.is_dir() and get_odoo_addons_in_folder(f)]
136
- odoo_addon_paths += zip_addon_repos
137
- git_thirdparty_addon_repos = [
138
- p for p in thirdparty_addon_path.iterdir() if p.is_dir() and not p.resolve() == zip_addon_path.resolve()
139
- ]
140
- odoo_addon_paths += git_thirdparty_addon_repos
141
- return odoo_addon_paths
File without changes