88import sys
99import tempfile
1010from pathlib import Path
11- from typing import Tuple , Union
11+ from typing import Union
1212
1313from .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
1515from .process import check_call
1616from .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(
132109def 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]\n long_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 )
0 commit comments