odoo-dev 0.2.3__tar.gz → 0.2.4__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.
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/PKG-INFO +2 -1
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/pyproject.toml +2 -1
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/__init__.py +1 -1
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/commands/setup.py +45 -8
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_integration.py +13 -4
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_setup.py +32 -1
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/uv.lock +1 -1
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/.claude/settings.local.json +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/.gitignore +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/.gitmodules +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/.python-version +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/README.md +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/cli.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/commands/__init__.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/commands/db.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/commands/docker.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/commands/run.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/config.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/utils/__init__.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/src/odoo_dev/utils/console.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/__init__.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/__init__.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.git +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.gitignore +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.gitlab-ci.yml +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.gitmodules +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/.git +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/.gitignore +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/Dockerfile +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/Makefile +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/README.md +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/compose.yaml +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/docker-entrypoint.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/install.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/odoo-dev.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/odoo.conf +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/vscode/launch.json +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/vscode/settings.json +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/vscode/tasks.json +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/uninstall.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.repos/.gitkeep +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/Notes/Warning Upgrade all +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/README.md +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/addons/.gitkeep +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/note.txt +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/requirements.txt +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/abstorelsymlink.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/adaptation.md +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/after_migration.sh +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/checkout2 +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/cleanup.sql +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/deploy +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/fix_mail_templates.sql +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/gitpull +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/main.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/modules_cleanup.sql +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/post-upgrade steps.md +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/pre_commit_hook.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/requirements.txt +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/test +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/tools/update_addon_versions.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_cli.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_config.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_db.py +0 -0
- {odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/test_run.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: odoo-dev
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Odoo Development Environment Helper
|
|
5
5
|
Project-URL: Homepage, https://git.bemade.org/bemade/odoo-dev
|
|
6
6
|
Project-URL: Repository, https://git.bemade.org/bemade/odoo-dev
|
|
7
7
|
Project-URL: Issues, https://git.bemade.org/bemade/odoo-dev/-/issues
|
|
8
|
+
License-Expression: LGPL-3.0
|
|
8
9
|
Requires-Python: >=3.12
|
|
9
10
|
Requires-Dist: rich>=13.0.0
|
|
10
11
|
Requires-Dist: typer>=0.9.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "odoo-dev"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "Odoo Development Environment Helper"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
@@ -8,6 +8,7 @@ dependencies = [
|
|
|
8
8
|
"typer>=0.9.0",
|
|
9
9
|
"rich>=13.0.0",
|
|
10
10
|
]
|
|
11
|
+
license = "LGPL-3.0"
|
|
11
12
|
|
|
12
13
|
[project.urls]
|
|
13
14
|
Homepage = "https://git.bemade.org/bemade/odoo-dev"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Setup commands for initializing Odoo development environment."""
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import shutil
|
|
4
5
|
import subprocess
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
@@ -75,12 +76,27 @@ def _update_env_file(env_file: Path, updates: dict[str, str]) -> None:
|
|
|
75
76
|
env_file.write_text(content + "\n")
|
|
76
77
|
|
|
77
78
|
|
|
79
|
+
def _clean():
|
|
80
|
+
cfg = load_config()
|
|
81
|
+
success("Cleaning up current environment...")
|
|
82
|
+
for name in ["odoo", "enterprise", "design-themes", "industry", ".venv"]:
|
|
83
|
+
path = cfg.project_dir / name
|
|
84
|
+
if path.exists():
|
|
85
|
+
shutil.rmtree(path)
|
|
86
|
+
success("Clean up complete.")
|
|
87
|
+
|
|
88
|
+
|
|
78
89
|
def setup(
|
|
79
90
|
community: bool = typer.Option(
|
|
80
91
|
False,
|
|
81
92
|
"--community",
|
|
82
93
|
help="Set up Community edition only (skip Enterprise repos)",
|
|
83
94
|
),
|
|
95
|
+
clean: bool = typer.Option(
|
|
96
|
+
False,
|
|
97
|
+
"--clean",
|
|
98
|
+
help="Clean up before setup (remove existing venv, etc.)",
|
|
99
|
+
),
|
|
84
100
|
) -> None:
|
|
85
101
|
"""Complete setup: clone Odoo repos, configure VSCode, build image."""
|
|
86
102
|
# Prompt for versions if not configured
|
|
@@ -88,6 +104,8 @@ def setup(
|
|
|
88
104
|
|
|
89
105
|
cfg = load_config()
|
|
90
106
|
|
|
107
|
+
if clean:
|
|
108
|
+
_clean()
|
|
91
109
|
success("Setting up complete Odoo development environment...")
|
|
92
110
|
|
|
93
111
|
# Initialize/update git submodules first
|
|
@@ -305,22 +323,25 @@ def _clone_odoo_repos(cfg, community_only: bool = False) -> None:
|
|
|
305
323
|
if community_only:
|
|
306
324
|
warning("Community edition mode: Enterprise repositories will be skipped")
|
|
307
325
|
|
|
326
|
+
# Use HTTPS for odoo (public), SSH for all others (private)
|
|
308
327
|
repos = [
|
|
309
|
-
(
|
|
310
|
-
(f"git@github.com:odoo/design-themes.git", "design-themes", cfg.odoo_version),
|
|
328
|
+
("https://github.com/odoo/odoo.git", "odoo", cfg.odoo_version),
|
|
311
329
|
]
|
|
312
330
|
|
|
313
|
-
#
|
|
331
|
+
# Private repos require SSH
|
|
332
|
+
repos.append(
|
|
333
|
+
("git@github.com:odoo/design-themes.git", "design-themes", cfg.odoo_version)
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
# Add enterprise if not community only (private repo, needs SSH)
|
|
314
337
|
if not community_only:
|
|
315
338
|
repos.append(
|
|
316
|
-
(
|
|
339
|
+
("git@github.com:odoo/enterprise.git", "enterprise", cfg.odoo_version)
|
|
317
340
|
)
|
|
318
341
|
|
|
319
|
-
# Add industry for Odoo 18+
|
|
342
|
+
# Add industry for Odoo 18+ (private repo)
|
|
320
343
|
if cfg.odoo_version.startswith("18") or cfg.odoo_version.startswith("19"):
|
|
321
|
-
repos.append(
|
|
322
|
-
(f"git@github.com:odoo/industry.git", "industry", cfg.odoo_version)
|
|
323
|
-
)
|
|
344
|
+
repos.append(("git@github.com:odoo/industry.git", "industry", cfg.odoo_version))
|
|
324
345
|
|
|
325
346
|
for repo_url, repo_dir, branch in repos:
|
|
326
347
|
repo_path = cfg.project_dir / repo_dir
|
|
@@ -355,6 +376,15 @@ def _clone_odoo_repos(cfg, community_only: bool = False) -> None:
|
|
|
355
376
|
success("Odoo repositories setup complete.")
|
|
356
377
|
|
|
357
378
|
|
|
379
|
+
def _can_sudo_without_password() -> bool:
|
|
380
|
+
"""Check if sudo can run without prompting for password."""
|
|
381
|
+
result = subprocess.run(
|
|
382
|
+
["sudo", "-n", "true"],
|
|
383
|
+
capture_output=True,
|
|
384
|
+
)
|
|
385
|
+
return result.returncode == 0
|
|
386
|
+
|
|
387
|
+
|
|
358
388
|
def _install_system_dependencies() -> None:
|
|
359
389
|
"""Install system dependencies based on OS."""
|
|
360
390
|
import platform
|
|
@@ -376,6 +406,13 @@ def _install_system_dependencies() -> None:
|
|
|
376
406
|
check=False,
|
|
377
407
|
)
|
|
378
408
|
elif system == "Linux":
|
|
409
|
+
if not _can_sudo_without_password():
|
|
410
|
+
warning(
|
|
411
|
+
"Cannot run sudo without password. "
|
|
412
|
+
"Please install system dependencies manually or run with sudo."
|
|
413
|
+
)
|
|
414
|
+
return
|
|
415
|
+
|
|
379
416
|
success("Installing dependencies for Linux...")
|
|
380
417
|
subprocess.run(
|
|
381
418
|
[
|
|
@@ -10,6 +10,7 @@ from typer.testing import CliRunner
|
|
|
10
10
|
|
|
11
11
|
from odoo_dev.cli import app
|
|
12
12
|
from odoo_dev.config import load_config
|
|
13
|
+
from odoo_dev.commands import setup
|
|
13
14
|
|
|
14
15
|
runner = CliRunner()
|
|
15
16
|
|
|
@@ -20,7 +21,9 @@ FIXTURE_DIR = Path(__file__).parent / "fixtures" / "odoo-empty"
|
|
|
20
21
|
def fixture_dir() -> Path:
|
|
21
22
|
"""Return the path to the odoo-empty fixture."""
|
|
22
23
|
if not FIXTURE_DIR.exists():
|
|
23
|
-
pytest.skip(
|
|
24
|
+
pytest.skip(
|
|
25
|
+
"odoo-empty fixture not available (run: git submodule update --init)"
|
|
26
|
+
)
|
|
24
27
|
return FIXTURE_DIR
|
|
25
28
|
|
|
26
29
|
|
|
@@ -109,11 +112,14 @@ def setup_fixture_env():
|
|
|
109
112
|
result = runner.invoke(
|
|
110
113
|
app,
|
|
111
114
|
["setup", "--community"],
|
|
112
|
-
|
|
115
|
+
# Odoo 19.0, Python 3.12, no save to .env, no docker
|
|
116
|
+
input="19.0\n3.12\nn\nn\n",
|
|
113
117
|
)
|
|
114
118
|
|
|
115
119
|
if result.exit_code != 0:
|
|
116
|
-
pytest.
|
|
120
|
+
pytest.fail(
|
|
121
|
+
f"Setup failed (exit code {result.exit_code}):\n{result.output}"
|
|
122
|
+
)
|
|
117
123
|
|
|
118
124
|
yield FIXTURE_DIR
|
|
119
125
|
|
|
@@ -156,7 +162,10 @@ class TestRunCommandsWithoutPrerequisites:
|
|
|
156
162
|
def test_run_fails_without_venv(self, in_clean_fixture: Path):
|
|
157
163
|
result = runner.invoke(app, ["run"])
|
|
158
164
|
assert result.exit_code != 0
|
|
159
|
-
assert
|
|
165
|
+
assert (
|
|
166
|
+
"Virtual environment not found" in result.output
|
|
167
|
+
or "not found" in result.output.lower()
|
|
168
|
+
)
|
|
160
169
|
|
|
161
170
|
def test_shell_fails_without_venv(self, in_clean_fixture: Path):
|
|
162
171
|
result = runner.invoke(app, ["shell", "testdb"])
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Tests for setup command utilities."""
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
+
from unittest.mock import patch
|
|
4
5
|
|
|
5
|
-
from odoo_dev.commands.setup import _update_env_file
|
|
6
|
+
from odoo_dev.commands.setup import _clean, _update_env_file
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class TestUpdateEnvFile:
|
|
@@ -51,3 +52,33 @@ class TestUpdateEnvFile:
|
|
|
51
52
|
assert "NEW_VAR=new" in content
|
|
52
53
|
assert "VAR=value" in content
|
|
53
54
|
# Comments are not preserved (simplification)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class TestClean:
|
|
58
|
+
"""Test _clean function."""
|
|
59
|
+
|
|
60
|
+
def test_clean_removes_directories(self, tmp_path: Path):
|
|
61
|
+
"""Verify _clean removes expected directories."""
|
|
62
|
+
# Create directories that _clean should remove
|
|
63
|
+
for name in ["odoo", "enterprise", "design-themes", "industry", ".venv"]:
|
|
64
|
+
(tmp_path / name).mkdir()
|
|
65
|
+
|
|
66
|
+
# Mock load_config to return our tmp_path as project_dir
|
|
67
|
+
mock_cfg = type("Config", (), {"project_dir": tmp_path})()
|
|
68
|
+
with patch("odoo_dev.commands.setup.load_config", return_value=mock_cfg):
|
|
69
|
+
_clean()
|
|
70
|
+
|
|
71
|
+
# Verify all directories were removed
|
|
72
|
+
for name in ["odoo", "enterprise", "design-themes", "industry", ".venv"]:
|
|
73
|
+
assert not (tmp_path / name).exists(), f"{name} should be removed"
|
|
74
|
+
|
|
75
|
+
def test_clean_ignores_missing_directories(self, tmp_path: Path):
|
|
76
|
+
"""Verify _clean doesn't fail if directories don't exist."""
|
|
77
|
+
# Only create some directories
|
|
78
|
+
(tmp_path / "odoo").mkdir()
|
|
79
|
+
|
|
80
|
+
mock_cfg = type("Config", (), {"project_dir": tmp_path})()
|
|
81
|
+
with patch("odoo_dev.commands.setup.load_config", return_value=mock_cfg):
|
|
82
|
+
_clean() # Should not raise
|
|
83
|
+
|
|
84
|
+
assert not (tmp_path / "odoo").exists()
|
|
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
|
{odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/docker-entrypoint.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/odoo.conf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{odoo_dev-0.2.3 → odoo_dev-0.2.4}/tests/fixtures/odoo-empty/.odoo-deploy/templates/vscode/tasks.json
RENAMED
|
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
|