Skip to content

Commit feaafe0

Browse files
committed
Remove legacy wheel build mechanism
Setuptools has deprecated and will soon stop supporting setup.py bdist_wheel, so remove that mechanism.
1 parent d21fedd commit feaafe0

File tree

3 files changed

+7
-35
lines changed

3 files changed

+7
-35
lines changed

src/oca_github_bot/build_wheels.py

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
import sys
99
import tempfile
1010
from pathlib import Path
11-
from typing import Tuple, Union
11+
from typing import Union
1212

1313
from .config import WHEEL_BUILD_TOOLS
14-
from .manifest import addon_dirs_in, get_manifest, get_odoo_series_from_version
14+
from .manifest import addon_dirs_in, get_manifest
1515
from .process import check_call
1616
from .pypi import DistPublisher
1717

@@ -65,25 +65,6 @@ def build_wheel(self, project_dir: Path, dist_dir: str) -> None:
6565
self._check_wheels(dist_dir)
6666
return True
6767

68-
def build_wheel_legacy(
69-
self, project_dir: Path, dist_dir: str, python_tag: Union[str, None] = None
70-
) -> None:
71-
with tempfile.TemporaryDirectory() as bdist_dir:
72-
cmd = [
73-
self.env_python,
74-
"setup.py",
75-
"bdist_wheel",
76-
"--dist-dir",
77-
dist_dir,
78-
"--bdist-dir",
79-
bdist_dir,
80-
]
81-
if python_tag:
82-
cmd.extend(["--python-tag", python_tag])
83-
check_call(cmd, cwd=project_dir)
84-
self._check_wheels(dist_dir)
85-
return True
86-
8768
def _check_wheels(self, dist_dir: Path) -> None:
8869
wheels = [f for f in os.listdir(dist_dir) if f.endswith(".whl")]
8970
check_call(["twine", "check"] + wheels, cwd=dist_dir)
@@ -93,16 +74,12 @@ def build_addon_wheel(self, addon_dir: Path, dist_dir: str) -> None:
9374
if not manifest.get("installable", True):
9475
return False
9576

96-
series = get_odoo_series_from_version(manifest.get("version", ""))
97-
98-
if series >= (12, 0) and (addon_dir / "pyproject.toml").is_file():
77+
if (addon_dir / "pyproject.toml").is_file():
9978
return self.build_wheel(addon_dir, dist_dir)
10079

10180
setup_py_dir = addon_dir / ".." / "setup" / addon_dir.name
102-
if series >= (8, 0) and (setup_py_dir / "setup.py").is_file():
103-
return self.build_wheel_legacy(
104-
setup_py_dir, dist_dir, python_tag="py2" if series < (11, 0) else "py3"
105-
)
81+
if (setup_py_dir / "setup.py").is_file():
82+
return self.build_wheel(setup_py_dir, dist_dir)
10683

10784
return False
10885

@@ -132,7 +109,6 @@ def build_and_publish_wheels(
132109
def build_and_publish_metapackage_wheel(
133110
addons_dir: str,
134111
dist_publisher: DistPublisher,
135-
series: Tuple[int, int],
136112
dry_run: bool,
137113
):
138114
setup_dir = Path(addons_dir) / "setup" / "_metapackage"
@@ -148,7 +124,5 @@ def build_and_publish_metapackage_wheel(
148124
setup_dir.joinpath("setup.cfg").write_text(
149125
"[metadata]\nlong_description = UNKNOWN\n"
150126
)
151-
if Builder.get().build_wheel_legacy(
152-
setup_dir, dist_dir, python_tag="py2" if series < (11, 0) else "py3"
153-
):
127+
if Builder.get().build_wheel(setup_dir, dist_dir):
154128
dist_publisher.publish(dist_dir, dry_run)

src/oca_github_bot/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def func_wrapper(*args, **kwargs):
144144
).split(",")
145145

146146
# minimum Odoo series supported by the bot
147-
MAIN_BRANCH_BOT_MIN_VERSION = os.environ.get("MAIN_BRANCH_BOT_MIN_VERSION", "8.0")
147+
MAIN_BRANCH_BOT_MIN_VERSION = os.environ.get("MAIN_BRANCH_BOT_MIN_VERSION", "11.0")
148148

149149
# First Odoo Series for which the whool_init and gen_metapackage tasks are run on main
150150
# branches. For previous versions, the setuptools_odoo task is run and generates

src/oca_github_bot/tasks/main_branch_bot.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
switchable,
1313
)
1414
from ..github import git_commit_if_needed, git_push_if_needed, temporary_clone
15-
from ..manifest import get_odoo_series_from_branch
1615
from ..process import check_call
1716
from ..queue import getLogger, task
1817
from ..version_branch import is_main_branch_bot_branch, is_supported_main_branch
@@ -144,7 +143,6 @@ def main_branch_bot(org, repo, branch, build_wheels, dry_run=False):
144143
build_and_publish_metapackage_wheel(
145144
clone_dir,
146145
dist_publisher,
147-
get_odoo_series_from_branch(branch),
148146
dry_run,
149147
)
150148

0 commit comments

Comments
 (0)