1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Phase 1 - build wheels using PEP 517 hook

This commit is contained in:
Paul Moore 2018-08-16 15:07:50 +01:00 committed by Benoit Pierre
parent 744b8cf96e
commit de4d5038f8

View file

@ -668,7 +668,11 @@ class WheelBuilder(object):
def _build_one_inside_env(self, req, output_dir, python_tag=None):
with TempDirectory(kind="wheel") as temp_dir:
if self.__build_one(req, temp_dir.path, python_tag=python_tag):
if req.use_pep517:
builder = self._build_one_pep517
else:
builder = self._build_one_legacy
if builder(req, temp_dir.path, python_tag=python_tag):
try:
wheel_name = os.listdir(temp_dir.path)[0]
wheel_path = os.path.join(output_dir, wheel_name)
@ -693,7 +697,25 @@ class WheelBuilder(object):
SETUPTOOLS_SHIM % req.setup_py
] + list(self.global_options)
def __build_one(self, req, tempd, python_tag=None):
def _build_one_pep517(self, req, tempd, python_tag=None):
# TODO: Cannot support python_tag
spin_message = 'Running PEP 517 build_wheel for %s' % (req.name,)
with open_spinner(spin_message) as spinner:
logger.debug('Destination directory: %s', tempd)
# assert req.metadata_directory is not None
try:
req.pep517_backend.build_wheel(
tempd,
# metadata_directory=req.metadata_directory
metadata_directory=None
)
return True
except Exception:
spinner.finish("error")
logger.error('Failed building wheel for %s', req.name)
return False
def _build_one_legacy(self, req, tempd, python_tag=None):
base_args = self._base_setup_args(req)
spin_message = 'Running setup.py bdist_wheel for %s' % (req.name,)