Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions trobz_local/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,10 @@ def create_venvs(ctx: typer.Context):
"create-venvs",
)

# Arch Linux: OpenLDAP 2.5+ removed libldap_r.so but python-ldap<=3.4.3
# hardcodes it in setup.cfg. Create a compatibility symlink before building.
_ensure_libldap_r_symlink()

uv_path = get_uv_path()
odoo_dir_base = code_root / "odoo" / "odoo"
create_launcher = config.get("create_launcher", True)
Expand Down Expand Up @@ -458,6 +462,30 @@ def create_venvs(ctx: typer.Context):
typer.secho("\nAll virtual environments created successfully.", fg=typer.colors.GREEN)


def _ensure_libldap_r_symlink():
"""On Arch, OpenLDAP 2.5+ removed libldap_r.so; create symlink for python-ldap<=3.4.3."""
os_info = get_os_info()
if os_info.get("distro") != "arch":
return

libldap_r = Path("/usr/lib/libldap_r.so")
if libldap_r.exists():
return

typer.echo("Arch Linux detected: creating libldap_r.so symlink for python-ldap compatibility...")
try:
subprocess.run( # noqa: S603
["sudo", "ln", "-sf", "/usr/lib/libldap.so", str(libldap_r)], # noqa: S607
check=True,
)
typer.secho("✓ Created /usr/lib/libldap_r.so → libldap.so", fg=typer.colors.GREEN)
except subprocess.CalledProcessError:
typer.secho(
"✗ Failed to create symlink. Run manually:\n sudo ln -sf /usr/lib/libldap.so /usr/lib/libldap_r.so",
fg=typer.colors.RED,
)


def _create_venvs(
progress: Progress,
task_id: TaskID,
Expand Down
Loading