Skip to content

Commit

Permalink
Refactor buildapi to use manifestoo_core function
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Oct 22, 2023
1 parent 3781d76 commit 223d2b9
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/whool/buildapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
from pathlib import Path
from typing import Any, Dict, List, Optional

from manifestoo_core.metadata import metadata_from_addon_dir
from manifestoo_core.metadata import (
distribution_name_to_addon_name,
metadata_from_addon_dir,
)

from .utils import load_pyproject_toml
from .version import version as whool_version
Expand All @@ -28,10 +31,6 @@ class WhoolException(Exception):
pass


class InvalidMetadata(WhoolException):
pass


class NoScmFound(WhoolException):
pass

Expand Down Expand Up @@ -142,16 +141,9 @@ def _get_metadata(addon_dir: Path) -> Message:
)


def _addon_name_from_metadata_name(metadata_name: str) -> str:
mo = METADATA_NAME_RE.match(metadata_name)
if not mo:
raise InvalidMetadata(f"{metadata_name} is not a valid Odoo addon package name")
return mo.group("addon_name").replace("-", "_")


def _build_wheel(addon_dir: Path, wheel_directory: Path, editable: bool) -> str:
metadata = _get_metadata(addon_dir)
addon_name = _addon_name_from_metadata_name(metadata["Name"])
addon_name = distribution_name_to_addon_name(metadata["Name"])
with tempfile.TemporaryDirectory() as tmpdir:
tmppath = Path(tmpdir)
# always include metadata
Expand Down

0 comments on commit 223d2b9

Please sign in to comment.