| 1 |
# SPDX-License-Identifier: MIT |
| 2 |
|
| 3 |
import os.path |
| 4 |
import tarfile |
| 5 |
import zipfile |
| 6 |
|
| 7 |
|
| 8 |
def build_sdist(sdist_directory, config_settings=None): |
| 9 |
name = 'test_cant_build_via_sdist-1.0.0' |
| 10 |
file = f'{name}.tar.gz' |
| 11 |
with tarfile.open(os.path.join(sdist_directory, file), 'w') as t: |
| 12 |
t.add('pyproject.toml', f'{name}/pyproject.toml') |
| 13 |
t.add('backend_bad_sdist.py', f'{name}/backend_bad_sdist.py') |
| 14 |
return file |
| 15 |
|
| 16 |
|
| 17 |
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): |
| 18 |
if not os.path.isfile('some-file-that-is-needed-for-build.txt'): |
| 19 |
msg = 'some-file-that-is-needed-for-build.txt is missing!' |
| 20 |
raise FileNotFoundError(msg) |
| 21 |
# pragma: no cover |
| 22 |
file = 'test_cant_build_via_sdist-1.0.0-py3-none-any.whl' |
| 23 |
zipfile.ZipFile(os.path.join(wheel_directory, file), 'w').close() |
| 24 |
return file |