Convert _build_one from method to function
It does not rely on WheelBuilder anymore.
@@ -160,20 +160,7 @@ def _always_true(_):
return True
-class WheelBuilder(object):
- """Build wheels from a RequirementSet."""
-
- def __init__(
- self,
- preparer, # type: RequirementPreparer
- wheel_cache, # type: WheelCache
- ):
- # type: (...) -> None
- self.preparer = preparer
- self.wheel_cache = wheel_cache
-
def _build_one(
- self,
req, # type: InstallRequirement
output_dir, # type: str
build_options, # type: List[str]
@@ -195,12 +182,12 @@ class WheelBuilder(object):
# Install build deps into temporary directory (PEP 518)
with req.build_env:
- return self._build_one_inside_env(
+ return _build_one_inside_env(
req, output_dir, build_options, global_options
)
+
def _build_one_inside_env(
- self,
req, # type: InstallRequirement
output_dir, # type: str
build_options, # type: List[str]
@@ -244,10 +231,11 @@ class WheelBuilder(object):
req.name, e,
)
# Ignore return, we can't do anything else useful.
- self._clean_one(req, global_options)
+ _clean_one(req, global_options)
return None
- def _clean_one(self, req, global_options):
+
+def _clean_one(req, global_options):
# type: (InstallRequirement, List[str]) -> bool
clean_args = make_setuptools_clean_args(
req.setup_py_path,
@@ -262,6 +250,19 @@ class WheelBuilder(object):
logger.error('Failed cleaning build dir for %s', req.name)
return False
+
+class WheelBuilder(object):
+ """Build wheels from a RequirementSet."""
+
+ def __init__(
+ self,
+ preparer, # type: RequirementPreparer
+ wheel_cache, # type: WheelCache
+ ):
+ # type: (...) -> None
+ self.preparer = preparer
+ self.wheel_cache = wheel_cache
+
def build(
self,
requirements, # type: Iterable[InstallRequirement]
@@ -304,7 +305,7 @@ class WheelBuilder(object):
with indent_log():
build_successes, build_failures = [], []
for req, cache_dir in buildset:
- wheel_file = self._build_one(
+ wheel_file = _build_one(
req, cache_dir, build_options, global_options
)
if wheel_file:
