Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Changelog
+++++++++



Unreleased
==========

- Fix invoking the backend on an inexistent output directory with multiple levels (`PR #318`_, Fixes `#316`_)

.. _PR #318: https://github.com/pypa/build/pull/318
.. _#316: https://github.com/pypa/build/issues/316



0.5.0 (19-06-2021)
==================

Expand Down
2 changes: 1 addition & 1 deletion src/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def _call_backend(self, hook_name, outdir, config_settings=None, **kwargs):
if not os.path.isdir(outdir):
raise BuildException("Build path '{}' exists and is not a directory".format(outdir))
else:
os.mkdir(outdir)
os.makedirs(outdir)

with self._handle_backend(hook_name):
basename = callback(outdir, config_settings, **kwargs) # type: str
Expand Down
22 changes: 22 additions & 0 deletions tests/test_projectbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,28 @@ def test_prepare_not_dir_outdir(mocker, tmp_dir, test_flit_path):
builder.prepare('wheel', out)


def test_no_outdir_single(mocker, tmp_dir, test_flit_path):
mocker.patch('pep517.wrappers.Pep517HookCaller.prepare_metadata_for_build_wheel', return_value='')

builder = build.ProjectBuilder(test_flit_path)

out = os.path.join(tmp_dir, 'out')
builder.prepare('wheel', out)

assert os.path.isdir(out)


def test_no_outdir_multiple(mocker, tmp_dir, test_flit_path):
mocker.patch('pep517.wrappers.Pep517HookCaller.prepare_metadata_for_build_wheel', return_value='')

builder = build.ProjectBuilder(test_flit_path)

out = os.path.join(tmp_dir, 'does', 'not', 'exist')
builder.prepare('wheel', out)

assert os.path.isdir(out)


def test_runner_user_specified(tmp_dir, test_flit_path):
def dummy_runner(cmd, cwd=None, env=None):
raise RuntimeError('Runner was called')
Expand Down